summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-05-02 15:11:48 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-05-04 22:59:40 +0200
commitb38326721ce6448a865100a7da200a291388c029 (patch)
treeceb7b024d739b3a15fd743955e05e2bb254eb522
parent6c8c129c78d084dd3e3b4dfeb7e7aa1b386370b8 (diff)
downloadvyos-1x-b38326721ce6448a865100a7da200a291388c029.tar.gz
vyos-1x-b38326721ce6448a865100a7da200a291388c029.zip
bonding: T2367: use simple 'ip addr flush' to flush member addresses
We've already verified that all member interfaces don't have any addresses configured, so it should be safe to simply call 'ip addr flush' on them to flush the remaining addresses (e.g. IPv6 link-local)
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index a8900ac76..82b7c0f2a 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -20,7 +20,7 @@ from copy import deepcopy
from sys import exit
from netifaces import interfaces
-from vyos.ifconfig import BondIf, Section
+from vyos.ifconfig import BondIf
from vyos.ifconfig_vlan import apply_vlan_config, verify_vlan_config
from vyos.configdict import list_diff, intf_to_dict, add_to_dict
from vyos.config import Config
@@ -381,12 +381,9 @@ def apply(bond):
# Add (enslave) interfaces to bond
for intf in bond['member']:
- # flushes only children of Interfaces class (e.g. vlan are not)
- if intf in Section.interfaces():
- klass = Section.klass(intf, vlan=False)
- klass(intf, create=False).flush_addrs()
- # flushes also vlan interfaces
- call(f'ip addr flush dev "{intf}"')
+ # if we've come here we already verified the interface doesn't
+ # have addresses configured so just flush any remaining ones
+ cmd(f'ip addr flush dev "{intf}"')
b.add_port(intf)
# As the bond interface is always disabled first when changing