Skip to contentSkip to conversation

bonding: Fix extraction of ports from the packet headers

PATCH Applied Moshe Tal 3 participants 3 messages Jan 16, 2022

Subsystems (3)
lore
Share & tools
lore

Moshe Tal

author
#0 lore raw

PATCH v2 1/1 bonding: Fix extraction of ports from the packet headers

Wrong hash sends single stream to multiple output interfaces.

The offset calculation was relative to skb->head, fix it to be relative to skb->data.

Fixes a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with

xdp_buff")

---

Notes:
v2: Change the offset to be relative to skb->data in higher level to handle the case when skb is NULL.

 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +2 -2
index fce80b57f15b..ec498ce70f35 100644
@@ -3874,8 +3874,8 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
 	    skb->l4_hash)
 		return skb->hash;
 
-	return __bond_xmit_hash(bond, skb, skb->head, skb->protocol,
-				skb->mac_header, skb->network_header,
+	return __bond_xmit_hash(bond, skb, skb->data, skb->protocol,
+				skb_mac_offset(skb), skb_network_offset(skb),
 				skb_headlen(skb));
 }
 
Signature · 1 line
2.26.2
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Moshe Tal

Wrong hash sends single stream to multiple output interfaces.

The offset calculation was relative to skb->head, fix it to be relative to skb->data.

Fixes a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with

xdp_buff")

Quoted 27 lines

---

Notes:
v2: Change the offset to be relative to skb->data in higher level to handle the case when skb is NULL.

drivers/net/bonding/bond_main.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +2 -2
index fce80b57f15b..ec498ce70f35 100644
@@ -3874,8 +3874,8 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
 	    skb->l4_hash)
 		return skb->hash;
 
-	return __bond_xmit_hash(bond, skb, skb->head, skb->protocol,
-				skb->mac_header, skb->network_header,
+	return __bond_xmit_hash(bond, skb, skb->data, skb->protocol,
+				skb_mac_offset(skb), skb_network_offset(skb),
 				skb_headlen(skb));
 }
 
Signature · 1 line
2.26.2
#2 lore raw
In reply to Moshe Tal
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 5 lines · On Sun, 16 Jan 2022 19:39:29 +0200 you wrote:

Wrong hash sends single stream to multiple output interfaces.

The offset calculation was relative to skb->head, fix it to be relative to skb->data.

Quoted 8 lines
Fixes a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with

xdp_buff")

[...]

Here is the summary with links:
- [net,v2] bonding: Fix extraction of ports from the packet headers

    https://git.kernel.org/netdev/net/c/429e3d123d9a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html