diff options
-rw-r--r-- | src/network/networkd-network.c | 13 | ||||
-rw-r--r-- | src/network/networkd-radv.c | 20 | ||||
-rw-r--r-- | src/network/networkd-radv.h | 3 |
3 files changed, 25 insertions, 11 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index a89a8259a2..f77d1bae89 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -154,9 +154,7 @@ static int network_resolve_stacked_netdevs(Network *network) { } int network_verify(Network *network) { - RoutePrefix *route_prefix; Address *address, *address_next; - Prefix *prefix; Route *route, *route_next; TrafficControl *tc; SRIOV *sr_iov; @@ -308,15 +306,8 @@ int network_verify(Network *network) { network_verify_mdb_entries(network); network_verify_neighbors(network); network_verify_address_labels(network); - - HASHMAP_FOREACH(prefix, network->prefixes_by_section) - if (section_is_invalid(prefix->section)) - prefix_free(prefix); - - HASHMAP_FOREACH(route_prefix, network->route_prefixes_by_section) - if (section_is_invalid(route_prefix->section)) - route_prefix_free(route_prefix); - + network_verify_prefixes(network); + network_verify_route_prefixes(network); network_verify_routing_policy_rules(network); bool has_root = false, has_clsact = false; diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index f5e1926afb..9762b3a5e7 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -162,6 +162,26 @@ static int route_prefix_new_static(Network *network, const char *filename, return 0; } +void network_verify_prefixes(Network *network) { + Prefix *prefix; + + assert(network); + + HASHMAP_FOREACH(prefix, network->prefixes_by_section) + if (section_is_invalid(prefix->section)) + prefix_free(prefix); +} + +void network_verify_route_prefixes(Network *network) { + RoutePrefix *prefix; + + assert(network); + + HASHMAP_FOREACH(prefix, network->route_prefixes_by_section) + if (section_is_invalid(prefix->section)) + route_prefix_free(prefix); +} + int config_parse_prefix(const char *unit, const char *filename, unsigned line, diff --git a/src/network/networkd-radv.h b/src/network/networkd-radv.h index 6fe1c947ba..d549be5f8e 100644 --- a/src/network/networkd-radv.h +++ b/src/network/networkd-radv.h @@ -41,6 +41,9 @@ struct RoutePrefix { Prefix *prefix_free(Prefix *prefix); RoutePrefix *route_prefix_free(RoutePrefix *prefix); +void network_verify_prefixes(Network *network); +void network_verify_route_prefixes(Network *network); + int radv_emit_dns(Link *link); int radv_configure(Link *link); int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len, |