* [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination
@ 2025-09-08 6:28 Hangbin Liu
2025-09-08 6:28 ` [PATCHv2 2/2] selftests: bonding: add vlan over bond testing Hangbin Liu
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Hangbin Liu @ 2025-09-08 6:28 UTC (permalink / raw)
To: netdev
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
linux-kselftest, Hangbin Liu, David Wilder
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")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v2: split the patch into 2 parts, the kernel change and test update (Jay Vosburgh)
---
drivers/net/bonding/bond_main.c | 1 -
1 file changed, 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) {
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 2/2] selftests: bonding: add vlan over bond testing
2025-09-08 6:28 [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination Hangbin Liu
@ 2025-09-08 6:28 ` Hangbin Liu
2025-09-09 23:46 ` Jakub Kicinski
2025-09-08 15:55 ` [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination David Wilder
2025-09-08 22:51 ` Jay Vosburgh
2 siblings, 1 reply; 7+ messages in thread
From: Hangbin Liu @ 2025-09-08 6:28 UTC (permalink / raw)
To: netdev
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
linux-kselftest, Hangbin Liu
Add a vlan over bond testing to make sure arp/ns target works.
Also change all the configs to mudules.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v2: split the patch into 2 parts, the kernel change and test update (Jay Vosburgh)
---
.../drivers/net/bonding/bond_options.sh | 59 +++++++++++++++++++
.../selftests/drivers/net/bonding/config | 21 +++----
2 files changed, 70 insertions(+), 10 deletions(-)
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
diff --git a/tools/testing/selftests/drivers/net/bonding/config b/tools/testing/selftests/drivers/net/bonding/config
index 4d16a69ffc65..cbd8b2769475 100644
--- a/tools/testing/selftests/drivers/net/bonding/config
+++ b/tools/testing/selftests/drivers/net/bonding/config
@@ -1,12 +1,13 @@
-CONFIG_BONDING=y
-CONFIG_BRIDGE=y
-CONFIG_DUMMY=y
+CONFIG_BONDING=m
+CONFIG_BRIDGE=m
+CONFIG_DUMMY=m
CONFIG_IPV6=y
-CONFIG_MACVLAN=y
-CONFIG_IPVLAN=y
-CONFIG_NET_ACT_GACT=y
-CONFIG_NET_CLS_FLOWER=y
+CONFIG_MACVLAN=m
+CONFIG_IPVLAN=m
+CONFIG_NET_ACT_GACT=m
+CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_MATCHALL=m
-CONFIG_NET_SCH_INGRESS=y
-CONFIG_NLMON=y
-CONFIG_VETH=y
+CONFIG_NET_SCH_INGRESS=m
+CONFIG_NLMON=m
+CONFIG_VETH=m
+CONFIG_VLAN_8021Q=m
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination
2025-09-08 6:28 [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination Hangbin Liu
2025-09-08 6:28 ` [PATCHv2 2/2] selftests: bonding: add vlan over bond testing Hangbin Liu
@ 2025-09-08 15:55 ` David Wilder
2025-09-08 22:51 ` Jay Vosburgh
2 siblings, 0 replies; 7+ messages in thread
From: David Wilder @ 2025-09-08 15:55 UTC (permalink / raw)
To: Hangbin Liu, netdev@vger.kernel.org
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
linux-kselftest@vger.kernel.org
________________________________________
From: Hangbin Liu <liuhangbin@gmail.com>
Sent: Sunday, September 7, 2025 11:28 PM
To: netdev@vger.kernel.org
Cc: Jay Vosburgh; Andrew Lunn; David S. Miller; Eric Dumazet; Jakub Kicinski; Paolo Abeni; Simon Horman; Shuah Khan; linux-kselftest@vger.kernel.org; Hangbin Liu; David Wilder
Subject: [EXTERNAL] [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination
> 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")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>
> v2: split the patch into 2 parts, the kernel change and test update (Jay Vosburgh)
>
> ---
> drivers/net/bonding/bond_main.c | 1 -
> 1 file changed, 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) {
> --
> 2.50.1
I verified this solves the issue with a single level of vlan tags.
Thanks for fixing this.
Tested-by: David Wilder <wilder@us.ibm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination
2025-09-08 6:28 [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination Hangbin Liu
2025-09-08 6:28 ` [PATCHv2 2/2] selftests: bonding: add vlan over bond testing Hangbin Liu
2025-09-08 15:55 ` [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination David Wilder
@ 2025-09-08 22:51 ` Jay Vosburgh
2 siblings, 0 replies; 7+ messages in thread
From: Jay Vosburgh @ 2025-09-08 22:51 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
linux-kselftest, David Wilder
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")
>Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
>---
>
>v2: split the patch into 2 parts, the kernel change and test update (Jay Vosburgh)
>
>---
> drivers/net/bonding/bond_main.c | 1 -
> 1 file changed, 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) {
>--
>2.50.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 2/2] selftests: bonding: add vlan over bond testing
2025-09-08 6:28 ` [PATCHv2 2/2] selftests: bonding: add vlan over bond testing Hangbin Liu
@ 2025-09-09 23:46 ` Jakub Kicinski
2025-09-10 2:03 ` Hangbin Liu
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-09-09 23:46 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, linux-kselftest
On Mon, 8 Sep 2025 06:28:02 +0000 Hangbin Liu wrote:
> Add a vlan over bond testing to make sure arp/ns target works.
> Also change all the configs to mudules.
Why are you switching everything to module?
The series needs to go to net, we should avoid unnecessary cleanups.
And I think changing the config is unrelated to the selftest so it
should be a standalone patch in the first place?
--
pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 2/2] selftests: bonding: add vlan over bond testing
2025-09-09 23:46 ` Jakub Kicinski
@ 2025-09-10 2:03 ` Hangbin Liu
2025-09-10 2:26 ` Jakub Kicinski
0 siblings, 1 reply; 7+ messages in thread
From: Hangbin Liu @ 2025-09-10 2:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, linux-kselftest
On Tue, Sep 09, 2025 at 04:46:00PM -0700, Jakub Kicinski wrote:
> On Mon, 8 Sep 2025 06:28:02 +0000 Hangbin Liu wrote:
> > Add a vlan over bond testing to make sure arp/ns target works.
> > Also change all the configs to mudules.
>
> Why are you switching everything to module?
> The series needs to go to net, we should avoid unnecessary cleanups.
> And I think changing the config is unrelated to the selftest so it
> should be a standalone patch in the first place?
On my local testing, there will be a lot default interfaces if all modules
build in. This could make the test environment more clean.
But it's just my preference. As you said, we can do it with a stand alone
patch. I will re-post and drop the config update.
Thanks
hangbin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 2/2] selftests: bonding: add vlan over bond testing
2025-09-10 2:03 ` Hangbin Liu
@ 2025-09-10 2:26 ` Jakub Kicinski
0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2025-09-10 2:26 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev, Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, linux-kselftest
On Wed, 10 Sep 2025 02:03:52 +0000 Hangbin Liu wrote:
> On Tue, Sep 09, 2025 at 04:46:00PM -0700, Jakub Kicinski wrote:
> > On Mon, 8 Sep 2025 06:28:02 +0000 Hangbin Liu wrote:
> > > Add a vlan over bond testing to make sure arp/ns target works.
> > > Also change all the configs to mudules.
> >
> > Why are you switching everything to module?
> > The series needs to go to net, we should avoid unnecessary cleanups.
> > And I think changing the config is unrelated to the selftest so it
> > should be a standalone patch in the first place?
>
> On my local testing, there will be a lot default interfaces if all modules
> build in. This could make the test environment more clean.
> But it's just my preference.
No strong opinion on my side. Your point is fair. On the other hand
sometimes dealing with modules is tricky (especially with vng when
building kernel with O=build/). But not sure how much we should care
about shortcomings of tooling which can be fixed. It's okay for our CI.
> As you said, we can do it with a stand alone
> patch. I will re-post and drop the config update.
Yup! For net we should avoid it.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-10 2:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 6:28 [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination Hangbin Liu
2025-09-08 6:28 ` [PATCHv2 2/2] selftests: bonding: add vlan over bond testing Hangbin Liu
2025-09-09 23:46 ` Jakub Kicinski
2025-09-10 2:03 ` Hangbin Liu
2025-09-10 2:26 ` Jakub Kicinski
2025-09-08 15:55 ` [PATCHv2 1/2] bonding: don't set oif to bond dev when getting NS target destination David Wilder
2025-09-08 22:51 ` Jay Vosburgh
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).