Ben Hutchings
2015-Jan-27 02:47 UTC
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote:> If the IPv6 fragment id has not been set and we perform > fragmentation due to UFO, select a new fragment id. > When we store the fragment id into skb_shinfo, set the bit > in the skb so we can re-use the selected id. > This preserves the behavior of UFO packets generated on the > host and solves the issue of id generation for packet sockets > and tap/macvtap devices. > > This patch moves ipv6_select_ident() back in to the header file. > It also provides the helper function that sets skb_shinfo() frag > id and sets the bit. > > It also makes sure that we select the fragment id when doing > just gso validation, since it's possible for the packet to > come from an untrusted source (VM) and be forwarded through > a UFO enabled device which will expect the fragment id. > > CC: Eric Dumazet <edumazet at google.com> > Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com> > --- > include/linux/skbuff.h | 3 ++- > include/net/ipv6.h | 2 ++ > net/ipv6/ip6_output.c | 4 ++-- > net/ipv6/output_core.c | 9 ++++++++- > net/ipv6/udp_offload.c | 10 +++++++++- > 5 files changed, 23 insertions(+), 5 deletions(-) > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index 85ab7d7..3ad5203 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -605,7 +605,8 @@ struct sk_buff { > __u8 ipvs_property:1; > __u8 inner_protocol_type:1; > __u8 remcsum_offload:1; > - /* 3 or 5 bit hole */ > + __u8 ufo_fragid_set:1;[...] Doesn't the flag belong in struct skb_shared_info, rather than struct sk_buff? Otherwise this looks fine. Ben. -- Ben Hutchings When in doubt, use brute force. - Ken Thompson -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 811 bytes Desc: This is a digitally signed message part URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20150127/da64381a/attachment.sig>
David Miller
2015-Jan-27 08:27 UTC
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
From: Ben Hutchings <ben at decadent.org.uk> Date: Tue, 27 Jan 2015 02:47:54 +0000> On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote: >> If the IPv6 fragment id has not been set and we perform >> fragmentation due to UFO, select a new fragment id. >> When we store the fragment id into skb_shinfo, set the bit >> in the skb so we can re-use the selected id. >> This preserves the behavior of UFO packets generated on the >> host and solves the issue of id generation for packet sockets >> and tap/macvtap devices. >> >> This patch moves ipv6_select_ident() back in to the header file. >> It also provides the helper function that sets skb_shinfo() frag >> id and sets the bit. >> >> It also makes sure that we select the fragment id when doing >> just gso validation, since it's possible for the packet to >> come from an untrusted source (VM) and be forwarded through >> a UFO enabled device which will expect the fragment id. >> >> CC: Eric Dumazet <edumazet at google.com> >> Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com>Applied, thanks Ben.
Michael S. Tsirkin
2015-Jan-27 08:42 UTC
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
On Tue, Jan 27, 2015 at 02:47:54AM +0000, Ben Hutchings wrote:> On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote: > > If the IPv6 fragment id has not been set and we perform > > fragmentation due to UFO, select a new fragment id. > > When we store the fragment id into skb_shinfo, set the bit > > in the skb so we can re-use the selected id. > > This preserves the behavior of UFO packets generated on the > > host and solves the issue of id generation for packet sockets > > and tap/macvtap devices. > > > > This patch moves ipv6_select_ident() back in to the header file. > > It also provides the helper function that sets skb_shinfo() frag > > id and sets the bit. > > > > It also makes sure that we select the fragment id when doing > > just gso validation, since it's possible for the packet to > > come from an untrusted source (VM) and be forwarded through > > a UFO enabled device which will expect the fragment id. > > > > CC: Eric Dumazet <edumazet at google.com> > > Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com> > > --- > > include/linux/skbuff.h | 3 ++- > > include/net/ipv6.h | 2 ++ > > net/ipv6/ip6_output.c | 4 ++-- > > net/ipv6/output_core.c | 9 ++++++++- > > net/ipv6/udp_offload.c | 10 +++++++++- > > 5 files changed, 23 insertions(+), 5 deletions(-) > > > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > index 85ab7d7..3ad5203 100644 > > --- a/include/linux/skbuff.h > > +++ b/include/linux/skbuff.h > > @@ -605,7 +605,8 @@ struct sk_buff { > > __u8 ipvs_property:1; > > __u8 inner_protocol_type:1; > > __u8 remcsum_offload:1; > > - /* 3 or 5 bit hole */ > > + __u8 ufo_fragid_set:1; > [...] > > Doesn't the flag belong in struct skb_shared_info, rather than struct > sk_buff? Otherwise this looks fine. > > Ben.Hmm we seem to be out of tx flags. Maybe ip6_frag_id == 0 should mean "not set".> -- > Ben Hutchings > When in doubt, use brute force. - Ken Thompson
Hannes Frederic Sowa
2015-Jan-27 13:47 UTC
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
On Di, 2015-01-27 at 10:42 +0200, Michael S. Tsirkin wrote:> On Tue, Jan 27, 2015 at 02:47:54AM +0000, Ben Hutchings wrote: > > On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote: > > > If the IPv6 fragment id has not been set and we perform > > > fragmentation due to UFO, select a new fragment id. > > > When we store the fragment id into skb_shinfo, set the bit > > > in the skb so we can re-use the selected id. > > > This preserves the behavior of UFO packets generated on the > > > host and solves the issue of id generation for packet sockets > > > and tap/macvtap devices. > > > > > > This patch moves ipv6_select_ident() back in to the header file. > > > It also provides the helper function that sets skb_shinfo() frag > > > id and sets the bit. > > > > > > It also makes sure that we select the fragment id when doing > > > just gso validation, since it's possible for the packet to > > > come from an untrusted source (VM) and be forwarded through > > > a UFO enabled device which will expect the fragment id. > > > > > > CC: Eric Dumazet <edumazet at google.com> > > > Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com> > > > --- > > > include/linux/skbuff.h | 3 ++- > > > include/net/ipv6.h | 2 ++ > > > net/ipv6/ip6_output.c | 4 ++-- > > > net/ipv6/output_core.c | 9 ++++++++- > > > net/ipv6/udp_offload.c | 10 +++++++++- > > > 5 files changed, 23 insertions(+), 5 deletions(-) > > > > > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > > index 85ab7d7..3ad5203 100644 > > > --- a/include/linux/skbuff.h > > > +++ b/include/linux/skbuff.h > > > @@ -605,7 +605,8 @@ struct sk_buff { > > > __u8 ipvs_property:1; > > > __u8 inner_protocol_type:1; > > > __u8 remcsum_offload:1; > > > - /* 3 or 5 bit hole */ > > > + __u8 ufo_fragid_set:1; > > [...] > > > > Doesn't the flag belong in struct skb_shared_info, rather than struct > > sk_buff? Otherwise this looks fine. > > > > Ben. > > Hmm we seem to be out of tx flags. > Maybe ip6_frag_id == 0 should mean "not set".Maybe that is the best idea. Definitely the ufo_fragid_set bit should move into the skb_shared_info area. Thanks, Hannes
Apparently Analagous Threads
- [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
- [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
- [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
- [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
- [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.