Skip to contentSkip to conversation

openvswitch: Fix IPv6 later frags parsing

PATCH Applied Yi-Hung Wei 2 participants 2 messages Jan 3, 2019 – Jan 4, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Fixes fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later frags")
---
 net/openvswitch/flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/openvswitch/flow.c +5 -3
index 57e07768c9d1..f54cf17ef7a8 100644
@@ -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;
 	}
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

From: Yi-Hung Wei <[email protected]>
Date: Thu, 3 Jan 2019 09:51:57 -0800

Quoted 8 lines

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.

Quoted 7 lines

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

Fixes fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later frags")

Applied.