summary refs log tree commit diff
path: root/src/core/platform/tests
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-10-01 23:05:04 +0200
committerMichael Biebl <biebl@debian.org>2021-10-01 23:05:04 +0200
commite74c568b07b50b97873fb4ee1d776dedefbd54d6 (patch)
tree3469f17ea9af91f7ff169b890633bda68b0cf76e /src/core/platform/tests
parentbfe522304da217296e2a61040f58e35ec5d6f3f2 (diff)
New upstream version 1.32.12 upstream/1.32.12
Diffstat (limited to 'src/core/platform/tests')
-rw-r--r--src/core/platform/tests/monitor.c2
-rw-r--r--src/core/platform/tests/test-address.c6
-rw-r--r--src/core/platform/tests/test-cleanup.c9
-rw-r--r--src/core/platform/tests/test-common.c54
-rw-r--r--src/core/platform/tests/test-common.h31
-rw-r--r--src/core/platform/tests/test-link.c114
-rw-r--r--src/core/platform/tests/test-nmp-object.c4
-rw-r--r--src/core/platform/tests/test-platform-general.c10
-rw-r--r--src/core/platform/tests/test-route.c108
-rw-r--r--src/core/platform/tests/test-tc.c6
10 files changed, 220 insertions, 124 deletions
diff --git a/src/core/platform/tests/monitor.c b/src/core/platform/tests/monitor.c
index abdf2cd5..ff6fae65 100644
--- a/src/core/platform/tests/monitor.c
+++ b/src/core/platform/tests/monitor.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <syslog.h>
 
-#include "platform/nm-linux-platform.h"
+#include "libnm-platform/nm-linux-platform.h"
 
 #include "nm-test-utils-core.h"
 
diff --git a/src/core/platform/tests/test-address.c b/src/core/platform/tests/test-address.c
index d4d67105..4e1d1d6e 100644
--- a/src/core/platform/tests/test-address.c
+++ b/src/core/platform/tests/test-address.c
@@ -235,7 +235,7 @@ test_ip4_address_general_2(void)
     /* Looks like addresses are not announced by kernel when the interface
      * is down. Link-local IPv6 address is automatically added.
      */
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, DEVICE_IFINDEX, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, DEVICE_IFINDEX, IFF_UP, TRUE) >= 0);
 
     /* Add/delete notification */
     nmtstp_ip4_address_add(NULL, EX, ifindex, addr, IP4_PLEN, addr, lifetime, preferred, 0, NULL);
@@ -325,7 +325,7 @@ test_ip4_address_peer(void)
 
     g_assert(addr != addr_peer);
 
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, ifindex, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, TRUE) >= 0);
     accept_signals(address_removed, 0, G_MAXINT);
     accept_signals(address_added, 0, G_MAXINT);
 
@@ -397,7 +397,7 @@ test_ip4_address_peer_zero(void)
     peers[1] = addr_peer;
     peers[2] = 0;
 
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, ifindex, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, TRUE) >= 0);
 
     nmtst_rand_perm(NULL, r_peers, peers, sizeof(peers[0]), G_N_ELEMENTS(peers));
     for (i = 0; i < G_N_ELEMENTS(peers); i++) {
diff --git a/src/core/platform/tests/test-cleanup.c b/src/core/platform/tests/test-cleanup.c
index b54eca34..e13bb8c8 100644
--- a/src/core/platform/tests/test-cleanup.c
+++ b/src/core/platform/tests/test-cleanup.c
@@ -44,9 +44,12 @@ test_cleanup_internal(void)
     g_assert(NMTST_NM_ERR_SUCCESS(nm_platform_link_dummy_add(NM_PLATFORM_GET, DEVICE_NAME, NULL)));
     accept_signal(link_added);
     free_signal(link_added);
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET,
-                                     nm_platform_link_get_ifindex(NM_PLATFORM_GET, DEVICE_NAME),
-                                     NULL));
+    g_assert(
+        nm_platform_link_change_flags(NM_PLATFORM_GET,
+                                      nm_platform_link_get_ifindex(NM_PLATFORM_GET, DEVICE_NAME),
+                                      IFF_UP,
+                                      TRUE)
+        >= 0);
     ifindex = nm_platform_link_get_ifindex(NM_PLATFORM_GET, DEVICE_NAME);
     g_assert(ifindex > 0);
 
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c
index 1b977145..2fc9e836 100644
--- a/src/core/platform/tests/test-common.c
+++ b/src/core/platform/tests/test-common.c
@@ -1413,6 +1413,48 @@ nmtstp_ip6_address_del(NMPlatform *    platform,
     }                                                                                       \
     G_STMT_END
 
+/* Due to rounding errors with clock_t_to_jiffies()/jiffies_to_clock_t(), kernel cannot
+ * store all requested values. That means, when we try to configure a bridge with
+ * the @requested values, the actually configured settings are slightly off, as
+ * @kernel.
+ *
+ * This function takes @requested and returns it as @dst output. All fields
+ * that might be mangled by kernel (according to @kernel) are adjusted. The
+ * result is almost identical to @requested, but some fields might be adjusted
+ * to their @kernel value. */
+const NMPlatformLnkBridge *
+nmtstp_link_bridge_normalize_jiffies_time(const NMPlatformLnkBridge *requested,
+                                          const NMPlatformLnkBridge *kernel,
+                                          NMPlatformLnkBridge *      dst)
+{
+    g_assert(requested);
+    g_assert(dst);
+    g_assert(kernel);
+
+    if (dst != requested)
+        *dst = *requested;
+
+#define _normalize_field(dst, kernel, field)                                         \
+    G_STMT_START                                                                     \
+    {                                                                                \
+        (dst)->field = nmtstp_normalize_jiffies_time((dst)->field, (kernel)->field); \
+    }                                                                                \
+    G_STMT_END
+
+    _normalize_field(dst, kernel, forward_delay);
+    _normalize_field(dst, kernel, hello_time);
+    _normalize_field(dst, kernel, max_age);
+    _normalize_field(dst, kernel, ageing_time);
+    _normalize_field(dst, kernel, mcast_last_member_interval);
+    _normalize_field(dst, kernel, mcast_membership_interval);
+    _normalize_field(dst, kernel, mcast_querier_interval);
+    _normalize_field(dst, kernel, mcast_query_interval);
+    _normalize_field(dst, kernel, mcast_query_response_interval);
+    _normalize_field(dst, kernel, mcast_startup_query_interval);
+
+    return dst;
+}
+
 const NMPlatformLink *
 nmtstp_link_bridge_add(NMPlatform *               platform,
                        gboolean                   external_command,
@@ -1421,7 +1463,8 @@ nmtstp_link_bridge_add(NMPlatform *               platform,
 {
     const NMPlatformLink *     pllink = NULL;
     const NMPlatformLnkBridge *ll     = NULL;
-    int                        r      = 0;
+    NMPlatformLnkBridge        lnk_normalized;
+    int                        r = 0;
 
     g_assert(nm_utils_ifname_valid_kernel(name, NULL));
 
@@ -1542,10 +1585,9 @@ nmtstp_link_bridge_add(NMPlatform *               platform,
 
     ll = NMP_OBJECT_CAST_LNK_BRIDGE(NMP_OBJECT_UP_CAST(pllink)->_link.netlink.lnk);
 
-    /* account for roundtrip rounding error with clock_t_to_jiffies()/jiffies_to_clock_t(). */
-    g_assert_cmpint(lnk->forward_delay, >=, ll->forward_delay - 1);
-    g_assert_cmpint(lnk->forward_delay, <=, ll->forward_delay);
+    lnk = nmtstp_link_bridge_normalize_jiffies_time(lnk, ll, &lnk_normalized);
 
+    g_assert_cmpint(lnk->forward_delay, ==, ll->forward_delay);
     g_assert_cmpint(lnk->hello_time, ==, ll->hello_time);
     g_assert_cmpint(lnk->max_age, ==, ll->max_age);
     g_assert_cmpint(lnk->ageing_time, ==, ll->ageing_time);
@@ -2246,9 +2288,9 @@ nmtstp_link_set_updown(NMPlatform *platform, gboolean external_command, int ifin
         nmtstp_run_command_check("ip link set %s %s", ifname, up ? "up" : "down");
     } else {
         if (up)
-            g_assert(nm_platform_link_set_up(platform, ifindex, NULL));
+            g_assert(nm_platform_link_change_flags(platform, ifindex, IFF_UP, TRUE) >= 0);
         else
-            g_assert(nm_platform_link_set_down(platform, ifindex));
+            g_assert(nm_platform_link_change_flags(platform, ifindex, IFF_UP, FALSE) >= 0);
     }
 
     /* Let's wait until we get the result */
diff --git a/src/core/platform/tests/test-common.h b/src/core/platform/tests/test-common.h
index 618645fe..1fb97d24 100644
--- a/src/core/platform/tests/test-common.h
+++ b/src/core/platform/tests/test-common.h
@@ -11,10 +11,10 @@
 #include <linux/if_link.h>
 #include <linux/ip6_tunnel.h>
 
-#include "platform/nm-platform.h"
-#include "platform/nmp-object.h"
+#include "libnm-platform/nm-platform.h"
+#include "libnm-platform/nmp-object.h"
 #include "platform/nm-fake-platform.h"
-#include "platform/nm-linux-platform.h"
+#include "libnm-platform/nm-linux-platform.h"
 
 #include "nm-test-utils-core.h"
 
@@ -22,6 +22,24 @@
 
 /*****************************************************************************/
 
+#define nmtstp_normalize_jiffies_time(requested_value, kernel_value)                             \
+    ({                                                                                           \
+        typeof(kernel_value)  _kernel_value    = (kernel_value);                                 \
+        typeof(_kernel_value) _requested_value = (requested_value);                              \
+                                                                                                 \
+        /* kernel stores some values (like bridge's forward_delay) in jiffies. When converting
+         * back and forth (clock_t_to_jiffies()/jiffies_to_clock_t()), the value reported back
+         * to user space may have rounding errors (of +/- 1), depending on CONFIG_HZ setting.
+         *
+         * Normalize the requested_value to the kernel_value, if it look as if a rounding
+         * error happens. If the difference is larger than +/- 1, no normalization happens! */   \
+                                                                                                 \
+        ((_requested_value >= (NM_MAX(_kernel_value, 1) - 1))                                    \
+         && (_requested_value <= (NM_MIN(_kernel_value, ~((typeof(_kernel_value)) 0) - 1) + 1))) \
+            ? _kernel_value                                                                      \
+            : _requested_value;                                                                  \
+    })
+
 #define _NMLOG_PREFIX_NAME "platform-test"
 #define _NMLOG_DOMAIN      LOGD_PLATFORM
 #define _NMLOG(level, ...) _LOG(level, _NMLOG_DOMAIN, __VA_ARGS__)
@@ -437,6 +455,11 @@ gboolean nmtstp_kernel_support_get(NMPlatformKernelSupportType type);
 void
 nmtstp_link_set_updown(NMPlatform *platform, gboolean external_command, int ifindex, gboolean up);
 
+const NMPlatformLnkBridge *
+nmtstp_link_bridge_normalize_jiffies_time(const NMPlatformLnkBridge *requested,
+                                          const NMPlatformLnkBridge *kernel,
+                                          NMPlatformLnkBridge *      dst);
+
 const NMPlatformLink *nmtstp_link_bridge_add(NMPlatform *               platform,
                                              gboolean                   external_command,
                                              const char *               name,
@@ -519,7 +542,7 @@ _nmtstp_env1_wrapper_setup(const NmtstTestData *test_data)
     g_assert_cmpint(NMTSTP_ENV1_IFINDEX, ==, -1);
 
     if (GPOINTER_TO_INT(p_ifup))
-        g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, *p_ifindex, NULL));
+        g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, *p_ifindex, IFF_UP, TRUE) >= 0);
 
     nm_platform_process_events(NM_PLATFORM_GET);
 
diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c
index 3aaa3759..f6c3841e 100644
--- a/src/core/platform/tests/test-link.c
+++ b/src/core/platform/tests/test-link.c
@@ -11,11 +11,11 @@
 #include <sys/types.h>
 #include <linux/if_tun.h>
 
-#include "nm-glib-aux/nm-io-utils.h"
-#include "nm-base/nm-ethtool-base.h"
-#include "platform/nmp-object.h"
-#include "nm-platform/nmp-netns.h"
-#include "nm-platform/nm-platform-utils.h"
+#include "libnm-glib-aux/nm-io-utils.h"
+#include "libnm-base/nm-ethtool-base.h"
+#include "libnm-platform/nmp-object.h"
+#include "libnm-platform/nmp-netns.h"
+#include "libnm-platform/nm-platform-utils.h"
 
 #include "test-common.h"
 #include "nm-test-utils-core.h"
@@ -48,13 +48,15 @@ test_bogus(void)
     g_assert(!nm_platform_link_get_type(NM_PLATFORM_GET, BOGUS_IFINDEX));
     g_assert(!nm_platform_link_get_type_name(NM_PLATFORM_GET, BOGUS_IFINDEX));
 
-    g_assert(!nm_platform_link_set_up(NM_PLATFORM_GET, BOGUS_IFINDEX, NULL));
+    g_assert(!(nm_platform_link_change_flags(NM_PLATFORM_GET, BOGUS_IFINDEX, IFF_UP, TRUE) >= 0));
 
-    g_assert(!nm_platform_link_set_down(NM_PLATFORM_GET, BOGUS_IFINDEX));
+    g_assert(!(nm_platform_link_change_flags(NM_PLATFORM_GET, BOGUS_IFINDEX, IFF_UP, FALSE) >= 0));
 
-    g_assert(!nm_platform_link_set_arp(NM_PLATFORM_GET, BOGUS_IFINDEX));
+    g_assert(
+        !(nm_platform_link_change_flags(NM_PLATFORM_GET, BOGUS_IFINDEX, IFF_NOARP, TRUE) >= 0));
 
-    g_assert(!nm_platform_link_set_noarp(NM_PLATFORM_GET, BOGUS_IFINDEX));
+    g_assert(
+        !(nm_platform_link_change_flags(NM_PLATFORM_GET, BOGUS_IFINDEX, IFF_NOARP, FALSE) >= 0));
 
     g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, BOGUS_IFINDEX));
     g_assert(!nm_platform_link_is_connected(NM_PLATFORM_GET, BOGUS_IFINDEX));
@@ -147,7 +149,8 @@ software_add(NMLinkType link_type, const char *name)
                                                 NM_PLATFORM_SIGNAL_CHANGED,
                                                 link_callback,
                                                 parent_ifindex);
-            g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, parent_ifindex, NULL));
+            g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, parent_ifindex, IFF_UP, TRUE)
+                     >= 0);
             if (was_up) {
                 /* when NM is running in the background, it will mess with addrgenmode which might cause additional signals. */
                 accept_signals(parent_changed, 0, 1);
@@ -233,7 +236,7 @@ test_slave(int master, int type, SignalData *master_changed)
      * See https://bugzilla.redhat.com/show_bug.cgi?id=910348
      */
     g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex));
-    g_assert(nm_platform_link_set_down(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, FALSE) >= 0);
     g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex));
     ensure_no_signal(link_changed);
 
@@ -263,7 +266,7 @@ test_slave(int master, int type, SignalData *master_changed)
                      &test_link_changed_signal_arg2);
 
     /* Set master up */
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, master, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, master, IFF_UP, TRUE) >= 0);
     g_assert(nm_platform_link_is_up(NM_PLATFORM_GET, master));
     accept_signals(master_changed, 1, 3);
 
@@ -284,7 +287,7 @@ test_slave(int master, int type, SignalData *master_changed)
     switch (nm_platform_link_get_type(NM_PLATFORM_GET, master)) {
     case NM_LINK_TYPE_BOND:
     case NM_LINK_TYPE_TEAM:
-        g_assert(nm_platform_link_set_down(NM_PLATFORM_GET, ifindex));
+        g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, FALSE) >= 0);
         accept_signal(link_changed);
         accept_signals(master_changed, 0, 3);
         break;
@@ -317,7 +320,7 @@ test_slave(int master, int type, SignalData *master_changed)
     }
 
     /* Set slave up and see if master gets up too */
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, ifindex, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, TRUE) >= 0);
     g_assert(nm_platform_link_is_connected(NM_PLATFORM_GET, ifindex));
     g_assert(nm_platform_link_is_connected(NM_PLATFORM_GET, master));
     accept_signals(link_changed, 1, 3);
@@ -439,10 +442,10 @@ test_software(NMLinkType link_type, const char *link_typename)
 
     /* Set ARP/NOARP */
     g_assert(nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
-    g_assert(nm_platform_link_set_noarp(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_NOARP, TRUE) >= 0);
     g_assert(!nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
     accept_signals(link_changed, 1, 2);
-    g_assert(nm_platform_link_set_arp(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_NOARP, FALSE) >= 0);
     g_assert(nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
     accept_signal(link_changed);
 
@@ -672,21 +675,21 @@ test_internal(void)
     /* Up/connected */
     g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex));
     g_assert(!nm_platform_link_is_connected(NM_PLATFORM_GET, ifindex));
-    g_assert(nm_platform_link_set_up(NM_PLATFORM_GET, ifindex, NULL));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, TRUE) >= 0);
     g_assert(nm_platform_link_is_up(NM_PLATFORM_GET, ifindex));
     g_assert(nm_platform_link_is_connected(NM_PLATFORM_GET, ifindex));
     accept_signals(link_changed, 1, 2);
-    g_assert(nm_platform_link_set_down(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_UP, FALSE) >= 0);
     g_assert(!nm_platform_link_is_up(NM_PLATFORM_GET, ifindex));
     g_assert(!nm_platform_link_is_connected(NM_PLATFORM_GET, ifindex));
     accept_signal(link_changed);
 
     /* arp/noarp */
     g_assert(!nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
-    g_assert(nm_platform_link_set_arp(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_NOARP, FALSE) >= 0);
     g_assert(nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
     accept_signal(link_changed);
-    g_assert(nm_platform_link_set_noarp(NM_PLATFORM_GET, ifindex));
+    g_assert(nm_platform_link_change_flags(NM_PLATFORM_GET, ifindex, IFF_NOARP, TRUE) >= 0);
     g_assert(!nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex));
     accept_signal(link_changed);
 
@@ -1303,7 +1306,7 @@ test_software_detect(gconstpointer user_data)
 
         if (!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, "gre0")) {
             /* Seems that the ip_gre module is not loaded... try to load it. */
-            gracefully_skip = nm_utils_modprobe(NULL, TRUE, "ip_gre", NULL) != 0;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip_gre", NULL) != 0;
         }
 
         if (!nmtstp_link_gre_add(NULL, ext, DEVICE_NAME, &lnk_gre)) {
@@ -1330,7 +1333,7 @@ test_software_detect(gconstpointer user_data)
 
         if (!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, "gretap0")) {
             /* Seems that the ip_gre module is not loaded... try to load it. */
-            gracefully_skip = nm_utils_modprobe(NULL, TRUE, "ip_gre", NULL) != 0;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip_gre", NULL) != 0;
         }
 
         if (!nmtstp_link_gre_add(NULL, ext, DEVICE_NAME, &lnk_gre)) {
@@ -1350,7 +1353,7 @@ test_software_detect(gconstpointer user_data)
 
         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;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ipip", NULL) != 0;
         }
 
         lnk_ipip.local              = nmtst_inet4_from_string("1.2.3.4");
@@ -1376,7 +1379,7 @@ test_software_detect(gconstpointer user_data)
 
         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;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip6_tunnel", NULL) != 0;
         }
 
         switch (test_data->test_mode) {
@@ -1418,7 +1421,7 @@ test_software_detect(gconstpointer user_data)
 
         if (!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, "ip6gre0")) {
             /* Seems that the ip6_tunnel module is not loaded... try to load it. */
-            gracefully_skip = nm_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0;
         }
 
         lnk_ip6tnl.local          = *nmtst_inet6_from_string("fd01::42");
@@ -1445,7 +1448,7 @@ test_software_detect(gconstpointer user_data)
 
         if (!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, "ip6gre0")) {
             /* Seems that the ip6_tunnel module is not loaded... try to load it. */
-            gracefully_skip = nm_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0;
         }
 
         lnk_ip6tnl.local          = *nmtst_inet6_from_string("fe80::abcd");
@@ -1526,7 +1529,7 @@ test_software_detect(gconstpointer user_data)
 
         if (!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, "sit0")) {
             /* Seems that the sit module is not loaded... try to load it. */
-            gracefully_skip = nm_utils_modprobe(NULL, TRUE, "sit", NULL) != 0;
+            gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "sit", NULL) != 0;
         }
 
         if (!nmtstp_link_sit_add(NULL, ext, DEVICE_NAME, &lnk_sit)) {
@@ -1679,17 +1682,25 @@ test_software_detect(gconstpointer user_data)
         case NM_LINK_TYPE_BRIDGE:
         {
             const NMPlatformLnkBridge *plnk = &lnk->lnk_bridge;
+            NMPlatformLnkBridge        lnk_bridge_norm_stack;
+            const NMPlatformLnkBridge *lnk_bridge_norm;
 
             g_assert(plnk == nm_platform_link_get_lnk_bridge(NM_PLATFORM_GET, ifindex, NULL));
-            g_assert_cmpint(nm_platform_lnk_bridge_cmp(&lnk_bridge, plnk), ==, 0);
-            g_assert_cmpint(plnk->forward_delay, ==, 1560);
-            g_assert_cmpint(plnk->hello_time, ==, 150);
-            g_assert_cmpint(plnk->max_age, ==, 2100);
-            g_assert_cmpint(plnk->ageing_time, ==, 2200);
+
+            lnk_bridge_norm = nmtstp_link_bridge_normalize_jiffies_time(&lnk_bridge,
+                                                                        plnk,
+                                                                        &lnk_bridge_norm_stack);
+
+            g_assert_cmpint(nm_platform_lnk_bridge_cmp(lnk_bridge_norm, plnk), ==, 0);
+
+            g_assert_cmpint(plnk->forward_delay, ==, lnk_bridge_norm->forward_delay);
+            g_assert_cmpint(plnk->hello_time, ==, lnk_bridge_norm->hello_time);
+            g_assert_cmpint(plnk->max_age, ==, lnk_bridge_norm->max_age);
+            g_assert_cmpint(plnk->ageing_time, ==, lnk_bridge_norm->ageing_time);
             g_assert_cmpint(plnk->stp_state, ==, TRUE);
             g_assert_cmpint(plnk->priority, ==, 22);
             g_assert_cmpint(plnk->vlan_protocol, ==, 0x8100);
-            g_assert_cmpint(plnk->vlan_stats_enabled, ==, lnk_bridge.vlan_stats_enabled);
+            g_assert_cmpint(plnk->vlan_stats_enabled, ==, lnk_bridge_norm->vlan_stats_enabled);
             g_assert_cmpint(plnk->group_fwd_mask, ==, 8);
             g_assert_cmpint(plnk->mcast_snooping, ==, TRUE);
             g_assert_cmpint(plnk->mcast_router, ==, 1);
@@ -1698,13 +1709,22 @@ test_software_detect(gconstpointer user_data)
             g_assert_cmpint(plnk->mcast_hash_max, ==, 1024);
             g_assert_cmpint(plnk->mcast_last_member_count, ==, 2);
             g_assert_cmpint(plnk->mcast_startup_query_count, ==, 3);
-            g_assert_cmpint(plnk->mcast_last_member_interval, ==, 5000);
-            g_assert_cmpint(plnk->mcast_membership_interval, ==, 25000);
-            g_assert_cmpint(plnk->mcast_querier_interval, ==, 26000);
-            g_assert_cmpint(plnk->mcast_query_interval, ==, 12000);
-            g_assert_cmpint(plnk->mcast_query_response_interval, ==, 5200);
-            g_assert_cmpint(plnk->mcast_startup_query_interval, ==, 3000);
-            g_assert_cmpint(nm_platform_lnk_bridge_cmp(&lnk_bridge, plnk), ==, 0);
+            g_assert_cmpint(plnk->mcast_last_member_interval,
+                            ==,
+                            lnk_bridge_norm->mcast_last_member_interval);
+            g_assert_cmpint(plnk->mcast_membership_interval,
+                            ==,
+                            lnk_bridge_norm->mcast_membership_interval);
+            g_assert_cmpint(plnk->mcast_querier_interval,
+                            ==,
+                            lnk_bridge_norm->mcast_querier_interval);
+            g_assert_cmpint(plnk->mcast_query_interval, ==, lnk_bridge_norm->mcast_query_interval);
+            g_assert_cmpint(plnk->mcast_query_response_interval,
+                            ==,
+                            lnk_bridge_norm->mcast_query_response_interval);
+            g_assert_cmpint(plnk->mcast_startup_query_interval,
+                            ==,
+                            lnk_bridge_norm->mcast_startup_query_interval);
             break;
         }
         case NM_LINK_TYPE_GRE:
@@ -2049,7 +2069,7 @@ _assert_xgress_qos_mappings_impl(int ifindex, gboolean is_ingress_map, int n_ent
     _assert_xgress_qos_mappings(ifindex, FALSE, n_entries, __VA_ARGS__)
 
 static void
-_assert_vlan_flags(int ifindex, NMVlanFlags flags)
+_assert_vlan_flags(int ifindex, _NMVlanFlags flags)
 {
     const NMPlatformLnkVlan *plnk;
 
@@ -2362,8 +2382,8 @@ test_vlan_set_xgress(void)
 
         g_assert(nm_platform_link_vlan_change(NM_PLATFORM_GET,
                                               ifindex,
-                                              NM_VLAN_FLAG_REORDER_HEADERS | NM_VLAN_FLAG_GVRP,
-                                              NM_VLAN_FLAG_REORDER_HEADERS,
+                                              _NM_VLAN_FLAG_REORDER_HEADERS | _NM_VLAN_FLAG_GVRP,
+                                              _NM_VLAN_FLAG_REORDER_HEADERS,
                                               TRUE,
                                               ingress_map,
                                               G_N_ELEMENTS(ingress_map),
@@ -2372,7 +2392,7 @@ test_vlan_set_xgress(void)
                                               G_N_ELEMENTS(egress_map)));
         _assert_ingress_qos_mappings(ifindex, 2, 4, 1, 6, 12);
         _assert_egress_qos_mappings(ifindex, 2, 1, 5, 3232, 7);
-        _assert_vlan_flags(ifindex, NM_VLAN_FLAG_REORDER_HEADERS);
+        _assert_vlan_flags(ifindex, _NM_VLAN_FLAG_REORDER_HEADERS);
     }
 
     {
@@ -2393,8 +2413,8 @@ test_vlan_set_xgress(void)
 
         g_assert(nm_platform_link_vlan_change(NM_PLATFORM_GET,
                                               ifindex,
-                                              NM_VLAN_FLAG_GVRP,
-                                              NM_VLAN_FLAG_GVRP,
+                                              _NM_VLAN_FLAG_GVRP,
+                                              _NM_VLAN_FLAG_GVRP,
                                               FALSE,
                                               ingress_map,
                                               G_N_ELEMENTS(ingress_map),
@@ -2403,7 +2423,7 @@ test_vlan_set_xgress(void)
                                               G_N_ELEMENTS(egress_map)));
         _assert_ingress_qos_mappings(ifindex, 2, 4, 1, 6, 12);
         _assert_egress_qos_mappings(ifindex, 2, 1, 7, 64, 4);
-        _assert_vlan_flags(ifindex, NM_VLAN_FLAG_REORDER_HEADERS | NM_VLAN_FLAG_GVRP);
+        _assert_vlan_flags(ifindex, _NM_VLAN_FLAG_REORDER_HEADERS | _NM_VLAN_FLAG_GVRP);
     }
 
     nmtstp_link_delete(NULL, -1, ifindex, DEVICE_NAME, TRUE);
diff --git a/src/core/platform/tests/test-nmp-object.c b/src/core/platform/tests/test-nmp-object.c
index 310611ee..6d2236ec 100644
--- a/src/core/platform/tests/test-nmp-object.c
+++ b/src/core/platform/tests/test-nmp-object.c
@@ -8,8 +8,8 @@
 #include <libudev.h>
 #include <linux/pkt_sched.h>
 
-#include "platform/nmp-object.h"
-#include "nm-udev-aux/nm-udev-utils.h"
+#include "libnm-platform/nmp-object.h"
+#include "libnm-udev-aux/nm-udev-utils.h"
 
 #include "nm-test-utils-core.h"
 
diff --git a/src/core/platform/tests/test-platform-general.c b/src/core/platform/tests/test-platform-general.c
index b426cc65..05158228 100644
--- a/src/core/platform/tests/test-platform-general.c
+++ b/src/core/platform/tests/test-platform-general.c
@@ -7,8 +7,8 @@
 
 #include <linux/rtnetlink.h>
 
-#include "nm-platform/nm-platform-utils.h"
-#include "platform/nm-linux-platform.h"
+#include "libnm-platform/nm-platform-utils.h"
+#include "libnm-platform/nm-linux-platform.h"
 
 #include "nm-test-utils-core.h"
 
@@ -584,7 +584,7 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data)
     nmtst_stable_rand(710086081, rand_map, sizeof(rand_map[0]) * N_ADDRESSES);
 
     for (i = 0; i < N_ADDRESSES; i++) {
-        NMPlatformIPXAddress *a = (gpointer)(&addresses[i * ELM_SIZE]);
+        NMPlatformIPXAddress *a = (gpointer) (&addresses[i * ELM_SIZE]);
         guint64               r = rand_map[i];
         struct in6_addr *     a6;
 
@@ -684,10 +684,10 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data)
                       (gpointer) test_data);
 
     for (i = 0; i < N_ADDRESSES; i++) {
-        const NMPlatformIPXAddress *a = (gconstpointer)(&addresses[i * ELM_SIZE]);
+        const NMPlatformIPXAddress *a = (gconstpointer) (&addresses[i * ELM_SIZE]);
 
         for (j = i + 1; j < N_ADDRESSES; j++) {
-            const NMPlatformIPXAddress *b = (gconstpointer)(&addresses[j * ELM_SIZE]);
+            const NMPlatformIPXAddress *b = (gconstpointer) (&addresses[j * ELM_SIZE]);
             int                         c1;
             int                         c2;
 
diff --git a/src/core/platform/tests/test-route.c b/src/core/platform/tests/test-route.c
index 645bb5b1..4b1db7fa 100644
--- a/src/core/platform/tests/test-route.c
+++ b/src/core/platform/tests/test-route.c
@@ -9,8 +9,8 @@
 #include <linux/fib_rules.h>
 
 #include "nm-core-utils.h"
-#include "nm-platform/nm-platform-utils.h"
-#include "platform/nmp-rules-manager.h"
+#include "libnm-platform/nm-platform-utils.h"
+#include "libnm-platform/nmp-rules-manager.h"
 
 #include "test-common.h"
 
@@ -332,30 +332,33 @@ test_ip4_route(void)
     /* Test route listing */
     routes = nmtstp_ip4_route_get_all(NM_PLATFORM_GET, ifindex);
     memset(rts, 0, sizeof(rts));
-    rts[0].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[0].network   = gateway;
-    rts[0].plen      = 32;
-    rts[0].ifindex   = ifindex;
-    rts[0].gateway   = INADDR_ANY;
-    rts[0].metric    = metric;
-    rts[0].mss       = mss;
-    rts[0].scope_inv = nm_platform_route_scope_inv(RT_SCOPE_LINK);
-    rts[1].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[1].network   = network;
-    rts[1].plen      = plen;
-    rts[1].ifindex   = ifindex;
-    rts[1].gateway   = gateway;
-    rts[1].metric    = metric;
-    rts[1].mss       = mss;
-    rts[1].scope_inv = nm_platform_route_scope_inv(RT_SCOPE_UNIVERSE);
-    rts[2].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[2].network   = 0;
-    rts[2].plen      = 0;
-    rts[2].ifindex   = ifindex;
-    rts[2].gateway   = gateway;
-    rts[2].metric    = metric;
-    rts[2].mss       = mss;
-    rts[2].scope_inv = nm_platform_route_scope_inv(RT_SCOPE_UNIVERSE);
+    rts[0].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[0].network     = gateway;
+    rts[0].plen        = 32;
+    rts[0].ifindex     = ifindex;
+    rts[0].gateway     = INADDR_ANY;
+    rts[0].metric      = metric;
+    rts[0].mss         = mss;
+    rts[0].is_external = TRUE;
+    rts[0].scope_inv   = nm_platform_route_scope_inv(RT_SCOPE_LINK);
+    rts[1].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[1].network     = network;
+    rts[1].plen        = plen;
+    rts[1].ifindex     = ifindex;
+    rts[1].gateway     = gateway;
+    rts[1].metric      = metric;
+    rts[1].mss         = mss;
+    rts[1].scope_inv   = nm_platform_route_scope_inv(RT_SCOPE_UNIVERSE);
+    rts[1].is_external = TRUE;
+    rts[2].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[2].network     = 0;
+    rts[2].plen        = 0;
+    rts[2].ifindex     = ifindex;
+    rts[2].gateway     = gateway;
+    rts[2].metric      = metric;
+    rts[2].mss         = mss;
+    rts[2].scope_inv   = nm_platform_route_scope_inv(RT_SCOPE_UNIVERSE);
+    rts[2].is_external = TRUE;
     g_assert_cmpint(routes->len, ==, 3);
     nmtst_platform_ip4_routes_equal_aptr((const NMPObject *const *) routes->pdata,
                                          rts,
@@ -489,30 +492,33 @@ test_ip6_route(void)
     /* Test route listing */
     routes = nmtstp_ip6_route_get_all(NM_PLATFORM_GET, ifindex);
     memset(rts, 0, sizeof(rts));
-    rts[0].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[0].network   = gateway;
-    rts[0].plen      = 128;
-    rts[0].ifindex   = ifindex;
-    rts[0].gateway   = in6addr_any;
-    rts[0].pref_src  = in6addr_any;
-    rts[0].metric    = metric;
-    rts[0].mss       = mss;
-    rts[1].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[1].network   = network;
-    rts[1].plen      = plen;
-    rts[1].ifindex   = ifindex;
-    rts[1].gateway   = gateway;
-    rts[1].pref_src  = pref_src;
-    rts[1].metric    = metric;
-    rts[1].mss       = mss;
-    rts[2].rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
-    rts[2].network   = in6addr_any;
-    rts[2].plen      = 0;
-    rts[2].ifindex   = ifindex;
-    rts[2].gateway   = gateway;
-    rts[2].pref_src  = in6addr_any;
-    rts[2].metric    = metric;
-    rts[2].mss       = mss;
+    rts[0].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[0].network     = gateway;
+    rts[0].plen        = 128;
+    rts[0].ifindex     = ifindex;
+    rts[0].gateway     = in6addr_any;
+    rts[0].pref_src    = in6addr_any;
+    rts[0].metric      = metric;
+    rts[0].mss         = mss;
+    rts[0].is_external = TRUE;
+    rts[1].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[1].network     = network;
+    rts[1].plen        = plen;
+    rts[1].ifindex     = ifindex;
+    rts[1].gateway     = gateway;
+    rts[1].pref_src    = pref_src;
+    rts[1].metric      = metric;
+    rts[1].mss         = mss;
+    rts[1].is_external = TRUE;
+    rts[2].rt_source   = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER);
+    rts[2].network     = in6addr_any;
+    rts[2].plen        = 0;
+    rts[2].ifindex     = ifindex;
+    rts[2].gateway     = gateway;
+    rts[2].pref_src    = in6addr_any;
+    rts[2].metric      = metric;
+    rts[2].mss         = mss;
+    rts[2].is_external = TRUE;
     g_assert_cmpint(routes->len, ==, 3);
     nmtst_platform_ip6_routes_equal_aptr((const NMPObject *const *) routes->pdata,
                                          rts,
@@ -709,6 +715,7 @@ test_ip4_route_options(gconstpointer test_data)
     for (i = 0; i < rts_n; i++) {
         rts_cmp[i] = rts_add[i];
         nm_platform_ip_route_normalize(AF_INET, NM_PLATFORM_IP_ROUTE_CAST(&rts_cmp[i]));
+        rts_cmp[i].is_external = TRUE;
     }
 
     routes = nmtstp_ip4_route_get_all(NM_PLATFORM_GET, IFINDEX);
@@ -880,6 +887,7 @@ test_ip6_route_options(gconstpointer test_data)
     for (i = 0; i < rts_n; i++) {
         rts_cmp[i] = rts_add[i];
         nm_platform_ip_route_normalize(AF_INET6, NM_PLATFORM_IP_ROUTE_CAST(&rts_cmp[i]));
+        rts_cmp[i].is_external = TRUE;
     }
 
     routes = nmtstp_ip6_route_get_all(NM_PLATFORM_GET, IFINDEX);
diff --git a/src/core/platform/tests/test-tc.c b/src/core/platform/tests/test-tc.c
index d15c3d76..cd9536cc 100644
--- a/src/core/platform/tests/test-tc.c
+++ b/src/core/platform/tests/test-tc.c
@@ -5,9 +5,9 @@
 #include <linux/pkt_sched.h>
 
 #include "nm-test-utils-core.h"
-#include "platform/nmp-object.h"
-#include "nm-platform/nmp-netns.h"
-#include "nm-platform/nm-platform-utils.h"
+#include "libnm-platform/nmp-object.h"
+#include "libnm-platform/nmp-netns.h"
+#include "libnm-platform/nm-platform-utils.h"
 #include "test-common.h"
 
 static NMPObject *