Skip to content

Commit 0754b4e

Browse files
justinpettitdavem330
authored andcommitted
openvswitch: Clear the L4 portion of the key for "later" fragments.
Only the first fragment in a datagram contains the L4 headers. When the Open vSwitch module parses a packet, it always sets the IP protocol field in the key, but can only set the L4 fields on the first fragment. The original behavior would not clear the L4 portion of the key, so garbage values would be sent in the key for "later" fragments. This patch clears the L4 fields in that circumstance to prevent sending those garbage values as part of the upcall. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ad06a56 commit 0754b4e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎net/openvswitch/flow.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
560560
offset = nh->frag_off & htons(IP_OFFSET);
561561
if (offset) {
562562
key->ip.frag = OVS_FRAG_TYPE_LATER;
563+
memset(&key->tp, 0, sizeof(key->tp));
563564
return 0;
564565
}
565566
if (nh->frag_off & htons(IP_MF) ||
@@ -677,8 +678,10 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
677678
return error;
678679
}
679680

680-
if (key->ip.frag == OVS_FRAG_TYPE_LATER)
681+
if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
682+
memset(&key->tp, 0, sizeof(key->tp));
681683
return 0;
684+
}
682685
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
683686
key->ip.frag = OVS_FRAG_TYPE_FIRST;
684687

0 commit comments

Comments
 (0)