chiark / gitweb /
networkd: Properly stop router solicitation and DHCPv6 client
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 25 Jun 2014 09:36:55 +0000 (12:36 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 26 Jun 2014 13:09:50 +0000 (16:09 +0300)
When a link fails or looses carrier, always stop ongoing router
solicitation and any DHCPv6 client that may be running.

src/network/networkd-link.c

index 44147b2..9296a59 100644 (file)
@@ -236,11 +236,19 @@ static int link_stop_clients(Link *link) {
         }
 
         if (link->network->dhcp6) {
-                assert(link->dhcp6_client);
+                assert(link->icmp6_router_discovery);
+
+                if (link->dhcp6_client) {
+                        k = sd_dhcp6_client_stop(link->dhcp6_client);
+                        if (k < 0) {
+                                log_warning_link(link, "Could not stop DHCPv6 client: %s", strerror(-r));
+                                r = k;
+                        }
+                }
 
-                k = sd_dhcp6_client_stop(link->dhcp6_client);
+                k = sd_icmp6_nd_stop(link->icmp6_router_discovery);
                 if (k < 0) {
-                        log_warning_link(link, "Could not stop DHCPv6 client: %s", strerror(-r));
+                        log_warning_link(link, "Could not stop ICMPv6 router discovery: %s", strerror(-r));
                         r = k;
                 }
         }