diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-26 06:31:49 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-26 08:08:35 +0900 |
commit | be615f7c14a4f2b1233f08ffe19c882bbea43327 (patch) | |
tree | 7a0db535607df42c327c4b68a14b2ddd73bc38fc /src/libsystemd-network | |
parent | 4a7b90f8a2dfa42431eec55422348f047be955d4 (diff) | |
download | systemd-be615f7c14a4f2b1233f08ffe19c882bbea43327.tar.gz |
sd-dhcp-client: introduce sd_dhcp_client_attach_device()
It will be used later.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index a106f7f3b8..98a19c3cb8 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -14,6 +14,7 @@ #include "sd-dhcp-client.h" #include "alloc-util.h" +#include "device-util.h" #include "dhcp-identifier.h" #include "dhcp-internal.h" #include "dhcp-lease-internal.h" @@ -77,8 +78,12 @@ struct sd_dhcp_client { sd_event *event; int event_priority; sd_event_source *timeout_resend; + int ifindex; char *ifname; + + sd_device *dev; + int fd; uint16_t port; union sockaddr_union link; @@ -2153,6 +2158,12 @@ sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client) { return client->event; } +int sd_dhcp_client_attach_device(sd_dhcp_client *client, sd_device *dev) { + assert_return(client, -EINVAL); + + return device_unref_and_replace(client->dev, dev); +} + static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) { if (!client) return NULL; @@ -2168,6 +2179,8 @@ static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) { sd_dhcp_client_detach_event(client); + sd_device_unref(client->dev); + set_free(client->req_opts); free(client->hostname); free(client->vendor_class_identifier); |