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 2, 2024
1 parent 5ff1a4a commit 5439b30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cloudinit/sources/DataSourceScaleway.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ def network_config(self):
ip_cfg["dhcp4"] = True
# Force addition of a route to the metadata API
ip_cfg["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",
}
]
else:
if "addresses" in ip_cfg.keys():
Expand Down
18 changes: 15 additions & 3 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

0 comments on commit 5439b30

Please sign in to comment.