From: Yi-Hung Wei <yihung....@gmail.com>

Upstream commit:
    commit 41e4e2cd75346667b0c531c07dab05cce5b06d15
    Author: Yi-Hung Wei <yihung....@gmail.com>
    Date:   Thu Jan 3 09:51:57 2019 -0800

    openvswitch: Fix IPv6 later frags parsing

    The previous commit fa642f08839b
    ("openvswitch: Derive IP protocol number for IPv6 later frags")
    introduces IP protocol number parsing for IPv6 later frags that can mess
    up the network header length calculation logic, i.e. nh_len < 0.
    However, the network header length calculation is mainly for deriving
    the transport layer header in the key extraction process which the later
    fragment does not apply.

    Therefore, this commit skips the network header length calculation to
    fix the issue.

    Reported-by: Chris Mi <chr...@mellanox.com>
    Reported-by: Greg Rose <gvrose8...@gmail.com>
    Fixes: fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later 
frags")
    Signed-off-by: Yi-Hung Wei <yihung....@gmail.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Fixes: 9a4ab6da01f7 ("datapath: Derive IP protocol number for IPv6 later frags")
Cc: Yi-Hung Wei <yihung....@gmail.com>
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 datapath/flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index f685cf3..f6a95f9 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -276,10 +276,12 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct 
sw_flow_key *key)
 
        nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags);
        if (flags & IP6_FH_F_FRAG) {
-               if (frag_off)
+               if (frag_off) {
                        key->ip.frag = OVS_FRAG_TYPE_LATER;
-               else
-                       key->ip.frag = OVS_FRAG_TYPE_FIRST;
+                       key->ip.proto = nexthdr;
+                       return 0;
+               }
+               key->ip.frag = OVS_FRAG_TYPE_FIRST;
        } else {
                key->ip.frag = OVS_FRAG_TYPE_NONE;
        }
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to