netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPCOMP6] Exclude IPCOMP header from props.header_len
@ 2004-07-10  3:32 Herbert Xu
  2004-07-10  4:36 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2004-07-10  3:32 UTC (permalink / raw)
  To: David S. Miller, yoshfuji, netdev

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

Hi:

Now that the IPv4 encap stuff is out of the way, I'll be sending you
the IPv6 versions.

Here is the one to remove the unnecessary extra space reserved for
IPCOMP.

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: 1395 bytes --]

===== net/ipv6/ipcomp6.c 1.11 vs edited =====
--- 1.11/net/ipv6/ipcomp6.c	2004-06-18 16:20:58 +10:00
+++ edited/net/ipv6/ipcomp6.c	2004-07-10 13:26:45 +10:00
@@ -123,7 +123,7 @@
 	int err;
 	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x = dst->xfrm;
-	struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph;
+	struct ipv6hdr *iph, *top_iph;
 	int hdr_len = 0;
 	struct ipv6_comp_hdr *ipch;
 	struct ipcomp_data *ipcd = x->data;
@@ -193,19 +193,11 @@
 	if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) {
 		goto out_ok;
 	}
-	memcpy(start, scratch, dlen);
-	pskb_trim(*pskb, hdr_len+dlen);
+	memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
+	pskb_trim(*pskb, hdr_len + dlen + sizeof(struct ip_comp_hdr));
 
 	/* insert ipcomp header and replace datagram */
-	tmp_iph = kmalloc(hdr_len, GFP_ATOMIC);
-	if (!tmp_iph) {
-		err = -ENOMEM;
-		goto error;
-	}
-	memcpy(tmp_iph, (*pskb)->nh.raw, hdr_len);
-	top_iph = (struct ipv6hdr*)skb_push(*pskb, sizeof(struct ipv6_comp_hdr));
-	memcpy(top_iph, tmp_iph, hdr_len);
-	kfree(tmp_iph);
+	top_iph = (*pskb)->nh.ipv6h;
 
 	if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
 		IP6_ECN_clear(top_iph);
@@ -358,7 +350,7 @@
 		goto error;
 
 	memset(ipcd, 0, sizeof(*ipcd));
-	x->props.header_len = sizeof(struct ipv6_comp_hdr);
+	x->props.header_len = 0;
 	if (x->props.mode)
 		x->props.header_len += sizeof(struct ipv6hdr);
 	

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

end of thread, other threads:[~2004-07-13 10:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-10  3:32 [IPCOMP6] Exclude IPCOMP header from props.header_len Herbert Xu
2004-07-10  4:36 ` YOSHIFUJI Hideaki / 吉藤英明
2004-07-10  9:16   ` IPv6 and encapsulation headers Herbert Xu
2004-07-12  8:32     ` Kazunori Miyazawa
2004-07-12 10:47       ` Herbert Xu
2004-07-13  1:42         ` Kazunori Miyazawa
2004-07-13 10:48           ` Herbert Xu
2004-07-10 19:21   ` [IPCOMP6] Exclude IPCOMP header from props.header_len 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).