diff options
| author | Michael Biebl <biebl@debian.org> | 2023-06-12 11:25:29 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-06-12 11:25:29 +0200 |
| commit | 150fe9eef8dd22307ee16687509acde616663982 (patch) | |
| tree | 200fa1178c9aeee2ff874bb63afe93623da4be0d /src/core/platform/tests/test-common.c | |
| parent | dfaaf221cfee4ffcc507d793dae051d402646679 (diff) | |
New upstream version 1.42.6 upstream/1.42.6
Diffstat (limited to 'src/core/platform/tests/test-common.c')
| -rw-r--r-- | src/core/platform/tests/test-common.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 571fedfe..65bdfeae 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -2520,7 +2520,9 @@ nmtstp_link_ip6gre_add(NMPlatform *platform, gboolean success; char b1[NM_INET_ADDRSTRLEN]; char b2[NM_INET_ADDRSTRLEN]; + char encap[100]; char tclass[20]; + gboolean encap_ignore; gboolean tclass_inherit; g_assert(nm_utils_ifname_valid_kernel(name, NULL)); @@ -2530,6 +2532,7 @@ nmtstp_link_ip6gre_add(NMPlatform *platform, _init_platform(&platform, external_command); +again: if (external_command) { gs_free char *dev = NULL; @@ -2538,9 +2541,11 @@ nmtstp_link_ip6gre_add(NMPlatform *platform, g_strdup_printf("dev %s", nm_platform_link_get_name(platform, lnk->parent_ifindex)); tclass_inherit = NM_FLAGS_HAS(lnk->flags, IP6_TNL_F_USE_ORIG_TCLASS); + encap_ignore = NM_FLAGS_HAS(lnk->flags, IP6_TNL_F_IGN_ENCAP_LIMIT); success = !nmtstp_run_command( - "ip link add %s type %s%s%s local %s remote %s ttl %u tclass %s flowlabel %x", + "ip link add %s type %s%s%s local %s remote %s ttl %u tclass %s%s " + "flowlabel %x", name, lnk->is_tap ? "ip6gretap" : "ip6gre", NM_PRINT_FMT_QUOTED2(dev, " ", dev, ""), @@ -2548,7 +2553,19 @@ nmtstp_link_ip6gre_add(NMPlatform *platform, nm_inet6_ntop(&lnk->remote, b2), lnk->ttl, tclass_inherit ? "inherit" : nm_sprintf_buf(tclass, "%02x", lnk->tclass), + encap_ignore + ? "encaplimit none" + : (lnk->encap_limit != 4 ? nm_sprintf_buf(encap, "encaplimit %u", lnk->encap_limit) + : ""), lnk->flow_label); + + if (!success && (encap_ignore || lnk->encap_limit != 4)) { + /* The command failed. That might be because iproute2 does not support the + * encaplimit parameter yet. Retry, now with platform code. */ + external_command = FALSE; + goto again; + } + if (success) { pllink = nmtstp_assert_wait_for_link(platform, name, |