aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2004-07-09 22:13:01 -0700
committerDavid S. Miller <davem@nuts.davemloft.net>2004-07-09 22:13:01 -0700
commitf53a60b35f9aee0f8f2a177ff260593445821d84 (patch)
tree9f4545d61fb172987c490e6b18833ff7bf32673f /net
parent01124b4fb8a459aa40de919c481f8f0558c7aa5c (diff)
downloadhistory-f53a60b35f9aee0f8f2a177ff260593445821d84.tar.gz
[IPCOMP6]: Exclude IPCOMP header from props.header_len
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> Signed-off-by: Yoshifuji Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ipcomp6.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index d129078f0b8fa7..5abb89b9c1d98f 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -123,7 +123,7 @@ static int ipcomp6_output(struct sk_buff **pskb)
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 @@ static int ipcomp6_output(struct sk_buff **pskb)
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 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args)
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);