diff options
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r-- | src/network/networkd-link.c | 72 |
1 files changed, 7 insertions, 65 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index be5c58087e..06a467d15b 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2125,11 +2125,7 @@ static int link_append_to_master(Link *link, NetDev *netdev) { if (r < 0) return r; - r = set_ensure_allocated(&master->slaves, NULL); - if (r < 0) - return r; - - r = set_put(master->slaves, link); + r = set_ensure_put(&master->slaves, NULL, link); if (r <= 0) return r; @@ -3133,12 +3129,12 @@ static int link_configure_duid(Link *link) { r = set_put(m->links_requesting_uuid, link); if (r < 0) return log_oom(); + if (r > 0) + link_ref(link); r = set_put(m->duids_requesting_uuid, duid); if (r < 0) return log_oom(); - - link_ref(link); } return 0; @@ -4196,32 +4192,11 @@ int link_save(Link *link) { sd_dhcp6_lease_get_ntp_fqdn); serialize_addresses(f, "SIP", NULL, - link->network->sip, + NULL, link->dhcp_lease, link->network->dhcp_use_sip, SD_DHCP_LEASE_SIP, - false, NULL, NULL, NULL); - - serialize_addresses(f, "POP3", NULL, - link->network->pop3, - link->dhcp_lease, - true, - SD_DHCP_LEASE_POP3, - false, NULL, NULL, NULL); - - serialize_addresses(f, "SMTP", NULL, - link->network->smtp, - link->dhcp_lease, - true, - SD_DHCP_LEASE_SMTP, - false, NULL, NULL, NULL); - - serialize_addresses(f, "LPR", NULL, - link->network->lpr, - link->dhcp_lease, - true, - SD_DHCP_LEASE_LPR, - false, NULL, NULL, NULL); + NULL, false, NULL, NULL); /************************************************************/ @@ -4372,33 +4347,6 @@ int link_save(Link *link) { print_link_hashmap(f, "CARRIER_BOUND_BY=", link->bound_by_links); if (link->dhcp_lease) { - struct in_addr address; - const char *tz = NULL; - size_t client_id_len; - const void *client_id; - - assert(link->network); - - r = sd_dhcp_lease_get_timezone(link->dhcp_lease, &tz); - if (r >= 0) - fprintf(f, "TIMEZONE=%s\n", tz); - - r = sd_dhcp_lease_get_address(link->dhcp_lease, &address); - if (r >= 0) { - fputs("DHCP4_ADDRESS=", f); - serialize_in_addrs(f, &address, 1, NULL, NULL); - 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; @@ -4461,16 +4409,10 @@ void link_dirty(Link *link) { /* mark manager dirty as link is dirty */ manager_dirty(link->manager); - r = set_ensure_allocated(&link->manager->dirty_links, NULL); - if (r < 0) - /* allocation errors are ignored */ - return; - - r = set_put(link->manager->dirty_links, link); + r = set_ensure_put(&link->manager->dirty_links, NULL, link); if (r <= 0) - /* don't take another ref if the link was already dirty */ + /* Ignore allocation errors and don't take another ref if the link was already dirty */ return; - link_ref(link); } |