mirror of
https://github.com/systemd/systemd.git
synced 2024-11-04 13:51:24 +03:00
test: make network_verify() public and use it in test-networkd-conf
This commit is contained in:
parent
fcbf4cb727
commit
96db641250
@ -70,14 +70,15 @@ static int network_resolve_netdev_one(Network *network, const char *name, NetDev
|
||||
NetDev *netdev;
|
||||
int r;
|
||||
|
||||
/* For test-networkd-conf, the check must be earlier than the assertions. */
|
||||
if (!name)
|
||||
return 0;
|
||||
|
||||
assert(network);
|
||||
assert(network->manager);
|
||||
assert(network->filename);
|
||||
assert(ret_netdev);
|
||||
|
||||
if (!name)
|
||||
return 0;
|
||||
|
||||
if (kind == _NETDEV_KIND_TUNNEL)
|
||||
kind_string = "tunnel";
|
||||
else {
|
||||
@ -159,7 +160,7 @@ static uint32_t network_get_stacked_netdevs_mtu(Network *network) {
|
||||
return mtu;
|
||||
}
|
||||
|
||||
static int network_verify(Network *network) {
|
||||
int network_verify(Network *network) {
|
||||
Address *address, *address_next;
|
||||
Route *route, *route_next;
|
||||
FdbEntry *fdb, *fdb_next;
|
||||
|
@ -285,6 +285,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Network*, network_free);
|
||||
|
||||
int network_load(Manager *manager);
|
||||
int network_load_one(Manager *manager, const char *filename);
|
||||
int network_verify(Network *network);
|
||||
|
||||
int network_get_by_name(Manager *manager, const char *name, Network **ret);
|
||||
int network_get(Manager *manager, sd_device *device, const char *ifname, const struct ether_addr *mac, Network **ret);
|
||||
|
@ -172,8 +172,11 @@ static void test_config_parse_address_one(const char *rvalue, int family, unsign
|
||||
_cleanup_(network_freep) Network *network = NULL;
|
||||
|
||||
assert_se(network = new0(Network, 1));
|
||||
assert_se(network->filename = strdup("hogehoge.network"));
|
||||
assert_se(config_parse_address("network", "filename", 1, "section", 1, "Address", 0, rvalue, network, network) == 0);
|
||||
assert_se(network->n_static_addresses == 1);
|
||||
assert_se(network_verify(network) >= 0);
|
||||
assert_se(network->n_static_addresses == n_addresses);
|
||||
if (n_addresses > 0) {
|
||||
assert_se(network->static_addresses);
|
||||
assert_se(network->static_addresses->prefixlen == prefixlen);
|
||||
|
Loading…
Reference in New Issue
Block a user