losing addresses if reusing interface names too fast
From: Jan Dvořák <hidden>
Date: 2012-11-16 14:11:14
Hello, I have noticed a surprising behavior when removing virtual interfaces. For example, removing a bridge with configured IP addresses and then quickly creating another interface with identical name will cause the addresses to be removed from the new interface a second or so later. To demonstrate the issue: brctl addbr foobar ip addr add 10.20.30.40/24 dev foobar ip addr show dev foobar # 40: foobar: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN # link/ether 12:12:f5:1b:c6:8e brd ff:ff:ff:ff:ff:ff # inet 10.20.30.40/24 scope global foobar sleep 1 ip link set down dev foobar brctl delbr foobar ip link add name foobar link em1 type vlan id 42 ip addr add 10.20.30.40/24 dev foobar ip addr show dev foobar # 41: foobar@em1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN # link/ether 00:21:cc:63:ec:3c brd ff:ff:ff:ff:ff:ff # inet 10.20.30.40/24 scope global foobar sleep 3 ip addr show dev foobar # 41: foobar@em1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN # link/ether 00:21:cc:63:ec:3c brd ff:ff:ff:ff:ff:ff ip link del foobar type vlan If you monitor udev during course of this script, you will get following sequence, spaces where sleeps were: KERNEL[457506.286789] add /devices/virtual/net/foobar (net) KERNEL[457507.298630] remove /devices/virtual/net/foobar (net) KERNEL[457507.309597] add /devices/virtual/net/foobar (net) KERNEL[457510.324433] remove /devices/virtual/net/foobar (net) This means that I can't event wait for the bridge to get completely removed, kernel tells me it's gone as soon as I delete it. Could you please advise a workaround or confirm this as a bug? Best regards, Jan Dvorak