summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bonding.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-02 21:34:59 +0200
committerGitHub <noreply@github.com>2020-05-02 21:34:59 +0200
commit3501313affa62b88fa530c4518a08269ea6f61c0 (patch)
tree8a5cbbe418c82de4cbf4e5849a6ce4c58e1d599d /src/conf_mode/interfaces-bonding.py
parentb47e7ebab5b9a871ce7d37e57193692a043263a2 (diff)
parent731fdaf86ba20ead3af7e4f988ad84a321fbe12e (diff)
downloadvyos-1x-3501313affa62b88fa530c4518a08269ea6f61c0.tar.gz
vyos-1x-3501313affa62b88fa530c4518a08269ea6f61c0.zip
Merge pull request #388 from jjakob/flush-addrs-T2367
T2367: flush addresses when adding bond/bridge members
Diffstat (limited to 'src/conf_mode/interfaces-bonding.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py8
1 files changed, 7 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