]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: stop clients when networkd shuts down (#12463)
authorSusant Sahani <ssahani@redhat.com>
Mon, 6 May 2019 14:06:50 +0000 (19:36 +0530)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 May 2019 14:06:50 +0000 (16:06 +0200)
We not stopping the clients when networkd stops. They
should shut down cleanly and then we need to clean the DS.

One of requirements to implement
https://github.com/systemd/systemd/issues/10820.

```
^CBus bus-api-network: changing state RUNNING → CLOSED
DHCP SERVER: UNREF
DHCP SERVER: STOPPED
DHCP CLIENT (0x60943df0): STOPPED
veth-test: DHCP lease lost
veth-test: Removing address 192.168.5.31
NDISC: Stopping IPv6 Router Solicitation client
DHCP CLIENT (0x0): FREE
==24308==
==24308== HEAP SUMMARY:
==24308==     in use at exit: 8,192 bytes in 2 blocks
==24308==   total heap usage: 4,230 allocs, 4,228 frees, 1,209,732 bytes allocated
==24308==
==24308== LEAK SUMMARY:
==24308==    definitely lost: 0 bytes in 0 blocks
==24308==    indirectly lost: 0 bytes in 0 blocks
==24308==      possibly lost: 0 bytes in 0 blocks
==24308==    still reachable: 8,192 bytes in 2 blocks
==24308==         suppressed: 0 bytes in 0 blocks
==24308== Rerun with --leak-check=full to see details of leaked memory
==24308==
==24308== For lists of detected and suppressed errors, rerun with: -s
==24308== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==24308== could not unlink /tmp/vgdb-pipe-from-vgdb-to-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-to-vgdb-from-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-24308-by-sus-on-Zeus

```

src/network/networkd-link.c
src/network/networkd-link.h
src/network/networkd-manager.c

index 532f2d7f96afdaca587153329c1fdf2b894fcd1f..533193ac9327b397a16173b344eef06169c60c51 100644 (file)
@@ -736,7 +736,7 @@ static void link_enter_unmanaged(Link *link) {
         link_dirty(link);
 }
 
-static int link_stop_clients(Link *link) {
+int link_stop_clients(Link *link) {
         int r = 0, k;
 
         assert(link);
index b43401afc66412b3a7ee270ca7760feffdcad139..1366a299242b0947d90aa258a70df9bb75dfb841 100644 (file)
@@ -171,6 +171,8 @@ int dhcp6_configure(Link *link);
 int dhcp6_request_address(Link *link, int ir);
 int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client *client, Link* link);
 
+int link_stop_clients(Link *link);
+
 const char* link_state_to_string(LinkState s) _const_;
 LinkState link_state_from_string(const char *s) _pure_;
 
index c9579370cb93f684885b1315f3c04f51dd083e83..8c461a89e047001c110d0ae68336b9515be64852 100644 (file)
@@ -1446,6 +1446,9 @@ void manager_free(Manager *m) {
         while ((link = hashmap_steal_first(m->links))) {
                 if (link->dhcp6_client)
                         (void) dhcp6_lease_pd_prefix_lost(link->dhcp6_client, link);
+
+                link_stop_clients(link);
+
                 link_unref(link);
         }