Skip to content

Commit 9c9c9ad

Browse files
strssndktnklassert
authored andcommitted
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 <[email protected]> Cc: Eric Dumazet <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 5a25cf1 commit 9c9c9ad

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

net/ipv6/ip6_output.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
238238
hdr->saddr = fl6->saddr;
239239
hdr->daddr = *first_hop;
240240

241+
skb->protocol = htons(ETH_P_IPV6);
241242
skb->priority = sk->sk_priority;
242243
skb->mark = sk->sk_mark;
243244

@@ -1057,6 +1058,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
10571058
/* initialize protocol header pointer */
10581059
skb->transport_header = skb->network_header + fragheaderlen;
10591060

1061+
skb->protocol = htons(ETH_P_IPV6);
10601062
skb->ip_summed = CHECKSUM_PARTIAL;
10611063
skb->csum = 0;
10621064
}
@@ -1359,6 +1361,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
13591361
/*
13601362
* Fill in the control structures
13611363
*/
1364+
skb->protocol = htons(ETH_P_IPV6);
13621365
skb->ip_summed = CHECKSUM_NONE;
13631366
skb->csum = 0;
13641367
/* reserve for fragmentation and ipsec header */

net/ipv6/raw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
628628
goto error;
629629
skb_reserve(skb, hlen);
630630

631+
skb->protocol = htons(ETH_P_IPV6);
631632
skb->priority = sk->sk_priority;
632633
skb->mark = sk->sk_mark;
633634
skb_dst_set(skb, &rt->dst);

0 commit comments

Comments
 (0)