summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJan-Philipp Litza <jplitza@users.noreply.github.com>2026-04-08 13:59:30 +0200
committerJan-Philipp Litza <jplitza@users.noreply.github.com>2026-04-08 13:59:30 +0200
commit0d7099e88f9d366619e9eaac84d5ada3b9d2d8d3 (patch)
treeed8de7dce66d0a35eb665b19b406df33ee26f15f /cloudinit
parent11d4c4719c45807c9fa4449479b359402f9c054b (diff)
downloadvyos-cloud-init-0d7099e88f9d366619e9eaac84d5ada3b9d2d8d3.tar.gz
vyos-cloud-init-0d7099e88f9d366619e9eaac84d5ada3b9d2d8d3.zip
vyos: Fix handling of IPv6 netmasks on OpenStack
On OpenStack with a network with DHCP disabled, IPv6 routes are passed like this: 'routes': [{'network': '::', 'netmask': '::', 'gateway': '2001:db8::1'}] This results in a call to ipaddress.ip_network('::/::'), which Python does not regard as valid network notation. So this commit uses ipv6_mask_to_net_prefix from the package cloudinit.net.network_state to convert the netmask for IPv6 networks.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_vyos.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py
index 5894482f..56014794 100644
--- a/cloudinit/config/cc_vyos.py
+++ b/cloudinit/config/cc_vyos.py
@@ -28,6 +28,7 @@ from uuid import uuid4
from cloudinit import log as logging
from cloudinit.ssh_util import AuthKeyLineParser
from cloudinit.distros import ug_util
+from cloudinit.net.network_state import ipv6_mask_to_net_prefix
from cloudinit.settings import PER_INSTANCE
from cloudinit.sources import INSTANCE_JSON_FILE
from cloudinit.stages import Init
@@ -439,8 +440,12 @@ def _configure_subnets_v1(config,
# configure routes
if 'routes' in subnet:
for item in subnet['routes']:
+ if ipaddress.ip_address(item['network']).version == 6:
+ netmask = ipv6_mask_to_net_prefix(item['netmask'])
+ else:
+ netmask = item['netmask']
ip_network = ipaddress.ip_network('{}/{}'.format(
- item['network'], item['netmask']))
+ item['network'], netmask))
set_ip_route(config, ip_network.version,
ip_network.compressed, item['gateway'], True)