From: Yi-Hung Wei Subject: [PATCH net] openvswitch: Fix IPv6 later frags parsing Date: Thu, 3 Jan 2019 09:51:57 -0800 Message-ID: <1546537917-20237-1-git-send-email-yihung.wei@gmail.com> Cc: Yi-Hung Wei To: netdev@vger.kernel.org, chrism@mellanox.com, gvrose8192@gmail.com, pshelar@ovn.org Return-path: Received: from mail-pl1-f195.google.com ([209.85.214.195]:38380 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727134AbfACR5V (ORCPT ); Thu, 3 Jan 2019 12:57:21 -0500 Received: by mail-pl1-f195.google.com with SMTP id e5so16212031plb.5 for ; Thu, 03 Jan 2019 09:57:20 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: 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 Reported-by: Greg Rose Fixes: fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later frags") Signed-off-by: Yi-Hung Wei --- net/openvswitch/flow.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 57e07768c9d1..f54cf17ef7a8 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/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; } -- 2.7.4