From: Jay Vosburgh <jv@jvosburgh.net>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Nikolay Aleksandrov <razor@blackwall.org>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
David Wilder <wilder@us.ibm.com>
Subject: Re: [PATCH net] bonding: don't set oif to bond dev when getting NS target destination
Date: Mon, 11 Aug 2025 07:27:19 -0700 [thread overview]
Message-ID: <783435.1754922439@famine> (raw)
In-Reply-To: <20250811140358.2024-1-liuhangbin@gmail.com>
Hangbin Liu <liuhangbin@gmail.com> wrote:
>Unlike IPv4, IPv6 routing strictly requires the source address to be valid
>on the outgoing interface. If the NS target is set to a remote VLAN interface,
>and the source address is also configured on a VLAN over a bond interface,
>setting the oif to the bond device will fail to retrieve the correct
>destination route.
>
>Fix this by not setting the oif to the bond device when retrieving the NS
>target destination. This allows the correct destination device (the VLAN
>interface) to be determined, so that bond_verify_device_path can return the
>proper VLAN tags for sending NS messages.
>
>Reported-by: David Wilder <wilder@us.ibm.com>
>Closes: https://lore.kernel.org/netdev/aGOKggdfjv0cApTO@fedora/
>Suggested-by: Jay Vosburgh <jv@jvosburgh.net>
>Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
Does the test update part of this patch apply all the way back
to the oldest longterm kernel after 4e24be018eb9? I think that's 6.1
right now.
Generically, I'm wondering if test updates should be separate
patches from the functional changes as a general policy.
-J
>Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>---
> drivers/net/bonding/bond_main.c | 1 -
> .../drivers/net/bonding/bond_options.sh | 59 +++++++++++++++++++
> 2 files changed, 59 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 257333c88710..30cf97f4e814 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -3355,7 +3355,6 @@ static void bond_ns_send_all(struct bonding *bond, struct slave *slave)
> /* Find out through which dev should the packet go */
> memset(&fl6, 0, sizeof(struct flowi6));
> fl6.daddr = targets[i];
>- fl6.flowi6_oif = bond->dev->ifindex;
>
> dst = ip6_route_output(dev_net(bond->dev), NULL, &fl6);
> if (dst->error) {
>diff --git a/tools/testing/selftests/drivers/net/bonding/bond_options.sh b/tools/testing/selftests/drivers/net/bonding/bond_options.sh
>index 7bc148889ca7..b3eb8a919c71 100755
>--- a/tools/testing/selftests/drivers/net/bonding/bond_options.sh
>+++ b/tools/testing/selftests/drivers/net/bonding/bond_options.sh
>@@ -7,6 +7,7 @@ ALL_TESTS="
> prio
> arp_validate
> num_grat_arp
>+ vlan_over_bond
> "
>
> lib_dir=$(dirname "$0")
>@@ -376,6 +377,64 @@ num_grat_arp()
> done
> }
>
>+vlan_over_bond_arp()
>+{
>+ local mode="$1"
>+ RET=0
>+
>+ bond_reset "mode $mode arp_interval 100 arp_ip_target 192.0.3.10"
>+ ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3
>+ ip -n "${s_ns}" link set bond0.3 up
>+ ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3
>+ ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3
>+
>+ slowwait_for_counter 5 5 tc_rule_handle_stats_get \
>+ "dev eth0.3 ingress" 101 ".packets" "-n ${c_ns}" || RET=1
>+ log_test "vlan over bond arp" "$mode"
>+}
>+
>+vlan_over_bond_ns()
>+{
>+ local mode="$1"
>+ RET=0
>+
>+ if skip_ns; then
>+ log_test_skip "vlan_over_bond ns" "$mode"
>+ return 0
>+ fi
>+
>+ bond_reset "mode $mode arp_interval 100 ns_ip6_target 2001:db8::3:10"
>+ ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3
>+ ip -n "${s_ns}" link set bond0.3 up
>+ ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3
>+ ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3
>+
>+ slowwait_for_counter 5 5 tc_rule_handle_stats_get \
>+ "dev eth0.3 ingress" 102 ".packets" "-n ${c_ns}" || RET=1
>+ log_test "vlan over bond ns" "$mode"
>+}
>+
>+vlan_over_bond()
>+{
>+ # add vlan 3 for client
>+ ip -n "${c_ns}" link add eth0.3 link eth0 type vlan id 3
>+ ip -n "${c_ns}" link set eth0.3 up
>+ ip -n "${c_ns}" addr add 192.0.3.10/24 dev eth0.3
>+ ip -n "${c_ns}" addr add 2001:db8::3:10/64 dev eth0.3
>+
>+ # Add tc rule to check the vlan pkts
>+ tc -n "${c_ns}" qdisc add dev eth0.3 clsact
>+ tc -n "${c_ns}" filter add dev eth0.3 ingress protocol arp \
>+ handle 101 flower skip_hw arp_op request \
>+ arp_sip 192.0.3.1 arp_tip 192.0.3.10 action pass
>+ tc -n "${c_ns}" filter add dev eth0.3 ingress protocol ipv6 \
>+ handle 102 flower skip_hw ip_proto icmpv6 \
>+ type 135 src_ip 2001:db8::3:1 action pass
>+
>+ vlan_over_bond_arp "active-backup"
>+ vlan_over_bond_ns "active-backup"
>+}
>+
> trap cleanup EXIT
>
> setup_prepare
>--
>2.50.1
>
---
-Jay Vosburgh, jv@jvosburgh.net
next prev parent reply other threads:[~2025-08-11 14:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 14:03 [PATCH net] bonding: don't set oif to bond dev when getting NS target destination Hangbin Liu
2025-08-11 14:27 ` Jay Vosburgh [this message]
2025-08-11 16:33 ` Jakub Kicinski
2025-08-12 1:53 ` Hangbin Liu
2025-08-12 2:04 ` Hangbin Liu
2025-08-12 3:15 ` Jakub Kicinski
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=783435.1754922439@famine \
--to=jv@jvosburgh.net \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=shuah@kernel.org \
--cc=wilder@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).