Commit 0754b4e8 authored by Justin Pettit's avatar Justin Pettit Committed by David S. Miller

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: default avatarJustin Pettit <jpettit@ovn.org>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad06a566
...@@ -560,6 +560,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key) ...@@ -560,6 +560,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
offset = nh->frag_off & htons(IP_OFFSET); offset = nh->frag_off & htons(IP_OFFSET);
if (offset) { if (offset) {
key->ip.frag = OVS_FRAG_TYPE_LATER; key->ip.frag = OVS_FRAG_TYPE_LATER;
memset(&key->tp, 0, sizeof(key->tp));
return 0; return 0;
} }
if (nh->frag_off & htons(IP_MF) || 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) ...@@ -677,8 +678,10 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
return error; return error;
} }
if (key->ip.frag == OVS_FRAG_TYPE_LATER) if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
memset(&key->tp, 0, sizeof(key->tp));
return 0; return 0;
}
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
key->ip.frag = OVS_FRAG_TYPE_FIRST; key->ip.frag = OVS_FRAG_TYPE_FIRST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment