summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-05-02 15:54:42 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-05-02 20:40:43 +0200
commit731fdaf86ba20ead3af7e4f988ad84a321fbe12e (patch)
tree0057a12e846bf88627a6fcb17e091fe1cebf9393 /src
parentcf1ec3c1ebdd71dae741fa1f34bce6719ee0ef50 (diff)
downloadvyos-1x-731fdaf86ba20ead3af7e4f988ad84a321fbe12e.tar.gz
vyos-1x-731fdaf86ba20ead3af7e4f988ad84a321fbe12e.zip
bridge: T2367: flush all addresses of member interfaces
Any remaining addresses of an interface (e.g. IPv6 link-local) will be flushed when adding a member. A direct call to ip is necessary for interfaces not under the Interface class (e.g. vlan vif*)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py8
1 files changed, 8 insertions, 0 deletions
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