Skip to content

Commit 4f7862a

Browse files
slyondaniloegea
authored andcommitted
networkd: move KeepConfiguration= into [Network] section
Fixup for #424
1 parent 92759d4 commit 4f7862a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/networkd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,9 @@ netplan_netdef_write_network_file(
844844
if (def->type >= NETPLAN_DEF_TYPE_VIRTUAL || def->ignore_carrier)
845845
g_string_append(network, "ConfigureWithoutCarrier=yes\n");
846846

847+
if (def->critical)
848+
g_string_append_printf(network, "KeepConfiguration=true\n");
849+
847850
if (def->bridge && def->backend != NETPLAN_BACKEND_OVS) {
848851
g_string_append_printf(network, "Bridge=%s\n", def->bridge);
849852

@@ -916,14 +919,11 @@ netplan_netdef_write_network_file(
916919
}
917920
}
918921

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

924-
if (def->critical)
925-
g_string_append_printf(network, "KeepConfiguration=true\n");
926-
927927
if (def->dhcp4 || def->dhcp6) {
928928
if (def->dhcp_identifier)
929929
g_string_append_printf(network, "ClientIdentifier=%s\n", def->dhcp_identifier);

tests/generator/test_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,6 @@ def test_dhcp_critical_true(self):
480480
481481
[Network]
482482
LinkLocalAddressing=ipv6
483-
484-
[DHCP]
485483
KeepConfiguration=true
486484
'''})
487485

0 commit comments

Comments
 (0)