Skip to contentSkip to conversation

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

PATCH Applied Hannes Frederic Sowa 2 participants 5 messages Feb 21, 2014 – Feb 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: reuse ip6_frag_id from ip6_ufo_append_data

Currently we generate a new fragmentation id on UFO segmentation. It is pretty hairy to identify the correct net namespace and dst there. Especially tunnels use IFF_XMIT_DST_RELEASE and thus have no skb_dst available at all.

This causes unreliable or very predictable ipv6 fragmentation id generation while segmentation.

Luckily we already have pregenerated the ip6_frag_id in ip6_ufo_append_data and can use it here.

---
 net/ipv6/udp_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp_offload.c +1 -1
index e7359f9..b261ee8 100644
@@ -113,7 +113,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
 		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
 		fptr->nexthdr = nexthdr;
 		fptr->reserved = 0;
-		ipv6_select_ident(fptr, (struct rt6_info *)skb_dst(skb));
+		fptr->identification = skb_shinfo(skb)->ip6_frag_id;
 
 		/* Fragment the skb. ipv6 header and the remaining fields of the
 		 * fragment header are updated in ipv6_gso_segment()
Signature · 1 line
1.8.5.3
maintainer Applied
#1 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 21 Feb 2014 02:55:35 +0100

Quoted 5 lines

Currently we generate a new fragmentation id on UFO segmentation. It is pretty hairy to identify the correct net namespace and dst there. Especially tunnels use IFF_XMIT_DST_RELEASE and thus have no skb_dst available at all.

Quoted 7 lines

This causes unreliable or very predictable ipv6 fragmentation id generation while segmentation.

Luckily we already have pregenerated the ip6_frag_id in ip6_ufo_append_data and can use it here.

Applied, thanks Hannes.

#2 lore raw

Hi David!

Quoted 11 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 21 Feb 2014 02:55:35 +0100

Quoted 8 lines

Currently we generate a new fragmentation id on UFO segmentation. It is pretty hairy to identify the correct net namespace and dst there. Especially tunnels use IFF_XMIT_DST_RELEASE and thus have no skb_dst available at all.

This causes unreliable or very predictable ipv6 fragmentation id generation while segmentation.

Quoted 6 lines
Quoted 4 lines

Luckily we already have pregenerated the ip6_frag_id in ip6_ufo_append_data and can use it here.

Applied, thanks Hannes.

Could you also get this at least into 3.13, as sit tunnels enable gso by default there?

Thank you,

Hannes

maintainer
#3 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 22 Feb 2014 06:52:31 +0100

Quoted 17 lines

Hi David!

Quoted 14 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 21 Feb 2014 02:55:35 +0100

Quoted 11 lines

Currently we generate a new fragmentation id on UFO segmentation. It is pretty hairy to identify the correct net namespace and dst there. Especially tunnels use IFF_XMIT_DST_RELEASE and thus have no skb_dst available at all.

This causes unreliable or very predictable ipv6 fragmentation id generation while segmentation.

Luckily we already have pregenerated the ip6_frag_id in ip6_ufo_append_data and can use it here.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks Hannes.

Could you also get this at least into 3.13, as sit tunnels enable gso by default there?

Queueud up for -stable, thanks Hannes.

#4 lore raw
Quoted 20 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 22 Feb 2014 06:52:31 +0100

Quoted 17 lines

Hi David!

Quoted 14 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 21 Feb 2014 02:55:35 +0100

Quoted 11 lines

Currently we generate a new fragmentation id on UFO segmentation. It is pretty hairy to identify the correct net namespace and dst there. Especially tunnels use IFF_XMIT_DST_RELEASE and thus have no skb_dst available at all.

This causes unreliable or very predictable ipv6 fragmentation id generation while segmentation.

Luckily we already have pregenerated the ip6_frag_id in ip6_ufo_append_data and can use it here.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks Hannes.

Could you also get this at least into 3.13, as sit tunnels enable gso by default there?

Queueud up for -stable, thanks Hannes.

Just FYI:

While doing some more code review on this part (and in the history), it seemes we can actually call ipv6_select_ident with ipv4 dsts from time to time thus using just the random memory available there to generate an ipv6 address. So this fix is appropriate for all kernels from v2.6.32 on.

We can now remove DST_NOPEER in net-next which was just introduced because of a bug in this logic and simplify ipv6_select_ident in net-next (patches coming after net merge to net-next).

Thanks,

Hannes