summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-12-02 09:27:11 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2015-12-02 09:27:11 +0100
commite7185b32d6f61b1842392885ff4efb1dc84b5c52 (patch)
treec048775133d38581def93c5f6982d73339749994
parent193bf9291831729f0f75e018104423ffa4e5f8aa (diff)
downloadNetworkManager-bg/ip-tunnel-tests-fix.tar.gz
platform/tests: adding missing checks for loaded modulesbg/ip-tunnel-tests-fix
Check if 'ipip' and 'ip6_tunnel' modules are loaded when trying to perform link tests that require them and skip the tests if the modules are not available. Fixes: 133724d95805142e29c6d34a7bc201368e7a9d05 Fixes: 1a3448b43bb122243b7f9730e2ed7d62ab0a4c1e
-rw-r--r--src/platform/tests/test-link.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c
index 047dfe1cf7..6655259bb9 100644
--- a/src/platform/tests/test-link.c
+++ b/src/platform/tests/test-link.c
@@ -692,6 +692,12 @@ test_software_detect (gconstpointer user_data)
}
case NM_LINK_TYPE_IPIP: {
NMPlatformLnkIpIp lnk_ipip = { };
+ gboolean gracefully_skip = FALSE;
+
+ if (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "tunl0")) {
+ /* Seems that the ipip module is not loaded... try to load it. */
+ gracefully_skip = nm_utils_modprobe (NULL, TRUE, "ipip", NULL) != 0;
+ }
inet_pton (AF_INET, "1.2.3.4", &lnk_ipip.local);
inet_pton (AF_INET, "5.6.7.8", &lnk_ipip.remote);
@@ -699,12 +705,23 @@ test_software_detect (gconstpointer user_data)
lnk_ipip.tos = 32;
lnk_ipip.path_mtu_discovery = FALSE;
- if (!nmtstp_link_ipip_add (EX, DEVICE_NAME, &lnk_ipip))
+ if (!nmtstp_link_ipip_add (EX, DEVICE_NAME, &lnk_ipip)) {
+ if (gracefully_skip) {
+ g_test_skip ("Cannot create ipip tunnel because of missing ipip module (modprobe ipip)");
+ goto out_delete_parent;
+ }
g_error ("Failed adding IPIP tunnel");
+ }
break;
}
case NM_LINK_TYPE_IP6TNL: {
NMPlatformLnkIp6Tnl lnk_ip6tnl = { };
+ gboolean gracefully_skip = FALSE;
+
+ if (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "ip6tnl0")) {
+ /* Seems that the ip6_tunnel module is not loaded... try to load it. */
+ gracefully_skip = nm_utils_modprobe (NULL, TRUE, "ip6_tunnel", NULL) != 0;
+ }
inet_pton (AF_INET6, "fd01::15", &lnk_ip6tnl.local);
inet_pton (AF_INET6, "fd01::16", &lnk_ip6tnl.remote);
@@ -714,8 +731,13 @@ test_software_detect (gconstpointer user_data)
lnk_ip6tnl.flow_label = 1337;
lnk_ip6tnl.proto = IPPROTO_IPV6;
- if (!nmtstp_link_ip6tnl_add (EX, DEVICE_NAME, &lnk_ip6tnl))
- g_error ("Failed adding IPv6 tunnel");
+ if (!nmtstp_link_ip6tnl_add (EX, DEVICE_NAME, &lnk_ip6tnl)) {
+ if (gracefully_skip) {
+ g_test_skip ("Cannot create ip6tnl tunnel because of missing ip6_tunnel module (modprobe ip6_tunnel)");
+ goto out_delete_parent;
+ }
+ g_error ("Failed adding IP6TNL tunnel");
+ }
break;
}
case NM_LINK_TYPE_MACVLAN: