netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] bonding: Fix extraction of ports from the packet headers
@ 2022-01-16 17:39 Moshe Tal
  2022-01-16 20:23 ` Jay Vosburgh
  2022-01-16 23:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Moshe Tal @ 2022-01-16 17:39 UTC (permalink / raw)
  To: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek, David S . Miller,
	Jakub Kicinski
  Cc: netdev, Jussi Maki, Daniel Borkmann, Tariq Toukan, Moshe Tal,
	Saeed Mahameed, Gal Pressman

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")
Reviewed-by: Jussi Maki <joamaki@gmail.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Moshe Tal <moshet@nvidia.com>
---

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(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index fce80b57f15b..ec498ce70f35 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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));
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] bonding: Fix extraction of ports from the packet headers
  2022-01-16 17:39 [PATCH net v2] bonding: Fix extraction of ports from the packet headers Moshe Tal
@ 2022-01-16 20:23 ` Jay Vosburgh
  2022-01-16 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jay Vosburgh @ 2022-01-16 20:23 UTC (permalink / raw)
  To: Moshe Tal
  Cc: Veaceslav Falico, Andy Gospodarek, David S . Miller,
	Jakub Kicinski, netdev, Jussi Maki, Daniel Borkmann, Tariq Toukan,
	Saeed Mahameed, Gal Pressman

Moshe Tal <moshet@nvidia.com> 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.
>
>Fixes: a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with
>xdp_buff")
>Reviewed-by: Jussi Maki <joamaki@gmail.com>
>Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
>Reviewed-by: Gal Pressman <gal@nvidia.com>
>Signed-off-by: Moshe Tal <moshet@nvidia.com>

Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>

>---
>
>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(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index fce80b57f15b..ec498ce70f35 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -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));
> }
> 
>-- 
>2.26.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] bonding: Fix extraction of ports from the packet headers
  2022-01-16 17:39 [PATCH net v2] bonding: Fix extraction of ports from the packet headers Moshe Tal
  2022-01-16 20:23 ` Jay Vosburgh
@ 2022-01-16 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-16 23:40 UTC (permalink / raw)
  To: Moshe Tal
  Cc: j.vosburgh, vfalico, andy, davem, kuba, netdev, joamaki, daniel,
	tariqt, saeedm, gal

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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.
> 
> Fixes: a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with
> xdp_buff")
> Reviewed-by: Jussi Maki <joamaki@gmail.com>
> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
> Reviewed-by: Gal Pressman <gal@nvidia.com>
> Signed-off-by: Moshe Tal <moshet@nvidia.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-16 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-16 17:39 [PATCH net v2] bonding: Fix extraction of ports from the packet headers Moshe Tal
2022-01-16 20:23 ` Jay Vosburgh
2022-01-16 23:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).