summaryrefslogtreecommitdiff
path: root/src/network/networkd-sysctl.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-11-27 09:08:01 +0900
committerGitHub <noreply@github.com>2020-11-27 09:08:01 +0900
commitdca63b5b46f36989f69b154d7af3b4da433ae59e (patch)
tree9ce43d3630e029a3a53a1fb3821bc337523b4d3f /src/network/networkd-sysctl.c
parent0d5eb02134c6420a7b929915df5a1b18ba841911 (diff)
parent61eb77c4b6784ca3244dbbc0f292e051f18eab71 (diff)
downloadsystemd-dca63b5b46f36989f69b154d7af3b4da433ae59e.tar.gz
Merge pull request #17474 from yuwata/network-drop-link-deserialization-logic
network: drop link deserialization logic
Diffstat (limited to 'src/network/networkd-sysctl.c')
-rw-r--r--src/network/networkd-sysctl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
index 518fe8e131..add069e470 100644
--- a/src/network/networkd-sysctl.c
+++ b/src/network/networkd-sysctl.c
@@ -212,6 +212,15 @@ int link_set_sysctl(Link *link) {
if (r < 0)
log_link_warning_errno(link, r, "Cannot set IPv4 accept_local flag for interface, ignoring: %m");
+ /* If promote_secondaries is not set, DHCP will work only as long as the IP address does not
+ * changes between leases. The kernel will remove all secondary IP addresses of an interface
+ * otherwise. The way systemd-networkd works is that the new IP of a lease is added as a
+ * secondary IP and when the primary one expires it relies on the kernel to promote the
+ * secondary IP. See also https://github.com/systemd/systemd/issues/7163 */
+ r = sysctl_write_ip_property_boolean(AF_INET, link->ifname, "promote_secondaries", true);
+ if (r < 0)
+ log_link_warning_errno(link, r, "Cannot enable promote_secondaries for interface, ignoring: %m");
+
return 0;
}