mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: addressvirtual: flush macvlan addr cache when setting addrgenmode
When setting addrgenmode it is necessary to flap the macvlan device. After flapping the device we also need to re-add all the user configuration. The best way to add the user config is to flush our internal address cache. [10:12:10] root:~ # ifquery vlan1000 auto vlan1000 iface vlan1000 address 192.168.10.1/24 address fc00:10::1/64 address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64 vlan-id 1000 vlan-raw-device bridge [10:12:15] root:~ # ifup -a [10:12:24] root:~ # echo $? 0 [10:12:26] root:~ # ifquery vlan1000 -c auto vlan1000 iface vlan1000 [pass] vlan-raw-device bridge [pass] vlan-id 1000 [pass] address 192.168.10.1/24 [pass] address fc00:10::1/64 [pass] address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64 [pass] [10:12:30] root:~ # ip -6 -o addr show vlan1000-v0 48: vlan1000-v0 inet6 fc00:10::1/64 scope global \ valid_lft forever preferred_lft forever 48: vlan1000-v0 inet6 fe80::200:5eff:fe00:101/64 scope link \ valid_lft forever preferred_lft forever 48: vlan1000-v0 inet6 fe80::1/64 scope link \ valid_lft forever preferred_lft forever [10:12:33] root:~ # [10:12:34] root:~ # [10:12:34] root:~ # ifquery vlan1000 auto vlan1000 iface vlan1000 address 192.168.10.1/24 address fc00:10::1/64 address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64 address-virtual-ipv6-addrgen off vlan-id 1000 vlan-raw-device bridge [10:12:39] root:~ # [10:12:41] root:~ # ifreload -a -d ... debug: vlan1000: up : running module addressvirtual debug: vlan1000-v0: reset address cache <<<<<<<<<<<<<<<<<<<<<< without this reset ifupdown2 would be in a broken state info: vlan1000: checking route entry ... info: executing /bin/ip route get 192.168.10.0/24 info: netlink: ip link show dev vlan1000 info: netlink: ip link show dev vlan1000-v0 info: vlan1000-v0: netlink: ip link set dev vlan1000-v0 up info: executing /bin/ip -force -batch - [link set dev vlan1000-v0 down link set dev vlan1000-v0 addrgenmode none link set dev vlan1000-v0 up addr add 192.168.10.1/24 dev vlan1000-v0 addr add fc00:10::1/64 dev vlan1000-v0 addr add fe80::1/64 dev vlan1000-v0 ] ... [10:12:50] root:~ # [10:12:51] root:~ # ip -6 -o addr show vlan1000-v0 48: vlan1000-v0 inet6 fc00:10::1/64 scope global \ valid_lft forever preferred_lft forever 48: vlan1000-v0 inet6 fe80::1/64 scope link \ valid_lft forever preferred_lft forever [10:12:53] root:~ # ifquery vlan1000 -c auto vlan1000 iface vlan1000 [pass] vlan-raw-device bridge [pass] vlan-id 1000 [pass] address 192.168.10.1/24 [pass] address fc00:10::1/64 [pass] address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64 [pass] [10:13:03] root:~ # echo $? 0 [10:13:04] root:~ # Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -243,6 +243,13 @@ class addressvirtual(moduleBase):
|
||||
except:
|
||||
self.ipcmd.link_add_macvlan(ifaceobj.name, macvlan_ifacename)
|
||||
link_created = True
|
||||
else:
|
||||
if should_configure_ipv6_addrgen:
|
||||
# When setting addrgenmode it is necessary to flap the macvlan
|
||||
# device. After flapping the device we also need to re-add all
|
||||
# the user configuration. The best way to add the user config
|
||||
# is to flush our internal address cache
|
||||
self.ipcmd.reset_addr_cache(macvlan_ifacename)
|
||||
|
||||
# first thing we need to handle vrf enslavement
|
||||
if (ifaceobj.link_privflags & ifaceLinkPrivFlags.VRF_SLAVE):
|
||||
|
Reference in New Issue
Block a user