Skip to content

Commit

Permalink
xfrm6: Fix IPv6 ECN decapsulation
Browse files Browse the repository at this point in the history
Using ipv6_get_dsfield on the outer IP header implies that inner and
outer header are of the the same address family. For interfamily
tunnels, particularly 646, the code reading the DSCP field obtains the
wrong values (IHL and the upper four bits of the DSCP field).
This can cause the code to detect a congestion encoutered state in the
outer header and enable the corresponding bits in the inner header, too.

Since the DSCP field is stored in the xfrm mode common buffer
independently from the IP version of the outer header, it's safe (and
correct) to take this value from there.

Signed-off-by: Thomas Egerer <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
spellingmistake authored and klassert committed Aug 11, 2015
1 parent 07a51cd commit eae8dee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ipv6/xfrm6_mode_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
{
const struct ipv6hdr *outer_iph = ipv6_hdr(skb);
struct ipv6hdr *inner_iph = ipipv6_hdr(skb);

if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
if (INET_ECN_is_ce(XFRM_MODE_SKB_CB(skb)->tos))
IP6_ECN_set_ce(inner_iph);
}

Expand Down

0 comments on commit eae8dee

Please sign in to comment.