public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Moshe Tal <moshet@nvidia•com>
To: Jay Vosburgh <j.vosburgh@gmail•com>,
	Veaceslav Falico <vfalico@gmail•com>,
	Andy Gospodarek <andy@greyhouse•net>,
	"David S . Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>
Cc: <netdev@vger•kernel.org>, Jussi Maki <joamaki@gmail•com>,
	Daniel Borkmann <daniel@iogearbox•net>,
	Tariq Toukan <tariqt@nvidia•com>, Moshe Tal <moshet@nvidia•com>,
	Saeed Mahameed <saeedm@nvidia•com>, Gal Pressman <gal@nvidia•com>
Subject: [PATCH RESEND net] bonding: Fix extraction of ports from the packet headers
Date: Mon, 10 Jan 2022 10:15:37 +0200	[thread overview]
Message-ID: <20220110081537.82477-1-moshet@nvidia.com> (raw)

Wrong hash sends single stream to multiple output interfaces.

The nhoff parameter is relative to skb->head, so convert it to be
relative to skb->data for using in skb_flow_get_ports().

Fixes: a815bde56b15 ("net, bonding: Refactor bond_xmit_hash for use with xdp_buff")
Reviewed-by: Saeed Mahameed <saeedm@nvidia•com>
Reviewed-by: Gal Pressman <gal@nvidia•com>
Signed-off-by: Moshe Tal <moshet@nvidia•com>
---
 drivers/net/bonding/bond_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07fc603c2fa7..3189bd14c664 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3745,7 +3745,8 @@ static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk, const void *
 	}
 
 	if (l34 && *ip_proto >= 0)
-		fk->ports.ports = __skb_flow_get_ports(skb, *nhoff, *ip_proto, data, hlen);
+		/* nhoff is relative to skb->head instead of the usual skb->data */
+		fk->ports.ports = skb_flow_get_ports(skb, *nhoff - skb_headroom(skb), *ip_proto);
 
 	return true;
 }
-- 
2.26.2


             reply	other threads:[~2022-01-10  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  8:15 Moshe Tal [this message]
2022-01-11 13:23 ` [PATCH RESEND net] bonding: Fix extraction of ports from the packet headers Jussi Maki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110081537.82477-1-moshet@nvidia.com \
    --to=moshet@nvidia$(echo .)com \
    --cc=andy@greyhouse$(echo .)net \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=gal@nvidia$(echo .)com \
    --cc=j.vosburgh@gmail$(echo .)com \
    --cc=joamaki@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=saeedm@nvidia$(echo .)com \
    --cc=tariqt@nvidia$(echo .)com \
    --cc=vfalico@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox