diff options
| author | Michael Biebl <biebl@debian.org> | 2026-05-14 19:21:22 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2026-05-14 19:21:22 +0200 |
| commit | 869e9027026cdbb15d4e4a6327ff41d2697858eb (patch) | |
| tree | 52edec7f935ff1bbb425c3515c6e49e6b8b0e28b /src/core/platform/tests/test-common.c | |
| parent | 067fb576988f685e83ac8b0ae690334aff547c85 (diff) | |
New upstream version 1.56.1 upstream/1.56.1
Diffstat (limited to 'src/core/platform/tests/test-common.c')
| -rw-r--r-- | src/core/platform/tests/test-common.c | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 91445b30..f1f7caee 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -1230,7 +1230,7 @@ out: } gboolean -nmtstp_check_platform_full(NMPlatform *platform, guint32 obj_type_flags, gboolean do_assert) +nmtstp_check_platform_full(NMPlatform *platform, guint64 obj_type_flags, gboolean do_assert) { static const NMPObjectType obj_types[] = { NMP_OBJECT_TYPE_IP4_ADDRESS, @@ -1265,7 +1265,7 @@ nmtstp_check_platform_full(NMPlatform *platform, guint32 obj_type_flags, gboolea for (i_obj_types = 0; i_obj_types < (int) G_N_ELEMENTS(obj_types); i_obj_types++) { const NMPObjectType obj_type = obj_types[i_obj_types]; - const guint32 i_obj_type_flags = nmp_object_type_to_flags(obj_type); + const guint64 i_obj_type_flags = nmp_object_type_to_flags(obj_type); gs_unref_ptrarray GPtrArray *arr1 = NULL; gs_unref_ptrarray GPtrArray *arr2 = NULL; NMPLookup lookup; @@ -1408,7 +1408,7 @@ nmtstp_check_platform_full(NMPlatform *platform, guint32 obj_type_flags, gboolea } void -nmtstp_check_platform(NMPlatform *platform, guint32 obj_type_flags) +nmtstp_check_platform(NMPlatform *platform, guint64 obj_type_flags) { if (!nmtstp_check_platform_full(platform, obj_type_flags, FALSE)) { /* It's unclear why this failure sometimes happens. It happens @@ -2394,6 +2394,61 @@ nmtstp_link_dummy_add(NMPlatform *platform, int external_command, const char *na } const NMPlatformLink * +nmtstp_link_geneve_add(NMPlatform *platform, + int external_command, + const char *name, + const NMPlatformLnkGeneve *lnk) +{ + const NMPlatformLink *pllink = NULL; + int success; + + g_assert(nm_utils_ifname_valid_kernel(name, NULL)); + g_assert(lnk->remote || !IN6_IS_ADDR_UNSPECIFIED(&lnk->remote6)); + + external_command = nmtstp_run_command_check_external(external_command); + + _init_platform(&platform, external_command); + + if (external_command) { + char remote[NM_INET_ADDRSTRLEN]; + char remote6[NM_INET_ADDRSTRLEN]; + char str_ttl[30]; + + if (lnk->remote) + nm_inet4_ntop(lnk->remote, remote); + else + remote[0] = '\0'; + + if (memcmp(&lnk->remote6, &in6addr_any, sizeof(in6addr_any))) + nm_inet6_ntop(&lnk->remote6, remote6); + else + remote6[0] = '\0'; + + success = !nmtstp_run_command( + "ip link add %s type geneve id %u remote %s %s tos %02x dstport %u%s", + name, + lnk->id, + remote[0] ? remote : remote6, + lnk->ttl > 0 ? nm_sprintf_buf(str_ttl, "ttl %u", lnk->ttl & 0xff) + : lnk->ttl == 0 ? "ttl auto" + : "ttl inherit", + lnk->tos, + lnk->dst_port, + lnk->df == 1 ? " df set " + : lnk->df == 2 ? " df inherit " + : ""); + + if (success) + pllink = nmtstp_assert_wait_for_link(platform, name, NM_LINK_TYPE_GENEVE, 100); + } else + success = NMTST_NM_ERR_SUCCESS(nm_platform_link_geneve_add(platform, name, lnk, &pllink)); + + _assert_pllink(platform, success, pllink, name, NM_LINK_TYPE_GENEVE); + + return pllink; +} + +const NMPlatformLink * nmtstp_link_gre_add(NMPlatform *platform, int external_command, const char *name, @@ -3024,8 +3079,6 @@ nmtstp_link_vxlan_add(NMPlatform *platform, return pllink; } -/*****************************************************************************/ - const NMPlatformLink * nmtstp_link_get_typed(NMPlatform *platform, int ifindex, const char *name, NMLinkType link_type) { |