Lines Matching refs:network

25 void network_adjust_radv(Network *network) {  in network_adjust_radv()  argument
26 assert(network); in network_adjust_radv()
30 if (network->dhcp_pd < 0) in network_adjust_radv()
32network->dhcp_pd = FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_DHCP6); in network_adjust_radv()
34 if (!FLAGS_SET(network->link_local, ADDRESS_FAMILY_IPV6)) { in network_adjust_radv()
35 if (network->router_prefix_delegation != RADV_PREFIX_DELEGATION_NONE) in network_adjust_radv()
37 "Disabling IPv6PrefixDelegation=.", network->filename); in network_adjust_radv()
39 network->router_prefix_delegation = RADV_PREFIX_DELEGATION_NONE; in network_adjust_radv()
42 if (network->router_prefix_delegation == RADV_PREFIX_DELEGATION_NONE) { in network_adjust_radv()
43 network->n_router_dns = 0; in network_adjust_radv()
44 network->router_dns = mfree(network->router_dns); in network_adjust_radv()
45 network->router_search_domains = ordered_set_free(network->router_search_domains); in network_adjust_radv()
48 if (!FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_STATIC)) { in network_adjust_radv()
49network->prefixes_by_section = hashmap_free_with_destructor(network->prefixes_by_section, prefix_f… in network_adjust_radv()
50network->route_prefixes_by_section = hashmap_free_with_destructor(network->route_prefixes_by_secti… in network_adjust_radv()
63 return link->network->router_prefix_delegation; in link_radv_enabled()
70 if (prefix->network) { in prefix_free()
72 hashmap_remove(prefix->network->prefixes_by_section, prefix->section); in prefix_free()
83 static int prefix_new_static(Network *network, const char *filename, unsigned section_line, Prefix … in prefix_new_static() argument
88 assert(network); in prefix_new_static()
97 prefix = hashmap_get(network->prefixes_by_section, n); in prefix_new_static()
108 .network = network, in prefix_new_static()
117 …r = hashmap_ensure_put(&network->prefixes_by_section, &config_section_hash_ops, prefix->section, p… in prefix_new_static()
129 if (prefix->network) { in route_prefix_free()
131 hashmap_remove(prefix->network->route_prefixes_by_section, prefix->section); in route_prefix_free()
141 static int route_prefix_new_static(Network *network, const char *filename, unsigned section_line, R… in route_prefix_new_static() argument
146 assert(network); in route_prefix_new_static()
155 prefix = hashmap_get(network->route_prefixes_by_section, n); in route_prefix_new_static()
166 .network = network, in route_prefix_new_static()
172 …r = hashmap_ensure_put(&network->route_prefixes_by_section, &config_section_hash_ops, prefix->sect… in route_prefix_new_static()
189 HASHMAP_FOREACH(p, link->network->prefixes_by_section) { in link_request_radv_addresses()
297 static int network_get_ipv6_dns(Network *network, struct in6_addr **ret_addresses, size_t *ret_size… in network_get_ipv6_dns() argument
301 assert(network); in network_get_ipv6_dns()
305 for (size_t i = 0; i < network->n_dns; i++) { in network_get_ipv6_dns()
308 if (network->dns[i]->family != AF_INET6) in network_get_ipv6_dns()
311 addr = &network->dns[i]->address; in network_get_ipv6_dns()
335 if (!link->network->router_emit_dns) in radv_set_dns()
338 if (link->network->router_dns) { in radv_set_dns()
341 dns = new(struct in6_addr, link->network->n_router_dns); in radv_set_dns()
346 for (size_t i = 0; i < link->network->n_router_dns; i++) in radv_set_dns()
347 if (in6_addr_is_null(&link->network->router_dns[i])) { in radv_set_dns()
351 *(p++) = link->network->router_dns[i]; in radv_set_dns()
358 r = network_get_ipv6_dns(link->network, &dns, &n_dns); in radv_set_dns()
363 assert(uplink->network); in radv_set_dns()
365 r = network_get_ipv6_dns(uplink->network, &dns, &n_dns); in radv_set_dns()
374 usec_to_lifetime(link->network->router_dns_lifetime_usec), in radv_set_dns()
382 if (!link->network->router_emit_domains) in radv_set_domains()
385 search_domains = link->network->router_search_domains; in radv_set_domains()
390 search_domains = link->network->search_domains; in radv_set_domains()
395 assert(uplink->network); in radv_set_domains()
397 search_domains = uplink->network->search_domains; in radv_set_domains()
410 usec_to_lifetime(link->network->router_dns_lifetime_usec), in radv_set_domains()
420 if (link->network->router_uplink_name) in radv_find_uplink()
421 return link_get_by_name(link->manager, link->network->router_uplink_name, ret); in radv_find_uplink()
423 if (link->network->router_uplink_index > 0) in radv_find_uplink()
424 return link_get_by_index(link->manager, link->network->router_uplink_index, ret); in radv_find_uplink()
426 if (link->network->router_uplink_index == UPLINK_INDEX_AUTO) { in radv_find_uplink()
448 assert(link->network); in radv_configure()
469 r = sd_radv_set_managed_information(link->radv, link->network->router_managed); in radv_configure()
473 r = sd_radv_set_other_information(link->radv, link->network->router_other_information); in radv_configure()
477 r = sd_radv_set_router_lifetime(link->radv, link->network->router_lifetime_usec); in radv_configure()
481 if (link->network->router_lifetime_usec > 0) { in radv_configure()
482 r = sd_radv_set_preference(link->radv, link->network->router_preference); in radv_configure()
487 HASHMAP_FOREACH(p, link->network->prefixes_by_section) { in radv_configure()
493 HASHMAP_FOREACH(q, link->network->route_prefixes_by_section) { in radv_configure()
545 assert(link->network); in radv_is_ready_to_configure()
556 if (link->network->router_emit_dns && !link->network->router_dns) { in radv_is_ready_to_configure()
560 r = network_get_ipv6_dns(link->network, &dns, &n_dns); in radv_is_ready_to_configure()
567 if (link->network->router_emit_domains && in radv_is_ready_to_configure()
568 !link->network->router_search_domains && in radv_is_ready_to_configure()
569 !link->network->search_domains) in radv_is_ready_to_configure()
578 if (uplink && !uplink->network) in radv_is_ready_to_configure()
632 assert(link->network); in radv_start()
646 if (link->network->dhcp_pd_announce) { in radv_start()
745 void network_drop_invalid_prefixes(Network *network) { in network_drop_invalid_prefixes() argument
748 assert(network); in network_drop_invalid_prefixes()
750 HASHMAP_FOREACH(p, network->prefixes_by_section) in network_drop_invalid_prefixes()
774 void network_drop_invalid_route_prefixes(Network *network) { in network_drop_invalid_route_prefixes() argument
777 assert(network); in network_drop_invalid_route_prefixes()
779 HASHMAP_FOREACH(p, network->route_prefixes_by_section) in network_drop_invalid_route_prefixes()
797 Network *network = userdata; in config_parse_prefix() local
807 r = prefix_new_static(network, filename, section_line, &p); in config_parse_prefix()
838 Network *network = userdata; in config_parse_prefix_boolean() local
847 r = prefix_new_static(network, filename, section_line, &p); in config_parse_prefix_boolean()
884 Network *network = userdata; in config_parse_prefix_lifetime() local
894 r = prefix_new_static(network, filename, section_line, &p); in config_parse_prefix_lifetime()
935 Network *network = userdata; in config_parse_prefix_metric() local
944 r = prefix_new_static(network, filename, section_line, &p); in config_parse_prefix_metric()
973 Network *network = userdata; in config_parse_prefix_token() local
982 r = prefix_new_static(network, filename, section_line, &p); in config_parse_prefix_token()
1008 Network *network = userdata; in config_parse_route_prefix() local
1018 r = route_prefix_new_static(network, filename, section_line, &p); in config_parse_route_prefix()
1049 Network *network = userdata; in config_parse_route_prefix_lifetime() local
1059 r = route_prefix_new_static(network, filename, section_line, &p); in config_parse_route_prefix_lifetime()
1328 Network *network = userdata; in config_parse_router_preference() local
1337 network->router_preference = SD_NDISC_PREFERENCE_HIGH; in config_parse_router_preference()
1339 network->router_preference = SD_NDISC_PREFERENCE_MEDIUM; in config_parse_router_preference()
1341 network->router_preference = SD_NDISC_PREFERENCE_LOW; in config_parse_router_preference()