summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py8
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py8
2 files changed, 15 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index 34ea4f8f8..a174e33e4 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -24,7 +24,7 @@ from vyos.ifconfig import BondIf, Section
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
-from vyos.util import call
+from vyos.util import call, cmd
from vyos.validate import is_bridge_member
from vyos import ConfigError
@@ -365,6 +365,12 @@ 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}"')
b.add_port(intf)
# As the bond interface is always disabled first when changing
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index 2f92aae09..9d638653c 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -24,6 +24,7 @@ from vyos.ifconfig import BridgeIf, Section
from vyos.ifconfig.stp import STP
from vyos.configdict import list_diff
from vyos.config import Config
+from vyos.util import cmd
from vyos import ConfigError
default_config_data = {
@@ -346,6 +347,13 @@ def apply(bridge):
# add interfaces to bridge
for member in bridge['member']:
+ # flushes address of only children of Interfaces class
+ # (e.g. vlan are not)
+ if member['name'] in Section.interfaces():
+ klass = Section.klass(member['name'], vlan=False)
+ klass(member['name'], create=False).flush_addrs()
+ # flushes all interfaces
+ cmd(f'ip addr flush dev "{member["name"]}"')
br.add_port(member['name'])
# Change interface MAC address