diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-04-22 16:19:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-22 16:19:10 +0100 |
| commit | d93a44867eb6924dc633405126893ae542855167 (patch) | |
| tree | 166384c43512f81c3662b3bc6e8d0f58a678376b /python/vyos/ifconfig/interface.py | |
| parent | be0ce3a33d717fe06bc52fe1f30a544a62ae5552 (diff) | |
| parent | b124f0b3b05bced1f916e9519d986d03f2b95c51 (diff) | |
| download | veeos-1x-d93a44867eb6924dc633405126893ae542855167.tar.gz veeos-1x-d93a44867eb6924dc633405126893ae542855167.zip | |
Merge pull request #4392 from symysak/T4627
interface: T4627: support setting of IPv6 Interface Identifier(Token)
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
| -rw-r--r-- | python/vyos/ifconfig/interface.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 979b62578..9a45ae66e 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -937,6 +937,20 @@ class Interface(Control): prefixlen = prefix.split('/')[1] self.del_addr(f'{eui64}/{prefixlen}') + def set_ipv6_interface_identifier(self, identifier): + """ + Set the interface identifier for IPv6 autoconf. + """ + cmd = f'ip token set {identifier} dev {self.ifname}' + self._cmd(cmd) + + def del_ipv6_interface_identifier(self): + """ + Delete the interface identifier for IPv6 autoconf. + """ + cmd = f'ip token delete dev {self.ifname}' + self._cmd(cmd) + def set_ipv6_forwarding(self, forwarding): """ Configure IPv6 interface-specific Host/Router behaviour. @@ -1792,6 +1806,23 @@ class Interface(Control): value = '0' if (tmp != None) else '1' self.set_ipv6_forwarding(value) + # Delete old interface identifier + # This should be before setting the accept_ra value + old = dict_search('ipv6.address.interface_identifier_old', config) + now = dict_search('ipv6.address.interface_identifier', config) + if old and not now: + # accept_ra of ra is required to delete the interface identifier + self.set_ipv6_accept_ra('2') + self.del_ipv6_interface_identifier() + + # Set IPv6 Interface identifier + # This should be before setting the accept_ra value + tmp = dict_search('ipv6.address.interface_identifier', config) + if tmp: + # accept_ra is required to set the interface identifier + self.set_ipv6_accept_ra('2') + self.set_ipv6_interface_identifier(tmp) + # IPv6 router advertisements tmp = dict_search('ipv6.address.autoconf', config) value = '2' if (tmp != None) else '1' |
