From 3a56bce6c0ea7ba0fe269520547740783b342e0d Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 18 Feb 2021 18:53:54 +0100 Subject: New upstream version 1.30.0 --- src/core/platform/nmp-object.h | 8 ++++++-- src/core/platform/tests/test-common.c | 15 ++++++++++++++- src/core/platform/tests/test-route.c | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src/core/platform') diff --git a/src/core/platform/nmp-object.h b/src/core/platform/nmp-object.h index dc2cc86b..19f6bcd7 100644 --- a/src/core/platform/nmp-object.h +++ b/src/core/platform/nmp-object.h @@ -34,10 +34,14 @@ typedef union { struct sockaddr_in6 in6; } NMSockAddrUnion; +G_STATIC_ASSERT(sizeof(NMSockAddrUnion) == sizeof(((NMSockAddrUnion *) NULL)->in6)); + +/* we initialize the largest union member, to ensure that all fields are initialized. */ + #define NM_SOCK_ADDR_UNION_INIT_UNSPEC \ { \ - .sa = { \ - .sa_family = AF_UNSPEC, \ + .in6 = { \ + .sin6_family = AF_UNSPEC, \ }, \ } diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 87e5329a..4a117d59 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -2563,7 +2563,20 @@ main(int argc, char **argv) if (unshare(CLONE_NEWNET | CLONE_NEWNS) != 0) { errsv = errno; - g_error("unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", + if (errsv == EPERM) { +#ifdef REQUIRE_ROOT_TESTS + g_print("Fail test: unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)\n", + nm_strerror_native(errsv), + errsv); + return EXIT_FAILURE; +#else + g_print("Skipping test: unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)\n", + nm_strerror_native(errsv), + errsv); + return g_test_run(); +#endif + } + g_error("Fail test: unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", nm_strerror_native(errsv), errsv); } diff --git a/src/core/platform/tests/test-route.c b/src/core/platform/tests/test-route.c index 47587865..645bb5b1 100644 --- a/src/core/platform/tests/test-route.c +++ b/src/core/platform/tests/test-route.c @@ -446,7 +446,7 @@ test_ip6_route(void) metric, mss); g_assert(nmtstp_ip6_route_get(NM_PLATFORM_GET, ifindex, &network, plen, metric, NULL, 0)); - accept_signal(route_added); + accept_signals(route_added, 1, 2); /* Add route again */ nmtstp_ip6_route_add(NM_PLATFORM_GET, -- cgit 1.3.0-6-gf8a5