From 0fde65a14eaa1dad72838f5e23fa45dbf90506aa Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 5 Jun 2014 11:59:50 +0200 Subject: [PATCH] platform/test: workaround team bug in older kernel version In older versions of team (e.g. Fedora 17), the master team device stays up, even if no slaves are IFF_LOWER_UP. Workaround this bug. Signed-off-by: Thomas Haller --- src/platform/tests/test-link.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 73c260c4ca..a3f757c2e7 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -183,7 +183,20 @@ test_slave (int master, int type, SignalData *master_changed) } g_assert (!nm_platform_link_is_up (ifindex)); g_assert (!nm_platform_link_is_connected (ifindex)); - g_assert (!nm_platform_link_is_connected (master)); + if (nm_platform_link_is_connected (master)) { + if (nm_platform_link_get_type (master) == NM_LINK_TYPE_TEAM) { + /* Older team versions (e.g. Fedora 17) have a bug that team master stays + * IFF_LOWER_UP even if its slave is down. Double check it with iproute2 and if + * `ip link` also claims master to be up, accept it. */ + char *stdout = NULL; + + nmtst_spawn_sync (NULL, &stdout, NULL, 0, "/sbin/ip", "link", "show", "dev", nm_platform_link_get_name (master)); + + g_assert (strstr (stdout, "LOWER_UP")); + g_free (stdout); + } else + g_assert_not_reached (); + } /* Set slave up and see if master gets up too */ g_assert (nm_platform_link_set_up (ifindex)); no_error ();