diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-17 12:35:12 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-17 12:35:12 +0100 |
commit | 7d26f540ee80736f917a9ee08419c52d503a893b (patch) | |
tree | a7426a760f4544441df07de064d84d16bb7cd180 | |
parent | c512a01853ca998ba44227f6ff02ad6cb16bd4f9 (diff) | |
parent | b20384fac772a753b493aa28ea39f211d5de6b63 (diff) | |
download | NetworkManager-7d26f540ee80736f917a9ee08419c52d503a893b.tar.gz |
platform: merge branch 'th/platform-test-netns-bgo790214'
https://bugzilla.gnome.org/show_bug.cgi?id=790214
-rw-r--r-- | src/platform/nmp-netns.c | 5 | ||||
-rw-r--r-- | src/platform/tests/test-link.c | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/platform/nmp-netns.c b/src/platform/nmp-netns.c index 34215828ce..bc305f0170 100644 --- a/src/platform/nmp-netns.c +++ b/src/platform/nmp-netns.c @@ -290,6 +290,7 @@ _netns_new (GError **error) g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "Failed opening netns: %s", g_strerror (errsv)); + errno = errsv; return NULL; } @@ -300,6 +301,7 @@ _netns_new (GError **error) "Failed opening mntns: %s", g_strerror (errsv)); nm_close (fd_net); + errno = errsv; return NULL; } @@ -479,6 +481,7 @@ nmp_netns_new (void) if (!_stack_peek ()) { /* there are no netns instances. We cannot create a new one * (because after unshare we couldn't return to the original one). */ + errno = ENOTSUP; return NULL; } @@ -508,6 +511,7 @@ nmp_netns_new (void) self = _netns_new (&error); if (!self) { + errsv = errno; _LOGE (NULL, "failed to create netns after unshare: %s", error->message); g_clear_error (&error); goto err_out; @@ -518,6 +522,7 @@ nmp_netns_new (void) return self; err_out: _netns_switch_pop (NULL, _CLONE_NS_ALL); + errno = errsv; return NULL; } diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 9c72371c33..d3a10bd68f 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -1916,6 +1916,7 @@ _test_netns_check_skip (void) static int support = -1; static int support_errsv = 0; NMPNetns *netns; + gs_unref_object NMPNetns *netns2 = NULL; netns = nmp_netns_get_current (); if (!netns) { @@ -1931,10 +1932,20 @@ _test_netns_check_skip (void) support_errsv = errno; } if (!support) { - _LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", g_strerror (support_errsv)); - g_test_skip ("No netns support (setns failed)"); + _LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", g_strerror (support_errsv)); + g_test_skip ("No netns support (setns failed)"); return TRUE; } + + netns2 = nmp_netns_new (); + if (!netns2) { + /* skip tests for https://bugzilla.gnome.org/show_bug.cgi?id=790214 */ + g_assert_cmpint (errno, ==, EINVAL); + g_test_skip ("No netns support to create another netns"); + return TRUE; + } + nmp_netns_pop (netns2); + return FALSE; } |