diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-08-24 16:09:04 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-08-24 16:09:04 +0000 |
commit | 655700538592048c78306f951616cee5de7edbef (patch) | |
tree | b69a6f127240b0d1b97b4bf1d9151dc6ccd08227 | |
parent | f70e2b69a5ba80abda044ad4f9cdc5a345bce2fd (diff) | |
download | vyos-1x-655700538592048c78306f951616cee5de7edbef.tar.gz vyos-1x-655700538592048c78306f951616cee5de7edbef.zip |
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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet6 fe80::d89c:dfff:fe1a:8689/64 scope link
-rwxr-xr-x | src/conf_mode/container.py | 8 |
1 files changed, 8 insertions, 0 deletions
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__': |