Commit f53a60b3 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarYoshifuji Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 01124b4f
...@@ -123,7 +123,7 @@ static int ipcomp6_output(struct sk_buff **pskb) ...@@ -123,7 +123,7 @@ static int ipcomp6_output(struct sk_buff **pskb)
int err; int err;
struct dst_entry *dst = (*pskb)->dst; struct dst_entry *dst = (*pskb)->dst;
struct xfrm_state *x = dst->xfrm; struct xfrm_state *x = dst->xfrm;
struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph; struct ipv6hdr *iph, *top_iph;
int hdr_len = 0; int hdr_len = 0;
struct ipv6_comp_hdr *ipch; struct ipv6_comp_hdr *ipch;
struct ipcomp_data *ipcd = x->data; struct ipcomp_data *ipcd = x->data;
...@@ -193,19 +193,11 @@ static int ipcomp6_output(struct sk_buff **pskb) ...@@ -193,19 +193,11 @@ static int ipcomp6_output(struct sk_buff **pskb)
if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) { if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) {
goto out_ok; goto out_ok;
} }
memcpy(start, scratch, dlen); memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
pskb_trim(*pskb, hdr_len+dlen); pskb_trim(*pskb, hdr_len + dlen + sizeof(struct ip_comp_hdr));
/* insert ipcomp header and replace datagram */ /* insert ipcomp header and replace datagram */
tmp_iph = kmalloc(hdr_len, GFP_ATOMIC); top_iph = (*pskb)->nh.ipv6h;
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);
if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN)) if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
IP6_ECN_clear(top_iph); IP6_ECN_clear(top_iph);
...@@ -358,7 +350,7 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args) ...@@ -358,7 +350,7 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args)
goto error; goto error;
memset(ipcd, 0, sizeof(*ipcd)); memset(ipcd, 0, sizeof(*ipcd));
x->props.header_len = sizeof(struct ipv6_comp_hdr); x->props.header_len = 0;
if (x->props.mode) if (x->props.mode)
x->props.header_len += sizeof(struct ipv6hdr); x->props.header_len += sizeof(struct ipv6hdr);
......
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