diff options
author | Christian Breunig <christian@breunig.cc> | 2023-02-25 22:40:12 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-02-25 22:40:12 +0100 |
commit | 54c36e435049ed8f7f248adab171cb114eab1e10 (patch) | |
tree | f3adb2c16318b90610d9cf27205643fdef893623 /python/vyos/ifconfig/tunnel.py | |
parent | 3bad1d0adb1c187f6611f4bed3d0ad16927d5d18 (diff) | |
download | vyos-1x-54c36e435049ed8f7f248adab171cb114eab1e10.tar.gz vyos-1x-54c36e435049ed8f7f248adab171cb114eab1e10.zip |
tunnel: T5034: migrate "multicast enable" CLI node to enable-multicast
Tunnel interface multicast settings can be "enabled or disabled". As we prefer
valueless nodes, and the linux kernel default is "disabled" we should add a
set interfaces tunnel tunXX enable-multicast
command
Diffstat (limited to 'python/vyos/ifconfig/tunnel.py')
-rw-r--r-- | python/vyos/ifconfig/tunnel.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/python/vyos/ifconfig/tunnel.py b/python/vyos/ifconfig/tunnel.py index f776240a1..b7bf7d982 100644 --- a/python/vyos/ifconfig/tunnel.py +++ b/python/vyos/ifconfig/tunnel.py @@ -83,11 +83,6 @@ class TunnelIf(Interface): 'convert': enable_to_on, 'shellcmd': 'ip link set dev {ifname} multicast {value}', }, - 'allmulticast': { - 'validate': lambda v: assert_list(v, ['enable', 'disable']), - 'convert': enable_to_on, - 'shellcmd': 'ip link set dev {ifname} allmulticast {value}', - }, } } @@ -162,14 +157,9 @@ class TunnelIf(Interface): """ Get a synthetic MAC address. """ return self.get_mac_synthetic() - def set_multicast(self): - """ Set multicast """ - if self.config.get('multicast', 'disable') == 'enable': - cmd = 'ip link set dev {ifname} multicast on' - else: - cmd = 'ip link set dev {ifname} multicast off' - - self._cmd(cmd.format(**self.config)) + def set_multicast(self, enable): + """ Change the MULTICAST flag on the device """ + return self.set_interface('multicast', enable) def update(self, config): """ General helper function which works on a dictionary retrived by @@ -179,8 +169,10 @@ class TunnelIf(Interface): # Adjust iproute2 tunnel parameters if necessary self._change_options() - # Add multicast - self.set_multicast() + # IP Multicast + tmp = dict_search('enable_multicast', config) + value = 'enable' if (tmp != None) else 'disable' + self.set_multicast(value) # call base class first super().update(config) |