Skip to content

Commit 41e4e2c

Browse files
YiHungWeidavem330
authored andcommitted
openvswitch: Fix IPv6 later frags parsing
The previous commit fa642f0 ("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: fa642f0 ("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>
1 parent ba3e184 commit 41e4e2c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎net/openvswitch/flow.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,12 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
276276

277277
nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags);
278278
if (flags & IP6_FH_F_FRAG) {
279-
if (frag_off)
279+
if (frag_off) {
280280
key->ip.frag = OVS_FRAG_TYPE_LATER;
281-
else
282-
key->ip.frag = OVS_FRAG_TYPE_FIRST;
281+
key->ip.proto = nexthdr;
282+
return 0;
283+
}
284+
key->ip.frag = OVS_FRAG_TYPE_FIRST;
283285
} else {
284286
key->ip.frag = OVS_FRAG_TYPE_NONE;
285287
}

0 commit comments

Comments
 (0)