Skip to content

Commit

Permalink
Scaleway: Force on-link: true for static networks (#5523)
Browse files Browse the repository at this point in the history
On some distributions like focal (See LP: #2073869) systemd fails to add
a route which is not in the subnet of the NIC if onlink is not explicitely
specified.

Force on-link to true to avoid those situations.
  • Loading branch information
Louis Bouchard committed Sep 16, 2024
1 parent 2c80c5a commit f24b632
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion cloudinit/sources/DataSourceScaleway.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ def network_config(self):
if ip["address"] == self.ephemeral_fixed_address:
ip_cfg["dhcp4"] = True
# Force addition of a route to the metadata API
route = {"to": "169.254.42.42/32", "via": "62.210.0.1"}
route = {
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
if "routes" in ip_cfg.keys():
ip_cfg["routes"] += [route]
else:
Expand Down
24 changes: 20 additions & 4 deletions tests/unittests/sources/test_scaleway.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,11 @@ def test_ipmob_primary_ipv4_config_ok(self, m_get_cmdline, fallback_nic):
"ethernets": {
fallback_nic.return_value: {
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"}
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
],
"dhcp4": True,
},
Expand Down Expand Up @@ -903,7 +907,11 @@ def test_ipmob_additional_ipv4_config_ok(
fallback_nic.return_value: {
"dhcp4": True,
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"}
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
],
"addresses": ("20.20.20.20/32",),
},
Expand Down Expand Up @@ -983,7 +991,11 @@ def test_ipmob_primary_ipv4_v6_config_ok(
fallback_nic.return_value: {
"dhcp4": True,
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"},
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
},
{
"via": "fe80::ffff:ffff:ffff:fff1",
"to": "::/0",
Expand Down Expand Up @@ -1034,7 +1046,11 @@ def test_ipmob_primary_ipv6_v4_config_ok(
"via": "fe80::ffff:ffff:ffff:fff1",
"to": "::/0",
},
{"to": "169.254.42.42/32", "via": "62.210.0.1"},
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
},
],
"addresses": ("2001:aaa:aaaa:a:aaaa:aaaa:aaaa:1/64",),
},
Expand Down

0 comments on commit f24b632

Please sign in to comment.