network: DHCP4 client ID save in state file
This commit is contained in:
parent
7887e58051
commit
5dfaf89b5b
|
@ -4354,6 +4354,8 @@ int link_save(Link *link) {
|
||||||
if (link->dhcp_lease) {
|
if (link->dhcp_lease) {
|
||||||
struct in_addr address;
|
struct in_addr address;
|
||||||
const char *tz = NULL;
|
const char *tz = NULL;
|
||||||
|
size_t client_id_len;
|
||||||
|
const void *client_id;
|
||||||
|
|
||||||
assert(link->network);
|
assert(link->network);
|
||||||
|
|
||||||
|
@ -4368,6 +4370,15 @@ int link_save(Link *link) {
|
||||||
fputc('\n', f);
|
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);
|
r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in a new issue