* [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags
@ 2018-08-10 17:19 Yi-Hung Wei
2018-08-13 1:09 ` Pravin Shelar
0 siblings, 1 reply; 4+ messages in thread
From: Yi-Hung Wei @ 2018-08-10 17:19 UTC (permalink / raw)
To: netdev, u9012063; +Cc: Yi-Hung Wei
Currently, OVS only parses the IP protocol number for the first
IPv6 fragment, but sets the IP protocol number for the later fragments
to be NEXTHDF_FRAGMENT. This patch tries to derive the IP protocol
number for the IPV6 later frags so that we can match that.
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
net/openvswitch/flow.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 56b8e7167790..3d654c4f71be 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -297,7 +297,13 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
nh_len = payload_ofs - nh_ofs;
skb_set_transport_header(skb, nh_ofs + nh_len);
- key->ip.proto = nexthdr;
+ if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
+ unsigned int offset = 0;
+
+ key->ip.proto = ipv6_find_hdr(skb, &offset, -1, NULL, NULL);
+ } else {
+ key->ip.proto = nexthdr;
+ }
return nh_len;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags
2018-08-10 17:19 [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags Yi-Hung Wei
@ 2018-08-13 1:09 ` Pravin Shelar
2018-08-13 17:48 ` William Tu
0 siblings, 1 reply; 4+ messages in thread
From: Pravin Shelar @ 2018-08-13 1:09 UTC (permalink / raw)
To: Yi-Hung Wei; +Cc: Linux Kernel Network Developers, William Tu
On Fri, Aug 10, 2018 at 10:19 AM, Yi-Hung Wei <yihung.wei@gmail.com> wrote:
> Currently, OVS only parses the IP protocol number for the first
> IPv6 fragment, but sets the IP protocol number for the later fragments
> to be NEXTHDF_FRAGMENT. This patch tries to derive the IP protocol
> number for the IPV6 later frags so that we can match that.
>
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
> ---
> net/openvswitch/flow.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> index 56b8e7167790..3d654c4f71be 100644
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> @@ -297,7 +297,13 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
>
> nh_len = payload_ofs - nh_ofs;
> skb_set_transport_header(skb, nh_ofs + nh_len);
> - key->ip.proto = nexthdr;
> + if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
> + unsigned int offset = 0;
> +
> + key->ip.proto = ipv6_find_hdr(skb, &offset, -1, NULL, NULL);
> + } else {
> + key->ip.proto = nexthdr;
> + }
parsing ipv6 ipv6_skip_exthdr() is called to find fragment hdr and
then this patch calls ipv6_find_hdr() to find next protocol. I think
we could call ipv6_find_hdr() to get fragment type and next hdr, that
would save parsing same packet twice in some cases.
Other option would be calling ipv6_find_hdr() after setting OVS_FRAG_TYPE_LATER.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags
2018-08-13 1:09 ` Pravin Shelar
@ 2018-08-13 17:48 ` William Tu
2018-08-13 19:47 ` Yi-Hung Wei
0 siblings, 1 reply; 4+ messages in thread
From: William Tu @ 2018-08-13 17:48 UTC (permalink / raw)
To: pravin shelar; +Cc: Yi-Hung Wei, Linux Kernel Network Developers
On Sun, Aug 12, 2018 at 6:09 PM Pravin Shelar <pshelar@ovn.org> wrote:
>
> On Fri, Aug 10, 2018 at 10:19 AM, Yi-Hung Wei <yihung.wei@gmail.com> wrote:
> > Currently, OVS only parses the IP protocol number for the first
> > IPv6 fragment, but sets the IP protocol number for the later fragments
> > to be NEXTHDF_FRAGMENT. This patch tries to derive the IP protocol
> > number for the IPV6 later frags so that we can match that.
> >
> > Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
> > ---
> > net/openvswitch/flow.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> > index 56b8e7167790..3d654c4f71be 100644
> > --- a/net/openvswitch/flow.c
> > +++ b/net/openvswitch/flow.c
> > @@ -297,7 +297,13 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
> >
> > nh_len = payload_ofs - nh_ofs;
> > skb_set_transport_header(skb, nh_ofs + nh_len);
> > - key->ip.proto = nexthdr;
> > + if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
> > + unsigned int offset = 0;
How about we start the 2nd time parsing from
unsigned int offset = payload_ofs;
> > +
> > + key->ip.proto = ipv6_find_hdr(skb, &offset, -1, NULL, NULL);
Then we only find the last header from previous parsed offset.
William
> > + } else {
> > + key->ip.proto = nexthdr;
> > + }
> parsing ipv6 ipv6_skip_exthdr() is called to find fragment hdr and
> then this patch calls ipv6_find_hdr() to find next protocol. I think
> we could call ipv6_find_hdr() to get fragment type and next hdr, that
> would save parsing same packet twice in some cases.
>
> Other option would be calling ipv6_find_hdr() after setting OVS_FRAG_TYPE_LATER.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags
2018-08-13 17:48 ` William Tu
@ 2018-08-13 19:47 ` Yi-Hung Wei
0 siblings, 0 replies; 4+ messages in thread
From: Yi-Hung Wei @ 2018-08-13 19:47 UTC (permalink / raw)
To: William Tu; +Cc: Pravin Shelar, Linux Kernel Network Developers
On Mon, Aug 13, 2018 at 10:48 AM William Tu <u9012063@gmail.com> wrote:
> > > --- a/net/openvswitch/flow.c
> > > +++ b/net/openvswitch/flow.c
> > > @@ -297,7 +297,13 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
> > >
> > > nh_len = payload_ofs - nh_ofs;
> > > skb_set_transport_header(skb, nh_ofs + nh_len);
> > > - key->ip.proto = nexthdr;
> > > + if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
> > > + unsigned int offset = 0;
>
> How about we start the 2nd time parsing from
> unsigned int offset = payload_ofs;
>
> > > +
> > > + key->ip.proto = ipv6_find_hdr(skb, &offset, -1, NULL, NULL);
>
> Then we only find the last header from previous parsed offset.
>
> William
>
> > > + } else {
> > > + key->ip.proto = nexthdr;
> > > + }
> > parsing ipv6 ipv6_skip_exthdr() is called to find fragment hdr and
> > then this patch calls ipv6_find_hdr() to find next protocol. I think
> > we could call ipv6_find_hdr() to get fragment type and next hdr, that
> > would save parsing same packet twice in some cases.
> >
> > Other option would be calling ipv6_find_hdr() after setting OVS_FRAG_TYPE_LATER.
Thanks Pravin and William's feedback.
After looking into ipv6_find_hdr() more closely, I think we can just
call ipv6_find_hdr() once and derive everything we need.
I will submit the new patch once net-next is open.
Thanks,
-Yi-Hung
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-13 22:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-10 17:19 [PATCH net-next] openvswitch: Derive IP protocol number for IPv6 later frags Yi-Hung Wei
2018-08-13 1:09 ` Pravin Shelar
2018-08-13 17:48 ` William Tu
2018-08-13 19:47 ` Yi-Hung Wei
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).