From 655700538592048c78306f951616cee5de7edbef Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Thu, 24 Aug 2023 16:09:04 +0000 Subject: T5506: Add link-local IPv6 address for container interfaces Fix for adding IPv6 link-local address for container interfaces set container network NET01 prefix '10.0.0.0/24' set container network NET01 prefix '2001:db8:2222::/64' % ip -6 addr show scope link dev pod-NET01 17: pod-NET01: mtu 1500 qdisc noqueue state UP group default qlen 1000 inet6 fe80::d89c:dfff:fe1a:8689/64 scope link --- src/conf_mode/container.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py index 667d08f8c..6284caa97 100755 --- a/src/conf_mode/container.py +++ b/src/conf_mode/container.py @@ -25,6 +25,7 @@ from vyos.config import Config from vyos.configdict import dict_merge from vyos.configdict import node_changed from vyos.configdict import is_node_changed +from vyos.ifconfig import Interface from vyos.util import call from vyos.util import cmd from vyos.util import dict_search @@ -466,6 +467,13 @@ def apply(container): if disabled_new: call('systemctl daemon-reload') + if 'network' in container: + for network, network_config in container['network'].items(): + network_name = f'pod-{network}' + if os.path.exists(f'/sys/class/net/{network_name}'): + tmp = Interface(network_name) + tmp.add_ipv6_eui64_address('fe80::/64') + return None if __name__ == '__main__': -- cgit v1.2.3