netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPSEC] Fix ECN encapsulation for IPv6
@ 2004-09-09  2:34 Herbert Xu
  2004-09-09  4:38 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2004-09-09  2:34 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

Hi:

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>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1225 bytes --]

===== net/ipv6/xfrm6_output.c 1.4 vs edited =====
--- 1.4/net/ipv6/xfrm6_output.c	2004-08-25 04:30:14 +10:00
+++ edited/net/ipv6/xfrm6_output.c	2004-09-09 12:27:57 +10:00
@@ -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 @@
 	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 @@
 
 	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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [IPSEC] Fix ECN encapsulation for IPv6
  2004-09-09  2:34 [IPSEC] Fix ECN encapsulation for IPv6 Herbert Xu
@ 2004-09-09  4:38 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-09-09  4:38 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

On Thu, 9 Sep 2004 12:34:54 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> 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>

Applied, thanks Herbert.

Please use my davem@davemloft.net email address in the future,
as that is what I'd like people to use to contact me.  This is
what is listed in CREDITS and MAINTAINERS as well.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-09  4:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09  2:34 [IPSEC] Fix ECN encapsulation for IPv6 Herbert Xu
2004-09-09  4:38 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).