Skip to contentSkip to conversation

net: ipv4: Set addr_type in hash_keys for forwarded case

PATCH In review David Ahern 4 participants 4 messages Feb 21, 2018 – Feb 22, 2018

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

PATCH 1/1 net: ipv4: Set addr_type in hash_keys for forwarded case

The result of the skb flow dissect is copied from keys to hash_keys to ensure only the intended data is hashed. The original L4 hash patch overlooked setting the addr_type for this case; add it.

Fixes bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice")
---
 net/ipv4/route.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/route.c +2 -0
index 49cc1c1df1ba..a4f44d815a61 100644
@@ -1826,6 +1826,8 @@ int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4,
 				return skb_get_hash_raw(skb) >> 1;
 			memset(&hash_keys, 0, sizeof(hash_keys));
 			skb_flow_dissect_flow_keys(skb, &keys, flag);
+
+			hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
 			hash_keys.addrs.v4addrs.src = keys.addrs.v4addrs.src;
 			hash_keys.addrs.v4addrs.dst = keys.addrs.v4addrs.dst;
 			hash_keys.ports.src = keys.ports.src;
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · David Ahern

The result of the skb flow dissect is copied from keys to hash_keys to ensure only the intended data is hashed. The original L4 hash patch overlooked setting the addr_type for this case; add it.

Fixes bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice")
---
 net/ipv4/route.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/route.c +0 -0
index 49cc1c1df1ba..a4f44d815a61 100644

net/ipv4/route.c int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4, · line 1833

Quoted 8 lines
net/ipv4/route.c +2 -0
@@ -1826,6 +1826,8 @@ int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4,
 				return skb_get_hash_raw(skb) >> 1;
 			memset(&hash_keys, 0, sizeof(hash_keys));
 			skb_flow_dissect_flow_keys(skb, &keys, flag);
+
+			hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
 			hash_keys.addrs.v4addrs.src = keys.addrs.v4addrs.src;
 			hash_keys.addrs.v4addrs.dst = keys.addrs.v4addrs.dst;
 			hash_keys.ports.src = keys.ports.src;

Good catch,

Reviewed-by on v1 1/1
#2 lore raw
In reply to David Ahern
Quoted 7 lines · David Ahern

The result of the skb flow dissect is copied from keys to hash_keys to ensure only the intended data is hashed. The original L4 hash patch overlooked setting the addr_type for this case; add it.

Fixes bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice")

Thanks!

maintainer
#3 lore raw
In reply to David Ahern

From: David Ahern <[email protected]>
Date: Wed, 21 Feb 2018 11:00:54 -0800

Quoted 7 lines

The result of the skb flow dissect is copied from keys to hash_keys to ensure only the intended data is hashed. The original L4 hash patch overlooked setting the addr_type for this case; add it.

Fixes bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice")

Applied and queued up for -stable, thanks David!