Skip to content

Commit

Permalink
ipv6: fix incorrent ipv6 ipsec packet fragment
Browse files Browse the repository at this point in the history
Since commit 299b076(ipv6: Fix IPsec slowpath fragmentation problem)
In func ip6_append_data,after call skb_put(skb, fraglen + dst_exthdrlen)
the skb->len contains dst_exthdrlen,and we don't reduce dst_exthdrlen at last
This will make fraggap>0 in next "while cycle",and cause the size of skb incorrent

Fix this by reserve headroom for dst_exthdrlen.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gao feng authored and David S. Miller committed Mar 20, 2012
1 parent 5c473ed commit 1f85851
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/ipv6/ip6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,18 +1414,19 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
*/
skb->ip_summed = csummode;
skb->csum = 0;
/* reserve for fragmentation */
skb_reserve(skb, hh_len+sizeof(struct frag_hdr));
/* reserve for fragmentation and ipsec header */
skb_reserve(skb, hh_len + sizeof(struct frag_hdr) +
dst_exthdrlen);

if (sk->sk_type == SOCK_DGRAM)
skb_shinfo(skb)->tx_flags = tx_flags;

/*
* Find where to start putting bytes
*/
data = skb_put(skb, fraglen + dst_exthdrlen);
skb_set_network_header(skb, exthdrlen + dst_exthdrlen);
data += fragheaderlen + dst_exthdrlen;
data = skb_put(skb, fraglen);
skb_set_network_header(skb, exthdrlen);
data += fragheaderlen;
skb->transport_header = (skb->network_header +
fragheaderlen);
if (fraggap) {
Expand Down

0 comments on commit 1f85851

Please sign in to comment.