1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

network: introduce network_verify_address_labels()

This commit is contained in:
Yu Watanabe 2020-09-30 01:28:35 +09:00
parent cae418a306
commit ab316813ea
3 changed files with 13 additions and 5 deletions

View File

@ -136,6 +136,16 @@ int address_label_configure(
return 0;
}
void network_verify_address_labels(Network *network) {
AddressLabel *label;
assert(network);
HASHMAP_FOREACH(label, network->address_labels_by_section)
if (section_is_invalid(label->section))
address_label_free(label);
}
int config_parse_address_label_prefix(const char *unit,
const char *filename,
unsigned line,

View File

@ -31,6 +31,8 @@ AddressLabel *address_label_free(AddressLabel *label);
DEFINE_NETWORK_SECTION_FUNCTIONS(AddressLabel, address_label_free);
void network_verify_address_labels(Network *network);
int address_label_configure(AddressLabel *address, Link *link, link_netlink_message_handler_t callback, bool update);
CONFIG_PARSER_PROTOTYPE(config_parse_address_label);

View File

@ -152,7 +152,6 @@ static int network_resolve_stacked_netdevs(Network *network) {
int network_verify(Network *network) {
RoutePrefix *route_prefix, *route_prefix_next;
AddressLabel *label;
Address *address, *address_next;
Prefix *prefix, *prefix_next;
Route *route, *route_next;
@ -309,10 +308,7 @@ int network_verify(Network *network) {
mdb_entry_free(mdb);
network_verify_neighbors(network);
HASHMAP_FOREACH(label, network->address_labels_by_section)
if (section_is_invalid(label->section))
address_label_free(label);
network_verify_address_labels(network);
LIST_FOREACH_SAFE(prefixes, prefix, prefix_next, network->static_prefixes)
if (section_is_invalid(prefix->section))