summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2019-01-03 09:51:57 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-26 09:20:39 +0100
commitd2bef7f33d11667567665613be94b56ce9071e74 (patch)
treeca50d00ebcf5a466f13148b0411ca2e3e0acfa27 /net
parent4b646199fafb59831c24fcbec015cf96cc73f2b8 (diff)
openvswitch: Fix IPv6 later frags parsing
[ Upstream commit 41e4e2cd75346667b0c531c07dab05cce5b06d15 ] 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 <chrism@mellanox.com> Reported-by: Greg Rose <gvrose8192@gmail.com> Fixes: fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later frags") Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/openvswitch/flow.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 35966da84769..f920a347ee1c 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;
}