test-network.c revision e1ea665edac17d75fce01b72dadfa3211b60df2c
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/***
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen This file is part of systemd.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Copyright 2013 Tom Gundersen <teg@jklm.no>
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is free software; you can redistribute it and/or modify it
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen under the terms of the GNU Lesser General Public License as published by
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen (at your option) any later version.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is distributed in the hope that it will be useful, but
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Lesser General Public License for more details.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen You should have received a copy of the GNU Lesser General Public License
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen***/
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen#include "networkd.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "network-internal.h"
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich#include "dhcp-lease-internal.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersenstatic void test_deserialize_in_addr(void) {
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen _cleanup_free_ struct in_addr *addresses = NULL;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen _cleanup_free_ struct in6_addr *addresses6 = NULL;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen struct in_addr a, b, c;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen struct in6_addr d, e, f;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen size_t size;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen const char *addresses_string = "192.168.0.1 0:0:0:0:0:FFFF:204.152.189.116 192.168.0.2 ::1 192.168.0.3 1:0:0:0:0:0:0:8";
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET, "0:0:0:0:0:FFFF:204.152.189.116", &a) == 0);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET6, "192.168.0.1", &d) == 0);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET, "192.168.0.1", &a) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET, "192.168.0.2", &b) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET, "192.168.0.3", &c) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET6, "0:0:0:0:0:FFFF:204.152.189.116", &d) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET6, "::1", &e) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(inet_pton(AF_INET6, "1:0:0:0:0:0:0:8", &f) == 1);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(deserialize_in_addrs(&addresses, &size, addresses_string) >= 0);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(size == 3);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&a, &addresses[0], sizeof(struct in_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&b, &addresses[1], sizeof(struct in_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&c, &addresses[2], sizeof(struct in_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(deserialize_in6_addrs(&addresses6, &size, addresses_string) >= 0);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(size == 3);
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&d, &addresses6[0], sizeof(struct in6_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&e, &addresses6[1], sizeof(struct in6_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen assert_se(!memcmp(&f, &addresses6[2], sizeof(struct in6_addr)));
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen}
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovichstatic void test_deserialize_dhcp_routes(void) {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich size_t size, allocated;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _cleanup_free_ struct sd_dhcp_route *routes = NULL;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(deserialize_dhcp_routes(&routes, &size, &allocated, "") >= 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(size == 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich }
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich /* no errors */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _cleanup_free_ struct sd_dhcp_route *routes = NULL;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich const char *routes_string = "192.168.0.0/16,192.168.0.1 10.1.2.0/24,10.1.2.1 0.0.0.0/0,10.0.1.1";
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(deserialize_dhcp_routes(&routes, &size, &allocated, routes_string) >= 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(size == 3);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].dst_addr.s_addr == inet_addr("192.168.0.0"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].gw_addr.s_addr == inet_addr("192.168.0.1"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].dst_prefixlen == 16);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[1].dst_addr.s_addr == inet_addr("10.1.2.0"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[1].gw_addr.s_addr == inet_addr("10.1.2.1"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[1].dst_prefixlen == 24);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].dst_addr.s_addr == inet_addr("0.0.0.0"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].gw_addr.s_addr == inet_addr("10.0.1.1"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].dst_prefixlen == 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich }
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich /* error in second word */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _cleanup_free_ struct sd_dhcp_route *routes = NULL;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich const char *routes_string = "192.168.0.0/16,192.168.0.1 10.1.2.0#24,10.1.2.1 0.0.0.0/0,10.0.1.1";
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(deserialize_dhcp_routes(&routes, &size, &allocated, routes_string) >= 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(size == 2);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].dst_addr.s_addr == inet_addr("192.168.0.0"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].gw_addr.s_addr == inet_addr("192.168.0.1"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[0].dst_prefixlen == 16);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].dst_addr.s_addr == inet_addr("0.0.0.0"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].gw_addr.s_addr == inet_addr("10.0.1.1"));
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(routes[2].dst_prefixlen == 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich }
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich /* error in every word */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _cleanup_free_ struct sd_dhcp_route *routes = NULL;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich const char *routes_string = "192.168.0.0/55,192.168.0.1 10.1.2.0#24,10.1.2.1 0.0.0.0/0,10.0.1.X";
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(deserialize_dhcp_routes(&routes, &size, &allocated, routes_string) >= 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich assert_se(size == 0);
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich }
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich}
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
02b59d57e0c08231645120077f651151f5bb2babTom Gundersenstatic void test_load_config(Manager *manager) {
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen/* TODO: should_reload, is false if the config dirs do not exist, so
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen * so we can't do this test here, move it to a test for paths_check_timestamps
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen * directly
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen *
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen * assert_se(network_should_reload(manager) == true);
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen*/
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(manager_load_config(manager) >= 0);
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(manager_should_reload(manager) == false);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen}
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenstatic void test_network_get(Manager *manager, struct udev_device *loopback) {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Network *network;
505f8da7325591defe5f751f328bd26915267602Tom Gundersen const struct ether_addr mac = {};
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen /* let's assume that the test machine does not have a .network file
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen that applies to the loopback device... */
505f8da7325591defe5f751f328bd26915267602Tom Gundersen assert_se(network_get(manager, loopback, "lo", &mac, &network) == -ENOENT);
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(!network);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen}
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersenstatic void test_address_equality(void) {
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen _cleanup_address_free_ Address *a1 = NULL, *a2 = NULL;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_new_dynamic(&a1) >= 0);
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_new_dynamic(&a2) >= 0);
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(NULL, NULL));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, NULL));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(NULL, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a1->family = AF_INET;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a2->family = AF_INET;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET, "192.168.3.9", &a1->in_addr.in));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET, "192.168.3.9", &a2->in_addr.in));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a1->prefixlen = 10;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a2->prefixlen = 10;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET, "192.168.3.10", &a2->in_addr.in));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a1->family = AF_INET6;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a2->family = AF_INET6;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET6, "2001:4ca0:4f01::2", &a1->in_addr.in6));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET6, "2001:4ca0:4f01::2", &a2->in_addr.in6));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen a2->prefixlen = 8;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(inet_pton(AF_INET6, "2001:4ca0:4f01::1", &a2->in_addr.in6));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen assert_se(!address_equal(a1, a2));
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen}
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenint main(void) {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen _cleanup_manager_free_ Manager *manager = NULL;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct udev *udev;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct udev_device *loopback;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen test_deserialize_in_addr();
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich test_deserialize_dhcp_routes();
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen test_address_equality();
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(manager_new(&manager) >= 0);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
02b59d57e0c08231645120077f651151f5bb2babTom Gundersen test_load_config(manager);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen udev = udev_new();
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(udev);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen loopback = udev_device_new_from_syspath(udev, "/sys/class/net/lo");
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(loopback);
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(udev_device_get_ifindex(loopback) == 1);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen test_network_get(manager, loopback);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(manager_udev_listen(manager) >= 0);
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen assert_se(manager_rtnl_listen(manager) >= 0);
505f8da7325591defe5f751f328bd26915267602Tom Gundersen assert_se(manager_rtnl_enumerate_links(manager) >= 0);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen udev_device_unref(loopback);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen udev_unref(udev);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen}