diff options
author | Tom Gundersen <teg@jklm.no> | 2015-11-10 15:41:30 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-11-11 15:42:38 +0100 |
commit | f667c150a9116022f348cb6d8f2a553dce2386c3 (patch) | |
tree | cf08017221fe8dc43db6f652d47f439425997372 /src | |
parent | 63bbe5c767a39ee4d6acaadc5e643d6d3556d9cd (diff) |
sd-dhcp6-client: add is_running() method
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 8 | ||||
-rw-r--r-- | src/systemd/sd-dhcp6-client.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index e29de60d24..e00ca2b00d 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -1115,11 +1115,19 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state) { } int sd_dhcp6_client_stop(sd_dhcp6_client *client) { + assert_return(client, -EINVAL); + client_stop(client, SD_DHCP6_CLIENT_EVENT_STOP); return 0; } +int sd_dhcp6_client_is_running(sd_dhcp6_client *client) { + assert_return(client, -EINVAL); + + return client->state != DHCP6_STATE_STOPPED; +} + int sd_dhcp6_client_start(sd_dhcp6_client *client) { int r = 0; enum DHCP6State state = DHCP6_STATE_SOLICITATION; diff --git a/src/systemd/sd-dhcp6-client.h b/src/systemd/sd-dhcp6-client.h index 13182a481d..9f0e92806e 100644 --- a/src/systemd/sd-dhcp6-client.h +++ b/src/systemd/sd-dhcp6-client.h @@ -62,6 +62,7 @@ int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret); int sd_dhcp6_client_stop(sd_dhcp6_client *client); int sd_dhcp6_client_start(sd_dhcp6_client *client); +int sd_dhcp6_client_is_running(sd_dhcp6_client *client); int sd_dhcp6_client_attach_event(sd_dhcp6_client *client, sd_event *event, int priority); int sd_dhcp6_client_detach_event(sd_dhcp6_client *client); |