diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-26 06:31:59 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-26 08:08:35 +0900 |
commit | 793178b987c3e4e19cb6e4530499d2bb965317ff (patch) | |
tree | c5b0bb0a76df5ccea04ca0cdaf7c142230dc49ac /src/libsystemd-network | |
parent | be615f7c14a4f2b1233f08ffe19c882bbea43327 (diff) | |
download | systemd-793178b987c3e4e19cb6e4530499d2bb965317ff.tar.gz |
sd-dhcp6-client: introduce sd_dhcp6_client_attach_device()
It will be used later.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/dhcp6-internal.h | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/dhcp6-internal.h index 65f6cb057f..13c31c24fc 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/dhcp6-internal.h @@ -48,6 +48,8 @@ struct sd_dhcp6_client { int event_priority; int fd; + sd_device *dev; + DHCP6State state; bool information_request; usec_t information_request_time_usec; diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 375f984940..8a435a5348 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -11,6 +11,7 @@ #include "sd-dhcp6-client.h" #include "alloc-util.h" +#include "device-util.h" #include "dhcp-identifier.h" #include "dhcp6-internal.h" #include "dhcp6-lease-internal.h" @@ -1446,6 +1447,12 @@ sd_event *sd_dhcp6_client_get_event(sd_dhcp6_client *client) { return client->event; } +int sd_dhcp6_client_attach_device(sd_dhcp6_client *client, sd_device *dev) { + assert_return(client, -EINVAL); + + return device_unref_and_replace(client->dev, dev); +} + static sd_dhcp6_client *dhcp6_client_free(sd_dhcp6_client *client) { if (!client) return NULL; @@ -1461,6 +1468,8 @@ static sd_dhcp6_client *dhcp6_client_free(sd_dhcp6_client *client) { client->fd = safe_close(client->fd); + sd_device_unref(client->dev); + free(client->req_opts); free(client->fqdn); free(client->mudurl); |