mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
network: introduce network_verify_nexthops()
This commit is contained in:
parent
f96f4ebc85
commit
0992f9fb0e
@ -153,7 +153,6 @@ int network_verify(Network *network) {
|
||||
RoutePrefix *route_prefix, *route_prefix_next;
|
||||
Neighbor *neighbor, *neighbor_next;
|
||||
AddressLabel *label, *label_next;
|
||||
NextHop *nexthop;
|
||||
Address *address, *address_next;
|
||||
Prefix *prefix, *prefix_next;
|
||||
Route *route, *route_next;
|
||||
@ -299,9 +298,7 @@ int network_verify(Network *network) {
|
||||
if (route_section_verify(route, network) < 0)
|
||||
route_free(route);
|
||||
|
||||
HASHMAP_FOREACH(nexthop, network->nexthops_by_section)
|
||||
if (nexthop_section_verify(nexthop) < 0)
|
||||
nexthop_free(nexthop);
|
||||
network_verify_nexthops(network);
|
||||
|
||||
LIST_FOREACH_SAFE(static_fdb_entries, fdb, fdb_next, network->static_fdb_entries)
|
||||
if (section_is_invalid(fdb->section))
|
||||
|
@ -439,7 +439,7 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int nexthop_section_verify(NextHop *nh) {
|
||||
static int nexthop_section_verify(NextHop *nh) {
|
||||
if (section_is_invalid(nh->section))
|
||||
return -EINVAL;
|
||||
|
||||
@ -449,6 +449,16 @@ int nexthop_section_verify(NextHop *nh) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void network_verify_nexthops(Network *network) {
|
||||
NextHop *nh;
|
||||
|
||||
assert(network);
|
||||
|
||||
HASHMAP_FOREACH(nh, network->nexthops_by_section)
|
||||
if (nexthop_section_verify(nh) < 0)
|
||||
nexthop_free(nh);
|
||||
}
|
||||
|
||||
int config_parse_nexthop_id(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
@ -30,7 +30,8 @@ typedef struct NextHop {
|
||||
} NextHop;
|
||||
|
||||
NextHop *nexthop_free(NextHop *nexthop);
|
||||
int nexthop_section_verify(NextHop *nexthop);
|
||||
|
||||
void network_verify_nexthops(Network *network);
|
||||
|
||||
int link_set_nexthop(Link *link);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user