Skip to content

Commit

Permalink
networkd: move KeepConfiguration= into [Network] section
Browse files Browse the repository at this point in the history
Fixup for #424
  • Loading branch information
slyon authored and daniloegea committed Dec 12, 2023
1 parent 92759d4 commit 4f7862a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/networkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ netplan_netdef_write_network_file(
if (def->type >= NETPLAN_DEF_TYPE_VIRTUAL || def->ignore_carrier)
g_string_append(network, "ConfigureWithoutCarrier=yes\n");

if (def->critical)
g_string_append_printf(network, "KeepConfiguration=true\n");

if (def->bridge && def->backend != NETPLAN_BACKEND_OVS) {
g_string_append_printf(network, "Bridge=%s\n", def->bridge);

Expand Down Expand Up @@ -916,14 +919,11 @@ netplan_netdef_write_network_file(
}
}

if (def->dhcp4 || def->dhcp6 || def->critical) {
if (def->dhcp4 || def->dhcp6) {
/* NetworkManager compatible route metrics */
g_string_append(network, "\n[DHCP]\n");
}

if (def->critical)
g_string_append_printf(network, "KeepConfiguration=true\n");

if (def->dhcp4 || def->dhcp6) {
if (def->dhcp_identifier)
g_string_append_printf(network, "ClientIdentifier=%s\n", def->dhcp_identifier);
Expand Down
2 changes: 0 additions & 2 deletions tests/generator/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ def test_dhcp_critical_true(self):
[Network]
LinkLocalAddressing=ipv6
[DHCP]
KeepConfiguration=true
'''})

Expand Down

0 comments on commit 4f7862a

Please sign in to comment.