forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'net-unsync-addresses-from-ports'
From: Benjamin Poirier <[email protected]> To: [email protected] Cc: Jay Vosburgh <[email protected]>, Veaceslav Falico <[email protected]>, Andy Gospodarek <[email protected]>, "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>, Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>, Jiri Pirko <[email protected]>, Shuah Khan <[email protected]>, Jonathan Toppins <[email protected]>, [email protected] Subject: [PATCH net v3 0/4] Unsync addresses from ports when stopping aggregated devices Date: Wed, 7 Sep 2022 16:56:38 +0900 [thread overview] Message-ID: <[email protected]> (raw) This series fixes similar problems in the bonding and team drivers. Because of missing dev_{uc,mc}_unsync() calls, addresses added to underlying devices may be leftover after the aggregated device is deleted. Add the missing calls and a few related tests. v2: * fix selftest installation, see patch 3 v3: * Split lacpdu_multicast changes to their own patch, #1 * In ndo_{add,del}_slave methods, only perform address list changes when the aggregated device is up (patches 2 & 3) * Add selftest function related to the above change (patch 4) ==================== Acked-by: Jay Vosburgh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Showing
14 changed files
with
297 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19948,6 +19948,7 @@ S: Supported | |
F: drivers/net/team/ | ||
F: include/linux/if_team.h | ||
F: include/uapi/linux/if_team.h | ||
F: tools/testing/selftests/net/team/ | ||
|
||
TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT | ||
M: "Savoir-faire Linux Inc." <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Makefile for net selftests | ||
|
||
TEST_PROGS := bond-break-lacpdu-tx.sh | ||
TEST_PROGS := bond-break-lacpdu-tx.sh \ | ||
dev_addr_lists.sh | ||
|
||
TEST_FILES := lag_lib.sh | ||
|
||
include ../../../lib.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
CONFIG_BONDING=y | ||
CONFIG_MACVLAN=y |
109 changes: 109 additions & 0 deletions
109
tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Test bond device handling of addr lists (dev->uc, mc) | ||
# | ||
|
||
ALL_TESTS=" | ||
bond_cleanup_mode1 | ||
bond_cleanup_mode4 | ||
bond_listen_lacpdu_multicast_case_down | ||
bond_listen_lacpdu_multicast_case_up | ||
" | ||
|
||
REQUIRE_MZ=no | ||
NUM_NETIFS=0 | ||
lib_dir=$(dirname "$0") | ||
source "$lib_dir"/../../../net/forwarding/lib.sh | ||
|
||
source "$lib_dir"/lag_lib.sh | ||
|
||
|
||
destroy() | ||
{ | ||
local ifnames=(dummy1 dummy2 bond1 mv0) | ||
local ifname | ||
|
||
for ifname in "${ifnames[@]}"; do | ||
ip link del "$ifname" &>/dev/null | ||
done | ||
} | ||
|
||
cleanup() | ||
{ | ||
pre_cleanup | ||
|
||
destroy | ||
} | ||
|
||
|
||
# bond driver control paths vary between modes that have a primary slave | ||
# (bond_uses_primary()) and others. Test both kinds of modes. | ||
|
||
bond_cleanup_mode1() | ||
{ | ||
RET=0 | ||
|
||
test_LAG_cleanup "bonding" "active-backup" | ||
} | ||
|
||
bond_cleanup_mode4() { | ||
RET=0 | ||
|
||
test_LAG_cleanup "bonding" "802.3ad" | ||
} | ||
|
||
bond_listen_lacpdu_multicast() | ||
{ | ||
# Initial state of bond device, up | down | ||
local init_state=$1 | ||
local lacpdu_mc="01:80:c2:00:00:02" | ||
|
||
ip link add dummy1 type dummy | ||
ip link add bond1 "$init_state" type bond mode 802.3ad | ||
ip link set dev dummy1 master bond1 | ||
if [ "$init_state" = "down" ]; then | ||
ip link set dev bond1 up | ||
fi | ||
|
||
grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null | ||
check_err $? "LACPDU multicast address not present on slave (1)" | ||
|
||
ip link set dev bond1 down | ||
|
||
not grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null | ||
check_err $? "LACPDU multicast address still present on slave" | ||
|
||
ip link set dev bond1 up | ||
|
||
grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null | ||
check_err $? "LACPDU multicast address not present on slave (2)" | ||
|
||
cleanup | ||
|
||
log_test "bonding LACPDU multicast address to slave (from bond $init_state)" | ||
} | ||
|
||
# The LACPDU mc addr is added by different paths depending on the initial state | ||
# of the bond when enslaving a device. Test both cases. | ||
|
||
bond_listen_lacpdu_multicast_case_down() | ||
{ | ||
RET=0 | ||
|
||
bond_listen_lacpdu_multicast "down" | ||
} | ||
|
||
bond_listen_lacpdu_multicast_case_up() | ||
{ | ||
RET=0 | ||
|
||
bond_listen_lacpdu_multicast "up" | ||
} | ||
|
||
|
||
trap cleanup EXIT | ||
|
||
tests_run | ||
|
||
exit "$EXIT_STATUS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# Test that a link aggregation device (bonding, team) removes the hardware | ||
# addresses that it adds on its underlying devices. | ||
test_LAG_cleanup() | ||
{ | ||
local driver=$1 | ||
local mode=$2 | ||
local ucaddr="02:00:00:12:34:56" | ||
local addr6="fe80::78:9abc/64" | ||
local mcaddr="33:33:ff:78:9a:bc" | ||
local name | ||
|
||
ip link add dummy1 type dummy | ||
ip link add dummy2 type dummy | ||
if [ "$driver" = "bonding" ]; then | ||
name="bond1" | ||
ip link add "$name" up type bond mode "$mode" | ||
ip link set dev dummy1 master "$name" | ||
ip link set dev dummy2 master "$name" | ||
elif [ "$driver" = "team" ]; then | ||
name="team0" | ||
teamd -d -c ' | ||
{ | ||
"device": "'"$name"'", | ||
"runner": { | ||
"name": "'"$mode"'" | ||
}, | ||
"ports": { | ||
"dummy1": | ||
{}, | ||
"dummy2": | ||
{} | ||
} | ||
} | ||
' | ||
ip link set dev "$name" up | ||
else | ||
check_err 1 | ||
log_test test_LAG_cleanup ": unknown driver \"$driver\"" | ||
return | ||
fi | ||
|
||
# Used to test dev->uc handling | ||
ip link add mv0 link "$name" up address "$ucaddr" type macvlan | ||
# Used to test dev->mc handling | ||
ip address add "$addr6" dev "$name" | ||
ip link set dev "$name" down | ||
ip link del "$name" | ||
|
||
not grep_bridge_fdb "$ucaddr" bridge fdb show >/dev/null | ||
check_err $? "macvlan unicast address still present on a slave" | ||
|
||
not grep_bridge_fdb "$mcaddr" bridge fdb show >/dev/null | ||
check_err $? "IPv6 solicited-node multicast mac address still present on a slave" | ||
|
||
cleanup | ||
|
||
log_test "$driver cleanup mode $mode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Makefile for net selftests | ||
|
||
TEST_PROGS := dev_addr_lists.sh | ||
|
||
include ../../../lib.mk |
Oops, something went wrong.