summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c13
-rw-r--r--src/systemd/sd-dhcp-client.h2
2 files changed, 15 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);
diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h
index 6a863794a4..b200f17cbd 100644
--- a/src/systemd/sd-dhcp-client.h
+++ b/src/systemd/sd-dhcp-client.h
@@ -25,6 +25,7 @@
#include <sys/types.h>
#include <stdbool.h>
+#include "sd-device.h"
#include "sd-dhcp-lease.h"
#include "sd-dhcp-option.h"
#include "sd-event.h"
@@ -337,6 +338,7 @@ int sd_dhcp_client_attach_event(
int64_t priority);
int sd_dhcp_client_detach_event(sd_dhcp_client *client);
sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client);
+int sd_dhcp_client_attach_device(sd_dhcp_client *client, sd_device *dev);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref);