diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index e93e524c3f..e02b7e9586 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -156,8 +156,6 @@ static int network_resolve_stacked_netdevs(Network *network) { } int network_verify(Network *network) { - SRIOV *sr_iov; - assert(network); assert(network->filename); @@ -300,10 +298,7 @@ int network_verify(Network *network) { network_verify_route_prefixes(network); network_verify_routing_policy_rules(network); network_verify_traffic_control(network); - - ORDERED_HASHMAP_FOREACH(sr_iov, network->sr_iov_by_section) - if (sr_iov_section_verify(sr_iov) < 0) - sr_iov_free(sr_iov); + network_verify_sr_iov(network); return 0; } diff --git a/src/network/networkd-sriov.c b/src/network/networkd-sriov.c index 6c96ca39d2..d2a389d95d 100644 --- a/src/network/networkd-sriov.c +++ b/src/network/networkd-sriov.c @@ -247,7 +247,7 @@ int link_configure_sr_iov(Link *link) { return 0; } -int sr_iov_section_verify(SRIOV *sr_iov) { +static int sr_iov_section_verify(SRIOV *sr_iov) { assert(sr_iov); if (section_is_invalid(sr_iov->section)) @@ -262,6 +262,16 @@ int sr_iov_section_verify(SRIOV *sr_iov) { return 0; } +void network_verify_sr_iov(Network *network) { + SRIOV *sr_iov; + + assert(network); + + ORDERED_HASHMAP_FOREACH(sr_iov, network->sr_iov_by_section) + if (sr_iov_section_verify(sr_iov) < 0) + sr_iov_free(sr_iov); +} + int config_parse_sr_iov_uint32( const char *unit, const char *filename, diff --git a/src/network/networkd-sriov.h b/src/network/networkd-sriov.h index b32a64e827..acd9f9b753 100644 --- a/src/network/networkd-sriov.h +++ b/src/network/networkd-sriov.h @@ -35,7 +35,7 @@ typedef struct SRIOV { SRIOV *sr_iov_free(SRIOV *sr_iov); int link_configure_sr_iov(Link *link); -int sr_iov_section_verify(SRIOV *sr_iov); +void network_verify_sr_iov(Network *network); DEFINE_NETWORK_SECTION_FUNCTIONS(SRIOV, sr_iov_free);