Commit a31f1aeb authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[INET]: Fix ECN encapsulation.

We broke ECN encapsulation in tunnels recently.
Without this patch, even though encapusulated (inner) packet is 
'not-ECN', encapusulating (outer) packet is sent with 'ECT(0)' set.
This is wrong and should be 'not-ECN.'
This patch fixes up.

From RFC3168:
   The full-functionality option for ECN encapsulation is to copy the
   ECN codepoint of the inside header to the outside header on
   encapsulation if the inside header is not-ECT or ECT, and to set the
   ECN codepoint of the outside header to ECT(0) if the ECN codepoint of
   the inside header is CE.
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1b4d745
...@@ -30,7 +30,8 @@ static inline int INET_ECN_is_capable(__u8 dsfield) ...@@ -30,7 +30,8 @@ static inline int INET_ECN_is_capable(__u8 dsfield)
static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
{ {
outer &= ~INET_ECN_MASK; outer &= ~INET_ECN_MASK;
outer |= (inner & INET_ECN_MASK) ?: INET_ECN_ECT_0; outer |= !INET_ECN_is_ce(inner) ? (inner & INET_ECN_MASK) :
INET_ECN_ECT_0;
return outer; return outer;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment