diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-02-21 18:23:55 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-02-21 18:23:55 +0100 |
commit | 3a605ad020d8d20b08a72cb1284f6e590d1fd7b5 (patch) | |
tree | 74120735fc8ff725ce7be7a5b086730fc688a09f /python/vyos/ifconfig/vxlan.py | |
parent | 25b2f2a8057260ad0d2c59823618d7c9f0fba707 (diff) | |
download | vyos-1x-3a605ad020d8d20b08a72cb1284f6e590d1fd7b5.tar.gz vyos-1x-3a605ad020d8d20b08a72cb1284f6e590d1fd7b5.zip |
vxlan: T4120: code cleanup for multiple remotes
Diffstat (limited to 'python/vyos/ifconfig/vxlan.py')
-rw-r--r-- | python/vyos/ifconfig/vxlan.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py index 87b5e40b8..516a19f24 100644 --- a/python/vyos/ifconfig/vxlan.py +++ b/python/vyos/ifconfig/vxlan.py @@ -1,4 +1,4 @@ -# Copyright 2019-2021 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -68,6 +68,16 @@ class VXLANIf(Interface): 'vni' : 'id', } + # IPv6 flowlabels can only be used on IPv6 tunnels, thus we need to + # ensure that at least the first remote IP address is passed to the + # tunnel creation command. Subsequent tunnel remote addresses can later + # be added to the FDB + remote_list = None + if 'remote' in self.config: + # skip first element as this is already configured as remote + remote_list = self.config['remote'][1:] + self.config['remote'] = self.config['remote'][0] + cmd = 'ip link add {ifname} type {type} dstport {port}' for vyos_key, iproute2_key in mapping.items(): # dict_search will return an empty dict "{}" for valueless nodes like @@ -83,9 +93,9 @@ class VXLANIf(Interface): # interface is always A/D down. It needs to be enabled explicitly self.set_admin_state('down') - other_remotes = self.config.get('other_remotes') - if other_remotes: - for rem in other_remotes: - self.config['rem'] = rem - cmd2 = 'bridge fdb append to 00:00:00:00:00:00 dst {rem} port {port} dev {ifname}' - self._cmd(cmd2.format(**self.config)) + # VXLAN tunnel is always recreated on any change - see interfaces-vxlan.py + if remote_list: + for remote in remote_list: + cmd = f'bridge fdb append to 00:00:00:00:00:00 dst {remote} ' \ + 'port {port} dev {ifname}' + self._cmd(cmd.format(**self.config)) |