1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-25 10:04:04 +03:00

network: introduce network_verify_prefix() and network_verify_route_prefix()

This commit is contained in:
Yu Watanabe 2020-09-30 06:01:09 +09:00
parent d30081c24e
commit 1a7deb2fcf
3 changed files with 25 additions and 11 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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,