Public bug reported: When rendering a per-subnet route with a metric, the value is ignored due to clobbering of the looping variable.
Consider this v1 input:
{
"version": 1,
"config": [
{
"type": "physical",
"name": "eno3",
"mac_address": "aa:bb:cc:dd:ee:ff",
"subnets": [
{
"control": "auto",
"type": "static",
"address": "192.168.14.13",
"netmask": "255.255.255.0",
"routes": [
{
"destination": "192.168.14.0/24",
"type": "route",
"gateway": "192.168.14.254",
"metric": 10000
}
]
}
]
},
{
"type": "nameserver",
"address": [
"8.8.8.8"
],
"search": []
}
]
}
This should result in a netplan where we have a route entry with the
correct gateway value and the metric, like this:
network:
version: 2
ethernets:
eno3:
addresses:
- 192.168.14.13/24
match:
macaddress: aa:bb:cc:dd:ee:ff
nameservers:
addresses:
- 8.8.8.8
search: []
routes:
- metric: 10000
to: 192.168.14.0/24
via: 192.168.14.254
set-name: eno3
But instead, we get this:
network:
version: 2
ethernets:
eno3:
addresses:
- 192.168.14.13/24
match:
macaddress: aa:bb:cc:dd:ee:ff
nameservers:
addresses:
- 8.8.8.8
search: []
routes:
- to: 192.168.14.0/24
via: 192.168.14.254
set-name: eno3
The bug is in here in _extract_addresses in cloudinit/net/netplan.py
for route in subnet.get('routes', []):
to_net = "%s/%s" % (route.get('network'),
route.get('prefix'))
route = { # BUG! clobbers looping variable route
'via': route.get('gateway'),
'to': to_net,
}
if 'metric' in route:
route.update({'metric': route.get('metric', 100)})
routes.append(new_route)
** Affects: cloud-init (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1805871
Title:
netplan renderer misses metric value in per-subnet routes
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1805871/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
