* [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs
@ 2013-08-26 10:31 Hannes Frederic Sowa
2013-08-26 10:34 ` Hannes Frederic Sowa
2013-08-27 9:23 ` Steffen Klassert
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2013-08-26 10:31 UTC (permalink / raw)
To: netdev; +Cc: steffen.klassert, eric.dumazet
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>
---
net/ipv6/ip6_output.c | 3 +++
net/ipv6/raw.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 6e3ddf8..e7ceb6c 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -238,6 +238,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
hdr->saddr = fl6->saddr;
hdr->daddr = *first_hop;
+ skb->protocol = htons(ETH_P_IPV6);
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
@@ -1057,6 +1058,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
/* initialize protocol header pointer */
skb->transport_header = skb->network_header + fragheaderlen;
+ skb->protocol = htons(ETH_P_IPV6);
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum = 0;
}
@@ -1359,6 +1361,7 @@ alloc_new_skb:
/*
* Fill in the control structures
*/
+ skb->protocol = htons(ETH_P_IPV6);
skb->ip_summed = CHECKSUM_NONE;
skb->csum = 0;
/* reserve for fragmentation and ipsec header */
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index c45f7a5..cdaed47 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -628,6 +628,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
goto error;
skb_reserve(skb, hlen);
+ skb->protocol = htons(ETH_P_IPV6);
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
skb_dst_set(skb, &rt->dst);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs
2013-08-26 10:31 [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs Hannes Frederic Sowa
@ 2013-08-26 10:34 ` Hannes Frederic Sowa
2013-08-27 9:23 ` Steffen Klassert
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2013-08-26 10:34 UTC (permalink / raw)
To: netdev, steffen.klassert, eric.dumazet
> Subject: [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs
Should be [PATCH ipsec 2/2], of course.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs
2013-08-26 10:31 [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs Hannes Frederic Sowa
2013-08-26 10:34 ` Hannes Frederic Sowa
@ 2013-08-27 9:23 ` Steffen Klassert
1 sibling, 0 replies; 3+ messages in thread
From: Steffen Klassert @ 2013-08-27 9:23 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: netdev, eric.dumazet
On Mon, Aug 26, 2013 at 12:31:23PM +0200, Hannes Frederic Sowa wrote:
> 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>
Also applied to ipsec, thanks a lot!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-27 9:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 10:31 [PATCH 2/2] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs Hannes Frederic Sowa
2013-08-26 10:34 ` Hannes Frederic Sowa
2013-08-27 9:23 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).