diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-21 09:49:41 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-21 09:50:31 +0200 |
commit | db43a81c06d1fc8c06c4e5bae753a8854bf00d2c (patch) | |
tree | 005ae787b3cbb10a385f3678025c3e44ebd5f064 /src | |
parent | 62c3e0b5f2de7a1bb14b384bfb1d32687e08c4f8 (diff) | |
download | vyos-1x-db43a81c06d1fc8c06c4e5bae753a8854bf00d2c.tar.gz vyos-1x-db43a81c06d1fc8c06c4e5bae753a8854bf00d2c.zip |
vxlan: T1636: simplyfy code (don't delete intf addresses)
We do not need to delete addresses manually as the VXLAN interface is
always deleted which drops all assigned addresses from the Kernel.
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/interface-vxlan.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/conf_mode/interface-vxlan.py b/src/conf_mode/interface-vxlan.py index 59022238e..e97b4bf99 100755 --- a/src/conf_mode/interface-vxlan.py +++ b/src/conf_mode/interface-vxlan.py @@ -28,7 +28,6 @@ from netifaces import interfaces default_config_data = { 'address': [], - 'address_remove': [], 'deleted': False, 'description': '', 'disable': False, @@ -43,7 +42,6 @@ default_config_data = { # the IANA's selection of a standard destination port } - def get_config(): vxlan = deepcopy(default_config_data) conf = Config() @@ -66,12 +64,6 @@ def get_config(): if conf.exists('address'): vxlan['address'] = conf.return_values('address') - # Determine interface addresses (currently effective) - to determine which - # address is no longer valid and needs to be removed from the interface - eff_addr = conf.return_effective_values('address') - act_addr = conf.return_values('address') - vxlan['address_remove'] = list_diff(eff_addr, act_addr) - # retrieve interface description if conf.exists('description'): vxlan['description'] = conf.return_value('description') @@ -180,11 +172,9 @@ def apply(vxlan): # Enable proxy-arp on this interface v.proxy_arp = vxlan['ip_proxy_arp'] - # Configure interface address(es) - # - not longer required addresses get removed first - # - newly addresses will be added second - for addr in vxlan['address_remove']: - v.del_addr(addr) + # Configure interface address(es) - no need to implicitly delete the + # old addresses as they have already been removed by deleting the + # interface above for addr in vxlan['address']: v.add_addr(addr) |