diff mbox series

[ovs-dev,v2] flow: Allow matches on nw_proto also for IPv6 later frags.

Message ID 164902958312.987936.17848831793594595750.stgit@fed.void
State Rejected
Headers show
Series [ovs-dev,v2] flow: Allow matches on nw_proto also for IPv6 later frags. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Paolo Valerio April 3, 2022, 11:46 p.m. UTC
The next header contained in the last extension header of the IPv6
later frags still contain the information of the upper layer protocol
number.

Similarly to what OvS does for IPv4, allow L4 matches for later IPv6
frags as well by processing later frags and storing the nw_proto
information.

Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
---
v2:
- netdev-dummy/receive command got split in multiple lines.
---
 lib/flow.c            |    3 ---
 tests/ofproto-dpif.at |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)

Comments

Eelco Chaudron April 4, 2022, 8:03 a.m. UTC | #1
On 4 Apr 2022, at 1:46, Paolo Valerio wrote:

> The next header contained in the last extension header of the IPv6
> later frags still contain the information of the upper layer protocol
> number.
>
> Similarly to what OvS does for IPv4, allow L4 matches for later IPv6
> frags as well by processing later frags and storing the nw_proto
> information.
>
> Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
> ---
> v2:
> - netdev-dummy/receive command got split in multiple lines.
> ---

Thanks for fixing this, verified this on my setup and it works fine.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Aaron Conole April 4, 2022, 4 p.m. UTC | #2
Paolo Valerio <pvalerio@redhat.com> writes:

> The next header contained in the last extension header of the IPv6
> later frags still contain the information of the upper layer protocol
> number.
>
> Similarly to what OvS does for IPv4, allow L4 matches for later IPv6
> frags as well by processing later frags and storing the nw_proto
> information.
>
> Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
> ---
> v2:
> - netdev-dummy/receive command got split in multiple lines.
> ---

Same observation as on v1
diff mbox series

Patch

diff --git a/lib/flow.c b/lib/flow.c
index dd523c889..0a7301ccf 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -534,13 +534,10 @@  parse_ipv6_ext_hdrs__(const void **datap, size_t *sizep, uint8_t *nw_proto,
                 return false;
             }
 
-            /* We only process the first fragment. */
             if ((*frag_hdr)->ip6f_offlg != htons(0)) {
                 *nw_frag = FLOW_NW_FRAG_ANY;
                 if (((*frag_hdr)->ip6f_offlg & IP6F_OFF_MASK) != htons(0)) {
                     *nw_frag |= FLOW_NW_FRAG_LATER;
-                    *nw_proto = IPPROTO_FRAGMENT;
-                    return true;
                 }
             }
         }
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 58f08dff9..6d87a2d37 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -4757,6 +4757,53 @@  recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,fr
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif - fragment handling - IPv6 with match on L4 proto])
+AT_SKIP_IF([test $HAVE_IPV6 = no])
+OVS_VSWITCHD_START
+add_of_ports br0 1 2
+
+AT_DATA([flows.txt], [dnl
+priority=10,in_port=1,udp6,action=output:2
+priority=0,action=drop
+])
+AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
+
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'f2ff00000002f2ff0000000186dd6007c0aa05b02c40fc000000000000000000000000000001fc0000000000000000000000000000021100000161f9332fa33b1f900608390e dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000'])
+
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'f2ff00000002f2ff0000000186dd6007c0aa00682c40fc000000000000000000000000000001fc000000000000000000000000000002110005a861f9332f0000000000000000 dnl
+                                              00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl
+                                              000000000000000000000000000000000000'])
+
+AT_CHECK([ovs-appctl dpctl/dump-flows filter="in_port=1"], [0], [dnl
+flow-dump from the main thread:
+recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=17,frag=first), packets:0, bytes:0, used:never, actions:2
+recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=17,frag=later), packets:0, bytes:0, used:never, actions:2
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([ofproto-dpif - fragment handling - actions])
 OVS_VSWITCHD_START
 add_of_ports br0 1 2 3 4 5 6 90