network: introduce network_verify_routing_policy_rules()
This commit is contained in:
@@ -150,7 +150,6 @@ static int network_resolve_stacked_netdevs(Network *network) {
|
||||
|
||||
int network_verify(Network *network) {
|
||||
RoutePrefix *route_prefix, *route_prefix_next;
|
||||
RoutingPolicyRule *rule;
|
||||
Neighbor *neighbor, *neighbor_next;
|
||||
AddressLabel *label, *label_next;
|
||||
NextHop *nexthop, *nextnop_next;
|
||||
@@ -327,9 +326,7 @@ int network_verify(Network *network) {
|
||||
if (section_is_invalid(route_prefix->section))
|
||||
route_prefix_free(route_prefix);
|
||||
|
||||
HASHMAP_FOREACH(rule, network->rules_by_section)
|
||||
if (routing_policy_rule_section_verify(rule) < 0)
|
||||
routing_policy_rule_free(rule);
|
||||
network_verify_routing_policy_rules(network);
|
||||
|
||||
bool has_root = false, has_clsact = false;
|
||||
ORDERED_HASHMAP_FOREACH(tc, network->tc_by_section)
|
||||
|
||||
@@ -1460,7 +1460,7 @@ int config_parse_routing_policy_rule_suppress_prefixlen(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int routing_policy_rule_section_verify(RoutingPolicyRule *rule) {
|
||||
static int routing_policy_rule_section_verify(RoutingPolicyRule *rule) {
|
||||
if (section_is_invalid(rule->section))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1477,6 +1477,16 @@ int routing_policy_rule_section_verify(RoutingPolicyRule *rule) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void network_verify_routing_policy_rules(Network *network) {
|
||||
RoutingPolicyRule *rule;
|
||||
|
||||
assert(network);
|
||||
|
||||
HASHMAP_FOREACH(rule, network->rules_by_section)
|
||||
if (routing_policy_rule_section_verify(rule) < 0)
|
||||
routing_policy_rule_free(rule);
|
||||
}
|
||||
|
||||
int routing_policy_serialize_rules(Set *rules, FILE *f) {
|
||||
RoutingPolicyRule *rule;
|
||||
int r;
|
||||
|
||||
@@ -50,7 +50,8 @@ typedef struct RoutingPolicyRule {
|
||||
} RoutingPolicyRule;
|
||||
|
||||
RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule);
|
||||
int routing_policy_rule_section_verify(RoutingPolicyRule *rule);
|
||||
|
||||
void network_verify_routing_policy_rules(Network *network);
|
||||
|
||||
int link_set_routing_policy_rules(Link *link);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user