summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-10-15 00:24:17 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-10-15 00:24:17 +0200
commitc8bae3637212daad992323d4b2a253c3949c9777 (patch)
tree098882f4638480069b94fe0a8be9abcc2fade87e /src
parentMerge pull request #17351 from poettering/exec-rt-typo-fix (diff)
downloadsystemd-c8bae3637212daad992323d4b2a253c3949c9777.tar.xz
systemd-c8bae3637212daad992323d4b2a253c3949c9777.zip
libsystemd-network: do not request each daemon exist in sd_xxx_stop()
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c5
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c3
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c3
-rw-r--r--src/libsystemd-network/sd-ipv4acd.c3
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c3
-rw-r--r--src/libsystemd-network/sd-lldp.c3
-rw-r--r--src/libsystemd-network/sd-ndisc.c3
-rw-r--r--src/libsystemd-network/sd-radv.c3
8 files changed, 17 insertions, 9 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 6eb3c1b7a0..53c4350874 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -2135,9 +2135,10 @@ int sd_dhcp_client_send_decline(sd_dhcp_client *client) {
}
int sd_dhcp_client_stop(sd_dhcp_client *client) {
- DHCP_CLIENT_DONT_DESTROY(client);
+ if (!client)
+ return 0;
- assert_return(client, -EINVAL);
+ DHCP_CLIENT_DONT_DESTROY(client);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
client->state = DHCP_STATE_STOPPED;
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index a34a55919e..9022aefccb 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -225,7 +225,8 @@ sd_event *sd_dhcp_server_get_event(sd_dhcp_server *server) {
}
int sd_dhcp_server_stop(sd_dhcp_server *server) {
- assert_return(server, -EINVAL);
+ if (!server)
+ return 0;
server->receive_message =
sd_event_source_unref(server->receive_message);
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index e1dbdaff4e..6d27c4685e 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -1676,7 +1676,8 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state) {
}
int sd_dhcp6_client_stop(sd_dhcp6_client *client) {
- assert_return(client, -EINVAL);
+ if (!client)
+ return 0;
client_stop(client, SD_DHCP6_CLIENT_EVENT_STOP);
diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c
index ecd91cd927..ff333914e9 100644
--- a/src/libsystemd-network/sd-ipv4acd.c
+++ b/src/libsystemd-network/sd-ipv4acd.c
@@ -144,7 +144,8 @@ static void ipv4acd_client_notify(sd_ipv4acd *acd, int event) {
int sd_ipv4acd_stop(sd_ipv4acd *acd) {
IPv4ACDState old_state;
- assert_return(acd, -EINVAL);
+ if (!acd)
+ return 0;
old_state = acd->state;
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index 4f4d9ebe87..293a4644a2 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -89,7 +89,8 @@ int sd_ipv4ll_new(sd_ipv4ll **ret) {
}
int sd_ipv4ll_stop(sd_ipv4ll *ll) {
- assert_return(ll, -EINVAL);
+ if (!ll)
+ return 0;
return sd_ipv4acd_stop(ll->acd);
}
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index b0a11fe20b..e536f90d19 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -276,7 +276,8 @@ fail:
}
_public_ int sd_lldp_stop(sd_lldp *lldp) {
- assert_return(lldp, -EINVAL);
+ if (!lldp)
+ return 0;
if (lldp->fd < 0)
return 0;
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c
index 9922203ac4..92e772d352 100644
--- a/src/libsystemd-network/sd-ndisc.c
+++ b/src/libsystemd-network/sd-ndisc.c
@@ -321,7 +321,8 @@ static int ndisc_timeout_no_ra(sd_event_source *s, uint64_t usec, void *userdata
}
_public_ int sd_ndisc_stop(sd_ndisc *nd) {
- assert_return(nd, -EINVAL);
+ if (!nd)
+ return 0;
if (nd->fd < 0)
return 0;
diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c
index 016808667c..9656d7c969 100644
--- a/src/libsystemd-network/sd-radv.c
+++ b/src/libsystemd-network/sd-radv.c
@@ -353,7 +353,8 @@ fail:
_public_ int sd_radv_stop(sd_radv *ra) {
int r;
- assert_return(ra, -EINVAL);
+ if (!ra)
+ return 0;
if (ra->state == SD_RADV_STATE_IDLE)
return 0;