summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-dhcp6.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-07 15:36:49 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-02-14 07:02:33 +0100
commit8b1cfab96258828ee76e730abc567c8d7e54b899 (patch)
tree5ee75c324b7a167ef857368276950adb819adbad /src/network/networkd-dhcp6.c
parentsd-dhcp6-client: reset Information Refresh Time on stop (diff)
downloadsystemd-8b1cfab96258828ee76e730abc567c8d7e54b899.tar.xz
systemd-8b1cfab96258828ee76e730abc567c8d7e54b899.zip
network: do not restart DHCPv6 client when it is already running in managed mode
Otherwise, if a network has two router and one provides M flag and the other provides O flag, then the DHCPv6 client switches the running mode repeatedly. That makes the IPv6 network configuration of the host unstable.
Diffstat (limited to 'src/network/networkd-dhcp6.c')
-rw-r--r--src/network/networkd-dhcp6.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index ab51b7377d..1293a4d913 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -432,8 +432,20 @@ int dhcp6_start_on_ra(Link *link, bool information_request) {
return r;
if (inf_req == information_request)
+ /* The client is already running in the requested mode. */
return 0;
+ if (!inf_req) {
+ log_link_debug(link,
+ "The DHCPv6 client is already running in the managed mode, "
+ "refusing to start the client in the information requesting mode.");
+ return 0;
+ }
+
+ log_link_debug(link,
+ "The DHCPv6 client is running in the information requesting mode. "
+ "Restarting the client in the managed mode.");
+
r = sd_dhcp6_client_stop(link->dhcp6_client);
if (r < 0)
return r;