diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-09-29 19:09:28 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-06 19:44:42 +0200 |
commit | e6ad630d774054d93648be5e618bd0bfab2e6720 (patch) | |
tree | de738354340f3959d82ff12dda4b14dc60731d8f /src | |
parent | network: move link_set_bridge_fdb() (diff) | |
download | systemd-e6ad630d774054d93648be5e618bd0bfab2e6720.tar.xz systemd-e6ad630d774054d93648be5e618bd0bfab2e6720.zip |
network: introduce network_verify_fdb_entries()
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-fdb.c | 10 | ||||
-rw-r--r-- | src/network/networkd-fdb.h | 2 | ||||
-rw-r--r-- | src/network/networkd-network.c | 6 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c index 792e02a066..05fd07c374 100644 --- a/src/network/networkd-fdb.c +++ b/src/network/networkd-fdb.c @@ -195,6 +195,16 @@ int link_set_bridge_fdb(Link *link) { return 0; } +void network_verify_fdb_entries(Network *network) { + FdbEntry *fdb_entry; + + assert(network); + + HASHMAP_FOREACH(fdb_entry, network->fdb_entries_by_section) + if (section_is_invalid(fdb_entry->section)) + fdb_entry_free(fdb_entry); +} + /* parse the HW address from config files. */ int config_parse_fdb_hwaddr( const char *unit, diff --git a/src/network/networkd-fdb.h b/src/network/networkd-fdb.h index faddcf604e..39e016e867 100644 --- a/src/network/networkd-fdb.h +++ b/src/network/networkd-fdb.h @@ -43,6 +43,8 @@ struct FdbEntry { FdbEntry *fdb_entry_free(FdbEntry *fdb_entry); +void network_verify_fdb_entries(Network *network); + int link_set_bridge_fdb(Link *link); const char* fdb_ntf_flags_to_string(NeighborCacheEntryFlags i) _const_; diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 149c3cf2d3..a8c32b9628 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -156,7 +156,6 @@ int network_verify(Network *network) { Address *address, *address_next; Prefix *prefix, *prefix_next; Route *route, *route_next; - FdbEntry *fdb; MdbEntry *mdb, *mdb_next; TrafficControl *tc; SRIOV *sr_iov; @@ -299,10 +298,7 @@ int network_verify(Network *network) { route_free(route); network_verify_nexthops(network); - - HASHMAP_FOREACH(fdb, network->fdb_entries_by_section) - if (section_is_invalid(fdb->section)) - fdb_entry_free(fdb); + network_verify_fdb_entries(network); LIST_FOREACH_SAFE(static_mdb_entries, mdb, mdb_next, network->static_mdb_entries) if (mdb_entry_verify(mdb) < 0) |