mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-07 18:00:30 +01:00
platform/tests: add test for missing netlink notification for IFA_LINK_NETNSID
The related bug rh#1262908 in kernel causes missing netlink notifications when moving a IFA_LINK interface to another netns. Add a test for our workaround. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1262908
This commit is contained in:
parent
5650c82a8e
commit
29c293728d
2 changed files with 30 additions and 2 deletions
|
|
@ -2738,7 +2738,8 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
|
|||
|
||||
/* removal of a link could be caused by moving the link to another netns.
|
||||
* In this case, we potentially have to update other links that have this link as parent.
|
||||
* Currently, kernel misses to sent us a notification in this case (rh #1262908). */
|
||||
* Currently, kernel misses to sent us a notification in this case
|
||||
* (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */
|
||||
|
||||
if ( ops_type == NMP_CACHE_OPS_REMOVED
|
||||
&& old /* <-- nonsensical, make coverity happy */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
#include "nmp-object.h"
|
||||
|
||||
#include "test-common.h"
|
||||
|
|
@ -1379,6 +1381,8 @@ test_nl_bugs_veth (void)
|
|||
int ifindex_veth0, ifindex_veth1;
|
||||
int i;
|
||||
const NMPlatformLink *pllink_veth0, *pllink_veth1;
|
||||
gs_free_error GError *error = NULL;
|
||||
NMTstpNamespaceHandle *ns_handle = NULL;
|
||||
|
||||
/* create veth pair. */
|
||||
nmtstp_run_command_check ("ip link add dev %s type veth peer name %s", IFACE_VETH0, IFACE_VETH1);
|
||||
|
|
@ -1409,9 +1413,32 @@ test_nl_bugs_veth (void)
|
|||
g_assert (pllink_veth1);
|
||||
g_assert_cmpint (pllink_veth1->parent, ==, ifindex_veth0);
|
||||
|
||||
|
||||
/* move one veth peer to another namespace and check that the
|
||||
* parent/IFLA_LINK of the remaining peer properly updates
|
||||
* (https://bugzilla.redhat.com/show_bug.cgi?id=1262908). */
|
||||
ns_handle = nmtstp_namespace_create (CLONE_NEWNET, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ns_handle);
|
||||
|
||||
nmtstp_run_command_check ("ip link set %s netns %ld", IFACE_VETH1, (long) nmtstp_namespace_handle_get_pid (ns_handle));
|
||||
NMTST_WAIT_ASSERT (100, {
|
||||
nmtstp_wait_for_signal (50);
|
||||
nm_platform_process_events (NM_PLATFORM_GET);
|
||||
|
||||
pllink_veth1 = nm_platform_link_get (NM_PLATFORM_GET, ifindex_veth1);
|
||||
pllink_veth0 = nm_platform_link_get (NM_PLATFORM_GET, ifindex_veth0);
|
||||
if ( !pllink_veth1
|
||||
&& pllink_veth0
|
||||
&& pllink_veth0->parent == NM_PLATFORM_LINK_OTHER_NETNS) {
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
out:
|
||||
g_assert (nm_platform_link_delete (NM_PLATFORM_GET, ifindex_veth0));
|
||||
nm_platform_link_delete (NM_PLATFORM_GET, ifindex_veth0);
|
||||
nm_platform_link_delete (NM_PLATFORM_GET, ifindex_veth1);
|
||||
nmtstp_namespace_handle_release (ns_handle);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue