summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2020-06-08 06:39:06 +0200
committerSusant Sahani <ssahani@vmware.com>2020-06-08 07:08:04 +0200
commit5dfaf89b5b851d3e8dd2cb4e2bd8f31ff49b4701 (patch)
treeba22b62f16d00edd19e1fdbbca4602271afd1808 /src/network/networkd-link.c
parenttest: avoid failing due to unexpected precision (diff)
downloadsystemd-5dfaf89b5b851d3e8dd2cb4e2bd8f31ff49b4701.tar.xz
systemd-5dfaf89b5b851d3e8dd2cb4e2bd8f31ff49b4701.zip
network: DHCP4 client ID save in state file
Diffstat (limited to '')
-rw-r--r--src/network/networkd-link.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 805aff3ab1..eeb5f5e16a 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -4354,6 +4354,8 @@ int link_save(Link *link) {
if (link->dhcp_lease) {
struct in_addr address;
const char *tz = NULL;
+ size_t client_id_len;
+ const void *client_id;
assert(link->network);
@@ -4368,6 +4370,15 @@ int link_save(Link *link) {
fputc('\n', f);
}
+ r = sd_dhcp_lease_get_client_id(link->dhcp_lease, &client_id, &client_id_len);
+ if (r >= 0) {
+ _cleanup_free_ char *id = NULL;
+
+ r = sd_dhcp_client_id_to_string(client_id, client_id_len, &id);
+ if (r >= 0)
+ fprintf(f, "DHCP4_CLIENT_ID=%s\n", id);
+ }
+
r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
if (r < 0)
goto fail;