mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
network: introduce link_serialize_dhcp6_client()
This commit is contained in:
parent
ca21a19a2e
commit
5460bde5c5
@ -1472,6 +1472,27 @@ int dhcp6_configure(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int link_serialize_dhcp6_client(Link *link, FILE *f) {
|
||||
_cleanup_free_ char *duid = NULL;
|
||||
uint32_t iaid;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!link->dhcp6_client)
|
||||
return 0;
|
||||
|
||||
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
|
||||
if (r >= 0)
|
||||
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
|
||||
|
||||
r = sd_dhcp6_client_duid_as_string(link->dhcp6_client, &duid);
|
||||
if (r >= 0)
|
||||
fprintf(f, "DHCP6_CLIENT_DUID=%s\n", duid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_dhcp6_pd_hint(
|
||||
const char* unit,
|
||||
const char *filename,
|
||||
|
@ -32,6 +32,8 @@ int dhcp6_configure(Link *link);
|
||||
int dhcp6_request_address(Link *link, int ir);
|
||||
int dhcp6_request_prefix_delegation(Link *link);
|
||||
|
||||
int link_serialize_dhcp6_client(Link *link, FILE *f);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_pd_hint);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_mud_url);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_dhcp6_client_start_mode);
|
||||
|
@ -3515,18 +3515,9 @@ int link_save(Link *link) {
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
if (link->dhcp6_client) {
|
||||
_cleanup_free_ char *duid = NULL;
|
||||
uint32_t iaid;
|
||||
|
||||
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
|
||||
if (r >= 0)
|
||||
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
|
||||
|
||||
r = sd_dhcp6_client_duid_as_string(link->dhcp6_client, &duid);
|
||||
if (r >= 0)
|
||||
fprintf(f, "DHCP6_CLIENT_DUID=%s\n", duid);
|
||||
}
|
||||
r = link_serialize_dhcp6_client(link, f);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
r = fflush_and_check(f);
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user