networkd: don't stop the dhcp server if it's not configured. (#7083)

we call sd_dhcp_server_stop even if it's not configured when link is
down resulting unwanted logs.
```
Oct 10 13:41:07 nena systemd-networkd[126]: eth0: Lost carrier
Oct 10 13:41:07 nena systemd-networkd[126]: DHCP CLIENT (0x560f2dc5): STOPPED
Oct 10 13:41:07 nena systemd-networkd[126]: eth0: DHCP lease lost
Oct 10 13:41:07 nena systemd-networkd[126]: NDISC: Stopping IPv6 Router Solicitation client
Oct 10 13:41:07 nena systemd-networkd[126]: Assertion 'server' failed at ../src/libsystemd-network/sd-dhcp-server.c:256, function sd_dhcp_server_stop(). Ignoring.
```

fixes #7047
This commit is contained in:
Susant Sahani
2017-10-18 12:38:56 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 702c979fef
commit 28464ae0e2
+2 -1
View File
@@ -3085,7 +3085,8 @@ static int link_carrier_lost(Link *link) {
return r;
}
(void) sd_dhcp_server_stop(link->dhcp_server);
if (link_dhcp4_server_enabled(link))
(void) sd_dhcp_server_stop(link->dhcp_server);
r = link_drop_config(link);
if (r < 0)