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 f144ded
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 @@ -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
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 f144ded

Please sign in to comment.