Commit 9c9c9ad5fae7e9ef56a38acb508a01919b225e9a

Authored by Hannes Frederic Sowa
Committed by Steffen Klassert
1 parent 5a25cf1e31

ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs

Currently we don't initialize skb->protocol when transmitting data via
tcp, raw(with and without inclhdr) or udp+ufo or appending data directly
to the socket transmit queue (via ip6_append_data). This needs to be
done so that we can get the correct mtu in the xfrm layer.

Setting of skb->protocol happens only in functions where we also have
a transmitting socket and a new skb, so we don't overwrite old values.

Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>

Showing 2 changed files with 4 additions and 0 deletions Side-by-side Diff

net/ipv6/ip6_output.c
... ... @@ -238,6 +238,7 @@
238 238 hdr->saddr = fl6->saddr;
239 239 hdr->daddr = *first_hop;
240 240  
  241 + skb->protocol = htons(ETH_P_IPV6);
241 242 skb->priority = sk->sk_priority;
242 243 skb->mark = sk->sk_mark;
243 244  
... ... @@ -1057,6 +1058,7 @@
1057 1058 /* initialize protocol header pointer */
1058 1059 skb->transport_header = skb->network_header + fragheaderlen;
1059 1060  
  1061 + skb->protocol = htons(ETH_P_IPV6);
1060 1062 skb->ip_summed = CHECKSUM_PARTIAL;
1061 1063 skb->csum = 0;
1062 1064 }
... ... @@ -1359,6 +1361,7 @@
1359 1361 /*
1360 1362 * Fill in the control structures
1361 1363 */
  1364 + skb->protocol = htons(ETH_P_IPV6);
1362 1365 skb->ip_summed = CHECKSUM_NONE;
1363 1366 skb->csum = 0;
1364 1367 /* reserve for fragmentation and ipsec header */
... ... @@ -628,6 +628,7 @@
628 628 goto error;
629 629 skb_reserve(skb, hlen);
630 630  
  631 + skb->protocol = htons(ETH_P_IPV6);
631 632 skb->priority = sk->sk_priority;
632 633 skb->mark = sk->sk_mark;
633 634 skb_dst_set(skb, &rt->dst);