Commit 9ee1e512 authored by Alexander Duyck's avatar Alexander Duyck Committed by Kleber Sacilotto de Souza

flow_dissector: Check for IP fragmentation even if not using IPv4 address

BugLink: https://bugs.launchpad.net/bugs/1878232

commit 918c023f upstream.

This patch corrects the logic for the IPv4 parsing so that it is consistent
with how we handle IPv6.  Specifically if we do not have the flow key
indicating we want the addresses we still may need to take a look at the IP
fragmentation bits and to see if we should stop after we have recognized
the L3 header.

Fixes: 807e165d ("flow_dissector: Add control/reporting of fragmentation")
Signed-off-by: default avatarAlexander Duyck <aduyck@mirantis.com>
Acked-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 9e20c87f
...@@ -178,15 +178,16 @@ bool __skb_flow_dissect(const struct sk_buff *skb, ...@@ -178,15 +178,16 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
ip_proto = iph->protocol; ip_proto = iph->protocol;
if (!dissector_uses_key(flow_dissector, if (dissector_uses_key(flow_dissector,
FLOW_DISSECTOR_KEY_IPV4_ADDRS)) FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
break;
key_addrs = skb_flow_dissector_target(flow_dissector, key_addrs = skb_flow_dissector_target(flow_dissector,
FLOW_DISSECTOR_KEY_IPV4_ADDRS, target_container); FLOW_DISSECTOR_KEY_IPV4_ADDRS,
target_container);
memcpy(&key_addrs->v4addrs, &iph->saddr, memcpy(&key_addrs->v4addrs, &iph->saddr,
sizeof(key_addrs->v4addrs)); sizeof(key_addrs->v4addrs));
key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
}
if (ip_is_fragment(iph)) { if (ip_is_fragment(iph)) {
key_control->flags |= FLOW_DIS_IS_FRAGMENT; key_control->flags |= FLOW_DIS_IS_FRAGMENT;
......
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