summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-11-18 17:13:12 -0600
committerTom Gundersen <teg@jklm.no>2014-11-19 00:58:51 +0100
commite37f74a6d5cc3c0a3d214c3a7f5de234b0696b4c (patch)
tree1ab3077929b5ec5bbe654a26ac36ad2a86ba73c9 /src/libsystemd-network/sd-dhcp-client.c
parentba6c0fd6303c63576983c7be892d80d954c1e4c5 (diff)
sd-dhcp-lease: load/save client ID
The lease is usually tied to the client ID, so users of the lease may want to know what client ID it was acquired with.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 8503f19c27..b2b72befbf 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -1029,6 +1029,14 @@ static int client_handle_offer(sd_dhcp_client *client, DHCPMessage *offer,
if (r < 0)
return r;
+ if (client->client_id_len) {
+ r = dhcp_lease_set_client_id(lease,
+ (uint8_t *) &client->client_id.raw,
+ client->client_id_len);
+ if (r < 0)
+ return r;
+ }
+
r = dhcp_option_parse(offer, len, dhcp_lease_parse_options, lease);
if (r != DHCP_OFFER) {
log_dhcp_client(client, "received message was not an OFFER, ignoring");
@@ -1088,6 +1096,14 @@ static int client_handle_ack(sd_dhcp_client *client, DHCPMessage *ack,
if (r < 0)
return r;
+ if (client->client_id_len) {
+ r = dhcp_lease_set_client_id(lease,
+ (uint8_t *) &client->client_id.raw,
+ client->client_id_len);
+ if (r < 0)
+ return r;
+ }
+
r = dhcp_option_parse(ack, len, dhcp_lease_parse_options, lease);
if (r == DHCP_NAK) {
log_dhcp_client(client, "NAK");