On Tue, Oct 07, 2025 at 11:47:22AM +0200, Paolo Abeni wrote:
On 10/3/25 1:57 PM, Breno Leitao wrote:
+# Clean up netdevsim ifaces created for bonding test +function cleanup_bond_nsim() {
- echo "$NSIM_BOND_TX_1" > "$NSIM_DEV_SYS_DEL"
- echo "$NSIM_BOND_TX_2" > "$NSIM_DEV_SYS_DEL"
- echo "$NSIM_BOND_RX_1" > "$NSIM_DEV_SYS_DEL"
- echo "$NSIM_BOND_RX_2" > "$NSIM_DEV_SYS_DEL"
- cleanup_all_ns
If all devices are created in child netns, you will not need explicit per device cleanup.
Humm, that is what I was expecting as well, but, when I tried it, I found that the interfaces got re-pareted by the main network namespace when the namespace is deleted.
For instance, in the following example, eth1 belongs to namespace `ns1`, and when I delete it, it then moves to the main network namespace:
# ip link
# ip -n ns1 link 3: eth1: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000 link/ether d2:3d:b3:3b:59:37 brd ff:ff:ff:ff:ff:ff altname eni1np1
# ip netns delete ns1
# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 3: eth1: <BROADCAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether d2:3d:b3:3b:59:37 brd ff:ff:ff:ff:ff:ff altname eni1np1