summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2004-09-08 07:19:49 -0700
committerDavid S. Miller <davem@nuts.davemloft.net>2004-09-08 07:19:49 -0700
commita0e2318c6d7bd388d6b99672c310adf9e44dd7bd (patch)
treedc3470a2babca7eaf891ac5b99521cc0838c8aa1
parent3984b018554e27b4ed398d1c85da1f93aed3f410 (diff)
[IPSEC]: Fix ECN encapsulation on ipv6.
While doing the ECN patch I discovered that IPsec on IPv6 wasn't encapsulating the ECN correctly. This patch fixes that. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/xfrm6_output.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index b67187525d3c..40612ec54305 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -12,6 +12,7 @@
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/icmpv6.h>
+#include <net/dsfield.h>
#include <net/inet_ecn.h>
#include <net/ipv6.h>
#include <net/xfrm.h>
@@ -36,6 +37,7 @@ static void xfrm6_encap(struct sk_buff *skb)
struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm;
struct ipv6hdr *iph, *top_iph;
+ int dsfield;
skb_push(skb, x->props.header_len);
iph = skb->nh.ipv6h;
@@ -58,11 +60,14 @@ static void xfrm6_encap(struct sk_buff *skb)
top_iph->version = 6;
top_iph->priority = iph->priority;
- if (x->props.flags & XFRM_STATE_NOECN)
- IP6_ECN_clear(top_iph);
top_iph->flow_lbl[0] = iph->flow_lbl[0];
top_iph->flow_lbl[1] = iph->flow_lbl[1];
top_iph->flow_lbl[2] = iph->flow_lbl[2];
+ dsfield = ipv6_get_dsfield(top_iph);
+ dsfield = INET_ECN_encapsulate(dsfield, dsfield);
+ if (x->props.flags & XFRM_STATE_NOECN)
+ dsfield &= ~INET_ECN_MASK;
+ ipv6_change_dsfield(top_iph, 0, dsfield);
top_iph->nexthdr = IPPROTO_IPV6;
top_iph->hop_limit = dst_path_metric(dst, RTAX_HOPLIMIT);
ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);