Lines Matching refs:link

118         Link *link;  in manager_save()  local
126 HASHMAP_FOREACH(link, m->links_by_index) { in manager_save()
129 if (link->flags & IFF_LOOPBACK) in manager_save()
132 operstate = MAX(operstate, link->operstate); in manager_save()
133 carrier_state = MAX(carrier_state, link->carrier_state); in manager_save()
134 address_state = MAX(address_state, link->address_state); in manager_save()
135 ipv4_address_state = MAX(ipv4_address_state, link->ipv4_address_state); in manager_save()
136 ipv6_address_state = MAX(ipv6_address_state, link->ipv6_address_state); in manager_save()
138 if (!link->network) in manager_save()
141 if (link->network->required_for_online) { in manager_save()
142 if (link->online_state == LINK_ONLINE_STATE_OFFLINE) in manager_save()
144 else if (link->online_state == LINK_ONLINE_STATE_ONLINE) in manager_save()
149 if (link->n_dns != UINT_MAX) in manager_save()
150 … r = ordered_set_put_dns_servers(&dns, link->ifindex, link->dns, link->n_dns); in manager_save()
152 … r = ordered_set_put_dns_servers(&dns, link->ifindex, link->network->dns, link->network->n_dns); in manager_save()
156 r = ordered_set_put_strdupv(&ntp, link->ntp ?: link->network->ntp); in manager_save()
160 …r = ordered_set_put_string_set(&search_domains, link->search_domains ?: link->network->search_doma… in manager_save()
164 …r = ordered_set_put_string_set(&route_domains, link->route_domains ?: link->network->route_domains… in manager_save()
168 if (!link->dhcp_lease) in manager_save()
172 if (link->network->dhcp_use_dns) { in manager_save()
173 r = sd_dhcp_lease_get_dns(link->dhcp_lease, &addresses); in manager_save()
182 if (link->network->dhcp_use_ntp) { in manager_save()
183 r = sd_dhcp_lease_get_ntp(link->dhcp_lease, &addresses); in manager_save()
192 if (link->network->dhcp_use_sip) { in manager_save()
193 r = sd_dhcp_lease_get_sip(link->dhcp_lease, &addresses); in manager_save()
202 if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) { in manager_save()
207 …target_domains = (link->network->dhcp_use_domains == DHCP_USE_DOMAINS_YES) ? &search_domains : &ro… in manager_save()
208 r = sd_dhcp_lease_get_domainname(link->dhcp_lease, &domainname); in manager_save()
216 r = sd_dhcp_lease_get_search_domains(link->dhcp_lease, &domains); in manager_save()
332 Link *link; in print_link_hashmap() local
341 HASHMAP_FOREACH(link, h) { in print_link_hashmap()
345 fprintf(f, "%i", link->ifindex); in print_link_hashmap()
352 static void link_save_dns(Link *link, FILE *f, struct in_addr_full **dns, unsigned n_dns, bool *spa… in link_save_dns() argument
361 if (dns[j]->ifindex != 0 && dns[j]->ifindex != link->ifindex) in link_save_dns()
426 static void link_save_domains(Link *link, FILE *f, OrderedSet *static_domains, DHCPUseDomains use_d… in link_save_domains() argument
430 assert(link); in link_save_domains()
431 assert(link->network); in link_save_domains()
440 if (link->dhcp_lease && link->network->dhcp_use_domains == use_domains) { in link_save_domains()
444 if (sd_dhcp_lease_get_domainname(link->dhcp_lease, &domainname) >= 0) in link_save_domains()
446 if (sd_dhcp_lease_get_search_domains(link->dhcp_lease, &domains) >= 0) in link_save_domains()
450 if (link->dhcp6_lease && link->network->dhcp6_use_domains == use_domains) { in link_save_domains()
453 if (sd_dhcp6_lease_get_domains(link->dhcp6_lease, &domains) >= 0) in link_save_domains()
457 if (link->network->ipv6_accept_ra_use_domains == use_domains) { in link_save_domains()
460 SET_FOREACH(dd, link->ndisc_dnssl) in link_save_domains()
465 int link_save(Link *link) { in link_save() argument
471 assert(link); in link_save()
472 assert(link->manager); in link_save()
474 if (isempty(link->state_file)) in link_save()
477 if (link->state == LINK_STATE_LINGER) in link_save()
480 link_lldp_save(link); in link_save()
482 admin_state = link_state_to_string(link->state); in link_save()
485 oper_state = link_operstate_to_string(link->operstate); in link_save()
488 carrier_state = link_carrier_state_to_string(link->carrier_state); in link_save()
491 address_state = link_address_state_to_string(link->address_state); in link_save()
494 ipv4_address_state = link_address_state_to_string(link->ipv4_address_state); in link_save()
497 ipv6_address_state = link_address_state_to_string(link->ipv6_address_state); in link_save()
500 r = fopen_temporary(link->state_file, &f, &temp_path); in link_save()
516 if (link->network) { in link_save()
520 online_state = link_online_state_to_string(link->online_state); in link_save()
525 yes_no(link->network->required_for_online)); in link_save()
527 LinkOperationalStateRange st = link->network->required_operstate_for_online; in link_save()
534 … link_required_address_family_to_string(link->network->required_family_for_online)); in link_save()
537 activation_policy_to_string(link->network->activation_policy)); in link_save()
539 fprintf(f, "NETWORK_FILE=%s\n", link->network->filename); in link_save()
544 ndisc_vacuum(link); in link_save()
547 if (link->n_dns != UINT_MAX) in link_save()
548 link_save_dns(link, f, link->dns, link->n_dns, NULL); in link_save()
551 link_save_dns(link, f, link->network->dns, link->network->n_dns, &space); in link_save()
555 link->dhcp_lease, in link_save()
556 link->network->dhcp_use_dns, in link_save()
558 link->dhcp6_lease, in link_save()
559 link->network->dhcp6_use_dns, in link_save()
563 if (link->network->ipv6_accept_ra_use_dns) { in link_save()
566 SET_FOREACH(dd, link->ndisc_rdnss) in link_save()
575 if (link->ntp) { in link_save()
577 fputstrv(f, link->ntp, NULL, NULL); in link_save()
581 link->network->ntp, in link_save()
582 link->dhcp_lease, in link_save()
583 link->network->dhcp_use_ntp, in link_save()
585 link->dhcp6_lease, in link_save()
586 link->network->dhcp6_use_ntp, in link_save()
592 link->dhcp_lease, in link_save()
593 link->network->dhcp_use_sip, in link_save()
600 if (link->search_domains) in link_save()
601 link_save_domains(link, f, link->search_domains, DHCP_USE_DOMAINS_NO); in link_save()
603 … link_save_domains(link, f, link->network->search_domains, DHCP_USE_DOMAINS_YES); in link_save()
609 if (link->route_domains) in link_save()
610 link_save_domains(link, f, link->route_domains, DHCP_USE_DOMAINS_NO); in link_save()
612 … link_save_domains(link, f, link->network->route_domains, DHCP_USE_DOMAINS_ROUTE); in link_save()
618 … resolve_support_to_string(link->llmnr >= 0 ? link->llmnr : link->network->llmnr)); in link_save()
623 … resolve_support_to_string(link->mdns >= 0 ? link->mdns : link->network->mdns)); in link_save()
628 link->dns_default_route >= 0 ? link->dns_default_route : in link_save()
629 link->network->dns_default_route; in link_save()
636link->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID ? link->dns_over_tls_mode : in link_save()
637 link->network->dns_over_tls_mode; in link_save()
644 link->dnssec_mode != _DNSSEC_MODE_INVALID ? link->dnssec_mode : in link_save()
645 link->network->dnssec_mode; in link_save()
651 Set *nta_anchors = link->dnssec_negative_trust_anchors; in link_save()
653 nta_anchors = link->network->dnssec_negative_trust_anchors; in link_save()
666 print_link_hashmap(f, "CARRIER_BOUND_TO=", link->bound_to_links); in link_save()
667 print_link_hashmap(f, "CARRIER_BOUND_BY=", link->bound_by_links); in link_save()
669 if (link->dhcp_lease) { in link_save()
670 r = dhcp_lease_save(link->dhcp_lease, link->lease_file); in link_save()
676 link->lease_file); in link_save()
678 (void) unlink(link->lease_file); in link_save()
680 r = link_serialize_dhcp6_client(link, f); in link_save()
688 r = conservative_rename(temp_path, link->state_file); in link_save()
697 void link_dirty(Link *link) { in link_dirty() argument
700 assert(link); in link_dirty()
701 assert(link->manager); in link_dirty()
706 link->manager->dirty = true; in link_dirty()
708 r = set_ensure_put(&link->manager->dirty_links, NULL, link); in link_dirty()
712 link_ref(link); in link_dirty()
715 void link_clean(Link *link) { in link_clean() argument
716 assert(link); in link_clean()
717 assert(link->manager); in link_clean()
721 link_unref(set_remove(link->manager->dirty_links, link)); in link_clean()
724 int link_save_and_clean(Link *link) { in link_save_and_clean() argument
727 r = link_save(link); in link_save_and_clean()
731 link_clean(link); in link_save_and_clean()