mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
network: introduce link_serialize_ipv4ll()
This commit is contained in:
parent
daad60d19e
commit
ca21a19a2e
@ -195,6 +195,28 @@ int ipv4ll_configure(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int link_serialize_ipv4ll(Link *link, FILE *f) {
|
||||
struct in_addr address;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!link->ipv4ll)
|
||||
return 0;
|
||||
|
||||
r = sd_ipv4ll_get_address(link->ipv4ll, &address);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
fputs("IPV4LL_ADDRESS=", f);
|
||||
serialize_in_addrs(f, &address, 1, false, NULL);
|
||||
fputc('\n', f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int link_deserialize_ipv4ll(Link *link, const char *ipv4ll_address) {
|
||||
union in_addr_union address;
|
||||
int r;
|
||||
|
@ -8,6 +8,7 @@
|
||||
typedef struct Link Link;
|
||||
|
||||
int ipv4ll_configure(Link *link);
|
||||
int link_serialize_ipv4ll(Link *link, FILE *f);
|
||||
int link_deserialize_ipv4ll(Link *link, const char *ipv4ll_address);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_ipv4ll);
|
||||
|
@ -3511,16 +3511,9 @@ int link_save(Link *link) {
|
||||
} else
|
||||
(void) unlink(link->lease_file);
|
||||
|
||||
if (link->ipv4ll) {
|
||||
struct in_addr address;
|
||||
|
||||
r = sd_ipv4ll_get_address(link->ipv4ll, &address);
|
||||
if (r >= 0) {
|
||||
fputs("IPV4LL_ADDRESS=", f);
|
||||
serialize_in_addrs(f, &address, 1, false, NULL);
|
||||
fputc('\n', f);
|
||||
}
|
||||
}
|
||||
r = link_serialize_ipv4ll(link, f);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
if (link->dhcp6_client) {
|
||||
_cleanup_free_ char *duid = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user