Commit graph

23997 commits

Author SHA1 Message Date
Thomas Haller
a4e7994ac4
ifcfg-rh: merge branch 'th/ifcfg-rh-802-1x-pin'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/520

(cherry picked from commit 266d054808)
(cherry picked from commit 698acfef4b)

(cherry picked from commit 4d1b316f91)
2020-05-29 13:20:49 +02:00
Thomas Haller
73865ffb0b
ifcfg-rh: support persisting 802-1x.pin and pin-flags property
(cherry picked from commit 655fd1ebd8)
(cherry picked from commit 799cee5068)
(cherry picked from commit 77e1132845)
2020-05-29 13:20:48 +02:00
Thomas Haller
e00e764167
libnm,ifcfg-rh: fix documentation for IEEE_8021X_SYSTEM_CA_CERTS in man nm-settings-ifcfg-rh
Fixes: 2a4fb75d3b ('ifcfg: add support for "802-1x.system-ca-certs" setting')
(cherry picked from commit b4537f2c03)
(cherry picked from commit 5d8a0837b3)
(cherry picked from commit e11232de96)
2020-05-29 13:20:48 +02:00
Thomas Haller
3afbaeb597
libnm,ifcfg-rh: fix documentation for IEEE_8021X_PASSWORD_RAW_FLAGS in man nm-settings-ifcfg-rh
Fixes: a83ab252ee ('ifcfg-rh: add support for 802-1x.password-raw property')
(cherry picked from commit 9fde21504e)
(cherry picked from commit 36ddd266a5)
(cherry picked from commit 52bb253f6b)
2020-05-29 13:20:47 +02:00
Thomas Haller
e18f4a3ca5
libnm,ifcfg-rh: merge branch 'th/ifcfg-rh-ca-path'
https://bugzilla.redhat.com/show_bug.cgi?id=1840210
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/518

(cherry picked from commit e0c220e7e9)
(cherry picked from commit 8affcc19b6)
(cherry picked from commit 6066e16367)
2020-05-27 11:29:07 +02:00
Thomas Haller
388f3e18a9
libnm: update documentation for 802-1x ca-cert, ca-path and system-ca-certs
(cherry picked from commit 4f21b14b90)
(cherry picked from commit 0d35d14faf)
(cherry picked from commit 1a989a98bf)
2020-05-27 11:28:37 +02:00
Thomas Haller
97b12a3c34
ifcfg-rh: fix handling "802-1x.{phase2-,}ca-path" in ifcfg-rh settings plugin
https://bugzilla.redhat.com/show_bug.cgi?id=1840210
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448
(cherry picked from commit b6b6639c7c)
(cherry picked from commit 67f1da27fe)
(cherry picked from commit 7a20dd4dbb)
2020-05-27 11:19:42 +02:00
Thomas Haller
359f7f3544
build: log system-ca-path configure setting in build scripts
(cherry picked from commit f8dcb3fc47)
(cherry picked from commit f3f179728e)
(cherry picked from commit eb9767a6c8)
2020-05-27 11:19:39 +02:00
Thomas Haller
bf65bec49d
keyfile: suppress bogus warning about [ethernet-s390-options] setting
S390 options are stored in a separate [ethernet-s390-options] section.
This group must not be interpreted as a NMSetting name, otherwise we
log a bogus warning:

  <warn>  [1590523563.7757] keyfile: ethernet-s390-options: invalid setting name 'ethernet-s390-options'

Fixes: cf9b8d3bad ('libnm/keyfile: implement ethernet.s390-options in keyfile')
(cherry picked from commit 82a468c9ad)
(cherry picked from commit d611647997)
(cherry picked from commit e9f2831ab5)
2020-05-27 09:47:36 +02:00
Beniamino Galvani
197b4e7b15 core: signal parent-active only when the parent AC is activated
The parent-active signal is used by the manager to determine when the
parent active-connection is ready and a connection that depend on it
can proceed.

The AC state could transition from ACTIVATING directly to
DEACTIVATING; in such case we should not emit the signal but instead
just stop watching the parent AC.

Fixes: 6e382ea91d ('active-connection: add parent active connection tracking')
https://bugzilla.redhat.com/show_bug.cgi?id=1778073
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/510
(cherry picked from commit 02ea74c920)
(cherry picked from commit 30be025e59)
(cherry picked from commit 678c6b6a6a)
2020-05-19 21:44:59 +02:00
Beniamino Galvani
b4fedfc57c ip-tunnel: merge branch 'bg/ip-tunnel-cloned-mac-rh1832170'
https://bugzilla.redhat.com/show_bug.cgi?id=1832170
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/503
(cherry picked from commit 2d8c87e22e)
(cherry picked from commit f50ed7a25e)
(cherry picked from commit bef2f8a4dd)
2020-05-15 10:21:15 +02:00
Beniamino Galvani
60b4bdafcf ip-tunnel: set cloned-mac-address only for layer2 tunnel devices
For ip-tunnel modes that encapsulate layer2 packets (gretap and
ip6gretap) we allow the presence of an ethernet setting in the
connection and honor the cloned-mac-address specified in it.

For all other modes, the ethernet setting is removed during
normalization, but a value different from 'preserve' could be set via
global default.

The kernel doesn't allow setting a MAC for layer3 devices, don't do
it.

(cherry picked from commit 0494a84878)
(cherry picked from commit 78ed14166c)
(cherry picked from commit d69d92c658)
2020-05-15 10:20:23 +02:00
Beniamino Galvani
db82b52dbd libnm-core: add _nm_ip_tunnel_mode_is_layer2()
(cherry picked from commit 48c93b3bba)
(cherry picked from commit 5d2f2a6549)
(cherry picked from commit d0f275e7f5)
2020-05-15 10:12:05 +02:00
Thomas Haller
53cb8ce245
acd: fix char buffer argument to _acd_event_to_string_buf()
(cherry picked from commit 6e9967939b)
(cherry picked from commit 1e1ae9ba07)
(cherry picked from commit c0997fa4f3)
2020-05-08 07:58:52 +02:00
Thomas Haller
78618ccbaf
acd: avoid alloca() inside an unbounded loop
(cherry picked from commit b447c80ad8)
(cherry picked from commit ecb9e0e3df)
(cherry picked from commit 198e233b91)
2020-05-07 14:07:16 +02:00
Thomas Haller
2630758cb4
libnm: fix gtk-doc annotations for nm_setting_match_get_interface_names()
Otherwise the function is not usable via generated bindings.

Fixes: 9b9dce9486 ('all: add 'match' setting')
(cherry picked from commit 180cda7632)
(cherry picked from commit 805adec9ca)
(cherry picked from commit b5a66b88b3)
2020-05-06 15:12:17 +02:00
Beniamino Galvani
e0ac524ccc platform: fix test failure when /proc is mounted read-only
Expect a failure when writing to /proc if the file system is mounted
read-only.

(cherry picked from commit 211eb3ff8a)
(cherry picked from commit cd056b664b)
2020-05-04 15:07:12 +02:00
Thomas Haller
32e0bd7e72
all: merge branch 'th/strtoll-workaround'
https://bugzilla.redhat.com/show_bug.cgi?id=1797915

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/456

(cherry picked from commit d342fa267d)
(cherry picked from commit 85811e67dd)
2020-05-02 14:59:25 +02:00
Thomas Haller
500f0b96ae
all: use wrappers for g_ascii_strtoll(), g_ascii_strtoull(), g_ascii_strtod()
Sometimes these function may set errno to unexpected values like EAGAIN.
This causes confusion. Avoid that by using our own wrappers that retry
in that case. For example, in rhbz#1797915 we have failures like:

    errno = 0;
    v = g_ascii_strtoll ("10", 0, &end);
    if (errno != 0)
        g_assert_not_reached ();

as g_ascii_strtoll() would return 10, but also set errno to EAGAIN.

Work around that by using wrapper functions that retry. This certainly
should be fixed in glib (or glibc), but the issues are severe enough to
warrant a workaround.

Note that our workarounds are very defensive. We only retry 2 times, if
we get an unexpected errno value. This is in the hope to recover from
a spurious EAGAIN. It won't recover from other errors.

https://bugzilla.redhat.com/show_bug.cgi?id=1797915
(cherry picked from commit 7e49f4a199)
(cherry picked from commit eec2740d71)
2020-05-02 14:57:53 +02:00
Thomas Haller
d629db4a0e
shared: add nm_g_ascii_strtoull() to workaround bug
(cherry picked from commit 3b58c5fef4)
(cherry picked from commit 95565bef77)
2020-05-02 14:57:32 +02:00
Thomas Haller
0de1c3a53a
shared: add nm_g_ascii_strtod() to workaround bug
(cherry picked from commit 35a9f632a8)
(cherry picked from commit f8cae1ed18)
2020-05-02 14:57:31 +02:00
Thomas Haller
49c523cf1e
shared: add nm_g_ascii_strtoll() to workaround bug
(cherry picked from commit f4446e34c6)
(cherry picked from commit 6836679878)
2020-05-02 14:56:52 +02:00
Thomas Haller
386ea3ff26
device/bluetooth: avoid g_ascii_strtoull() to parse capabilities
Avoid g_ascii_strtoull() calling directly. It has subtle issues, which is why
we have a wrapper for it.

(cherry picked from commit 659ac9cc12)
(cherry picked from commit 62469c1401)
2020-05-02 14:55:57 +02:00
Thomas Haller
1a54909bb4
ifupdown: use _nm_utils_ascii_str_to_int64() for converting netmask to string
(cherry picked from commit 3930ef194e)
(cherry picked from commit 1a80179c60)
2020-05-02 14:53:05 +02:00
Thomas Haller
23bc8cadb6
ifcfg-rh/tests: add unit test for reading DEVTIMEOUT (connection.wait-device-timeout)
(cherry picked from commit 9cbf4c2825)
(cherry picked from commit c81d12bc69)
2020-05-02 14:52:49 +02:00
Thomas Haller
396a4dfc2b
ifcfg: strip whitespaces around "DEVTIMEOUT"
Be more graceful and allow whitespaces around the floating point number
for DEVTIMEOUT. Note that _nm_utils_ascii_str_to_int64() is already graceful
against whitespace, so also be it with the g_ascii_strtod() code path.

(cherry picked from commit 2e4771be5e)
(cherry picked from commit 5a44792e41)
2020-05-02 14:51:33 +02:00
Thomas Haller
75933cd6ff vpn: clear host part of IPv6 routes received from VPN plugin
Kernel would reject adding a route with a destination host part not
all zero. NetworkManager generally coerces such routes and there
are assertions in place to ensure that.

We forgot to ensure that for certain IPv6 routes from VPN plugins.
This can cause an assertion failure and wrong behavior.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/425

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/482
(cherry picked from commit b437bb4a6e)
(cherry picked from commit c7586e6388)
(cherry picked from commit 55c361453b)
2020-04-28 09:44:01 +02:00
Beniamino Galvani
0417a5b4d1 man: mention the meaning of may-fail in the nm-online man page
Commit b2a0738765 ('man: improve manual page for nm-online') removed
the explanation of how may-fail can be used to wait for a specific
address family during boot. I found that part useful.

Note: this branch doesn't have commit 1e5206414a ('device: don't
delay startup complete for pending-actions "autoconf", "dhcp4" and
"dhcp6"') and so the text is different from branch nm-1-22 and later.

https://bugzilla.redhat.com/show_bug.cgi?id=1825666
(cherry picked from commit 25583de20b)
(cherry picked from commit 02a31e71af)
(cherry picked from commit 74c4494b3b)
2020-04-24 16:12:35 +02:00
Thomas Haller
9430c693fe build/autotools: fix passing AM_CFLAGS when building libnm-core
With `./configure --enable-more-asserts`, we add extra -W flags to
AM_CFLAGS. This variable is only used, if the per-library override
libnm_core_libnm_core_la_CFLAGS is unspecified ([1]).

Usually we avoid this problem be never specifying library_CFLAGS, but
placing all our per-library flags to library_CPPFLAGS. While that is a
bit of a hack and misuse of CPPFLAGS, it works well (enough).

This was broken recently. The effect was, that libnm-core was not
build with AM_CFLAGS flags. Fix it.

[1] https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html

Fixes: d2d6a68697 ('build: use -fcommon when building libnm-core')
(cherry picked from commit 16df1c179d)
(cherry picked from commit 96f50cf9d8)
2020-04-24 15:41:18 +02:00
Beniamino Galvani
9055250cef ovs: merge branch 'bg/ovs-no-bridge-rh1797696'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/422
https://bugzilla.redhat.com/show_bug.cgi?id=1797696
(cherry picked from commit 47f81864ba)
(cherry picked from commit 4045608ca8)
2020-04-24 15:33:06 +02:00
Beniamino Galvani
bb7f729eca ovs: fail port enslavement when the bridge device is not found
Fail the enslavement of the ovs port if the bridge device is not
found, instead of generating assertions and potentially crash later.

https://bugzilla.redhat.com/show_bug.cgi?id=1797696

Fixes: 101e65d2bb ('ovs: allow changing mac address of bridges and interfaces')
(cherry picked from commit c5c49995b1)
(cherry picked from commit 7494a2e37a)
2020-04-24 15:32:51 +02:00
Beniamino Galvani
323a557f74 ovs: fail port enslavement when the bridge AC is not found
The previous code tried to get the bridge active connection and it
used the port active connection instead in case of failure. This
doesn't seem right, as in nm-ovsdb.c the bridge AC is used to get the
bridge settings (including the uuid, interface name, and cloned mac).

In case of failure getting the bridge AC we should just fail.

Fixes: 830a5a14cb ('device: add support for OpenVSwitch devices')
(cherry picked from commit c8b5a3f91a)
(cherry picked from commit d8fb95d22b)
2020-04-24 15:32:49 +02:00
Thomas Haller
7ef4185714 cli: unset "ipv[46].never-default" when setting "ipv[46].gateway"
Since commit c1907a218a ('libnm-core: remove gateway when
never-default=yes in NMSettingIPConfig'), the gateway gets normalized
away when the profile has never-default set.

That means,

  $ nmcli connection modify "$PROFILE" ipv4.never-default yes ipv4.gateway 192.168.77.1

does not set the gateway. Likewise, if your profile has already never-default
enabled,

  $ nmcli connection modify "$PROFILE" ipv4.gateway 192.168.77.1

will have no effect. That is confusing and undesirable.

Note that we don't adjust the GObject property setter for "gateway" to clear
never-default. I feel, setting one property in libnm should preferably
not unset another (there are exceptions to the rule, like for team
properties). However, for nmcli it's clear in which order properties
are set, so this change is right for the client tool.

https://bugzilla.redhat.com/show_bug.cgi?id=1785039

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/475
(cherry picked from commit 411255d51f)
(cherry picked from commit fae37528d9)
(cherry picked from commit d2606cc49e)
2020-04-22 21:16:03 +02:00
Beniamino Galvani
87f24157ef dhcp-helper: retry in case of failure connecting to D-Bus unix socket
Connecting to the unix socket can fail with EAGAIN if there are too
many pending connections and the server can't accept them in time
before reaching backlog capacity. Ideally the server should increase
the backlog length, but GLib doesn't provide a way to change it for a
GDBus server. Retry for up to 5 seconds in case of failure.

https://bugzilla.redhat.com/show_bug.cgi?id=1821594
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/471
(cherry picked from commit eefe5dacaa)
(cherry picked from commit 4cf63dfa15)
(cherry picked from commit 2b7908a1c6)
2020-04-21 08:59:52 +02:00
Thomas Haller
3ca48236e4 tests: abort test runner if exec fails
(cherry picked from commit 2ad8e6acae)
(cherry picked from commit 24ab6b6cdc)
(cherry picked from commit b10d90a549)
2020-04-20 11:52:58 +02:00
Thomas Haller
cf5a18812a libnm-core/tests: avoid -Wstring-compare in unit test for NM_IN_SET()
Clang 10 doesn't like NM_IN_SET() with strings and is right about that:

    ../libnm-core/tests/test-general.c:7763:9: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Werror,-Wstring-compare]
            (void) NM_IN_SET ("a",  "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16");
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

However, NM_IN_STRSET() should work.

(cherry picked from commit c437d6c60a)
(cherry picked from commit c8f372b3a6)
2020-04-20 09:52:57 +02:00
Thomas Haller
925a688400 shared/glib: reimplement g_atomic_pointer_compare_and_exchange() macro
With glib 2.63.2 and clang 9.0.0 (Fedora 32) we get compile errors:

  ../clients/cloud-setup/nmcs-provider-ec2.c:51:8: error: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'const char **' [-Werror,-Wincompatible-pointer-types]
                  if (!g_atomic_pointer_compare_and_exchange (&base_cached, NULL, base))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
      __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                             ^~~~~~~~~~~~~~
  ../src/devices/bluetooth/nm-bluez-manager.c:2836:2: error: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'const NMBtVTableNetworkServer **' (aka 'const struct _NMBtVTableNetworkServer **') [-Werror,-Wincompatible-pointer-types]
          g_atomic_pointer_compare_and_exchange (&nm_bt_vtable_network_server, NULL, &priv->vtable_network_server);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
      __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                             ^~~~~~~~~~~~~~
  ../src/devices/bluetooth/nm-bluez-manager.c:2853:2: error: passing 'typeof ((&priv->vtable_network_server)) *' (aka 'struct _NMBtVTableNetworkServer **') to parameter of type 'const NMBtVTableNetworkServer **' (aka 'const struct _NMBtVTableNetworkServer **') discards qualifiers in nested pointer types [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
          g_atomic_pointer_compare_and_exchange (&nm_bt_vtable_network_server, &priv->vtable_network_server, NULL);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
      __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                             ^~~~~~~~~~~~~~
  ../src/devices/nm-device.c:8857:8: error: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'GBytes **' (aka 'struct _GBytes **') [-Werror,-Wincompatible-pointer-types]
                  if (!g_atomic_pointer_compare_and_exchange (&global_duid, NULL, p)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
      __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                             ^~~~~~~~~~~~~~

The issue happens because glib passes the "atomic" argument to

  __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)

without cast, and clang 9 seems to be picky about const pointers.
Add our own version of the macro that does better casts while also having
better compile time checks for valid arguments.

(cherry picked from commit f5b0713651)
(cherry picked from commit d8cc6af058)
2020-04-20 09:33:16 +02:00
Thomas Haller
6da20c24cd platform: avoid compiler warning in _NMP_OBJECT_TYPE_IS_OBJ_WITH_IFINDEX()
Surisingly, the compiler may detect the remaining obj_type in
the default switch. Then, inlining nmp_class_from_type() it may detect
that this is only possible to hit with an out or range access to
_nmp_classes array.

Rework the code to avoid that compiler warning. It's either way not
supposed to happen.

Also, drop the default switch case and explicitly list the enum values.
Otherwise it is error prone to forget a switch case.

(cherry picked from commit 9848589fbf)
(cherry picked from commit 6f189da7b6)
2020-04-20 09:28:29 +02:00
Beniamino Galvani
57e5e2d5a9 clients: add missing 'extern' keyword
(cherry picked from commit 482e5f04ea)
(cherry picked from commit 1bb93b7289)
2020-04-20 09:12:55 +02:00
Thomas Haller
307168ce91 build: disable -Wimplicit-fallthrough warning with clang
Seems clang 10 got support for -Wimplicit-fallthrough, but does
not honor the code comments to suppress the warning. What a
disaster.

Try to detect it.

See-also: https://github.com/ClangBuiltLinux/linux/issues/   #636
See-also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e2079e93f562c7f7a030eb7642017ee5eabaaa10
(cherry picked from commit 86dfc4b099)
(cherry picked from commit 6e23a1b95d)
2020-04-20 09:09:16 +02:00
Antonio Cardace
39f0a20ca5 meson: add additional debug CFLAGS to use the same ones autotools uses
(cherry picked from commit 6dc8167588)
(cherry picked from commit ef786159c4)
2020-04-20 09:08:56 +02:00
Thomas Haller
bbc8e09dc8 core: fix passing current enum value to nm_config_data_get_value() in _init_nm_debug()
Fixes: c7d2e1f3bc ('config: drop nm_config_get_debug() and access config directly')
2020-04-20 09:02:40 +02:00
Beniamino Galvani
fb4d8705dd all: remove wrong CURL option initialization
curl_multi_setopt() accepts CURLMOPT_* options, not CURLOPT_*
ones. Found by GCC 10:

clients/cloud-setup/nm-http-client.c:700:38: error: implicit conversion from ‘enum <anonymous>’ to ‘CURLMoption’ [-Werror=enum-conversion]
  700 |    curl_multi_setopt (priv->mhandle, CURLOPT_VERBOSE, 1);

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
(cherry picked from commit c11ac34f4c)
(cherry picked from commit 7ba2040caa)
2020-04-20 08:26:33 +02:00
Thomas Haller
6f39520ee9 connectivity: fix using curl_multi_strerror() for CURLMcode error code
(cherry picked from commit c24f122e22)
2020-04-20 08:24:48 +02:00
Beniamino Galvani
0ed3711f5c n-dhcp4: fix initialization of the 'secs' DHCP header field
Due to wrong type conversions, the value was always zero.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/341
(cherry picked from commit df6129d93a)
(cherry picked from commit ff7545704e)
2020-04-20 08:06:49 +02:00
Beniamino Galvani
ef3c1a1602 n-dhcp4: fix uninitialized variable
Properly initialize 'overload' when the space in the file section
ends.

 shared/n-dhcp4/src/n-dhcp4-outgoing.c: In function ‘n_dhcp4_outgoing_append’:
 shared/n-dhcp4/src/n-dhcp4-outgoing.c:198:17: error: ‘overload’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

(cherry picked from commit b2620e798a)
(cherry picked from commit 972b0db460)
2020-04-20 08:04:46 +02:00
Thomas Haller
f7b9d06306 platform: fix GCC warning about zero-length array in nmp_utils_ethtool_get_permanent_address()
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

  src/platform/nm-platform-utils.c: In function ‘nmp_utils_ethtool_get_permanent_address’:
  src/platform/nm-platform-utils.c:854:29: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u8[0]’ {aka ‘unsigned char[0]’} [-Werror=zero-length-bounds]
    854 |  if (NM_IN_SET (edata.e.data[0], 0, 0xFF)) {
  ./shared/nm-glib-aux/nm-macros-internal.h:731:20: note: in definition of macro ‘_NM_IN_SET_EVAL_N’

Fix this warning.

(cherry picked from commit d892a35395)
(cherry picked from commit c1417087c8)
2020-04-20 07:44:14 +02:00
Thomas Haller
b474ed0044 platform: fix GCC warning about zero-length array in ethtool_get_stringset()
GCC 10 complains about accesses to elements of zero-length arrays that
overlap other members of the same object:

 src/platform/nm-platform-utils.c: In function ‘ethtool_get_stringset’:
 src/platform/nm-platform-utils.c:355:27: error: array subscript 0 is outside the bounds of an interior zero-length array ‘__u32[0]’ {aka ‘unsigned int[0]’} [-Werror=zero-length-bounds]
   355 |  len = sset_info.info.data[0];
       |        ~~~~~~~~~~~~~~~~~~~^~~
 In file included from src/platform/nm-platform-utils.c:12:
 /usr/include/linux/ethtool.h:647:8: note: while referencing ‘data’
   647 |  __u32 data[0];
       |        ^~~~

Fix this warning.

(cherry picked from commit 16e1e44c5e)
(cherry picked from commit 286bb2f029)
2020-04-20 07:44:07 +02:00
Beniamino Galvani
5d797b91e4 build: use -fcommon when building libnm-core
Building with GCC 10 gives the following error:

 multiple definition of_nm_jansson_json_object_iter_key';
 libnm/.libs/liblibnm.a(libnm_core_la-nm-json.o):/builddir/build/BUILD/NetworkManager-1.23.1/libnm-core/nm-json.c:24: first defined here /usr/bin/ld:
 libnm/.libs/liblibnm.a(libnm_core_la-nm-team-utils.o):/usr/include/jansson.h:202: multiple definition of _nm_jansson_json_object_iter';

This happens because GCC 10 defaults to -fno-common and so multiple
definitions of the same global variable are not merged together.

_nm_jansson_json_* symbols are defined in nm-json.c as void pointers
and, due to the following macros in nm-json.h:

 #define json_object_iter_next   (*_nm_jansson_json_object_iter_next)
 ...

the function declaration in jansson.h:

 void *json_object_iter_next(json_t *object, void *iter);

becomes a global variable as well:

 void *(*_nm_jansson_json_object_iter_next)(json_t *object, void *iter);

So, the symbol is present in nm-json.o and all other object files that
include nm-json.h, and -fcommon is required. Without it, it would be
necessary to define the symbols only in one place (for example,
nm-json.c), but then static inline functions from the jannson.h header
would still refer to the original (missing) jansson functions.

For the moment, just use -fcommon.

(cherry picked from commit d2d6a68697)
(cherry picked from commit 311872ddca)
2020-04-20 07:33:17 +02:00
Thomas Haller
4fb9f98bc6 tests: ignore valgrind warnings for unhandled syscalls in libnm,service-provider tests
Otherwise, we get test failures with valgrind on fedora:rawhide
(valgrind-3.15.0-18.fc33.x86_64.rpm, gcc-10.0.1-0.8.fc33.x86_64,
glib2-devel-2.63.5-3.fc33.x86_64):

    >>>> PRINT VALGRIND LOGS (valgrind test) (start)
    + find -name '*.valgrind-log' -print0
    + xargs -0 grep -H '^'
    ./src/devices/wwan/tests/test-service-providers.valgrind-log:--95634-- WARNING: unhandled amd64-linux syscall: 315
    ./src/devices/wwan/tests/test-service-providers.valgrind-log:--95634-- You may be able to write your own handler.
    ./src/devices/wwan/tests/test-service-providers.valgrind-log:--95634-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
    ./src/devices/wwan/tests/test-service-providers.valgrind-log:--95634-- Nevertheless we consider this a bug.  Please report
    ./src/devices/wwan/tests/test-service-providers.valgrind-log:--95634-- it at http://valgrind.org/support/bug_reports.html.
    ./libnm/tests/test-remote-settings-client.valgrind-log:--95245-- WARNING: unhandled amd64-linux syscall: 315
    ./libnm/tests/test-remote-settings-client.valgrind-log:--95245-- You may be able to write your own handler.
    ./libnm/tests/test-remote-settings-client.valgrind-log:--95245-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
    ./libnm/tests/test-remote-settings-client.valgrind-log:--95245-- Nevertheless we consider this a bug.  Please report
    ./libnm/tests/test-remote-settings-client.valgrind-log:--95245-- it at http://valgrind.org/support/bug_reports.html.
    ./libnm/tests/test-secret-agent.valgrind-log:--95280-- WARNING: unhandled amd64-linux syscall: 315
    ./libnm/tests/test-secret-agent.valgrind-log:--95280-- You may be able to write your own handler.
    ./libnm/tests/test-secret-agent.valgrind-log:--95280-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
    ./libnm/tests/test-secret-agent.valgrind-log:--95280-- Nevertheless we consider this a bug.  Please report
    ./libnm/tests/test-secret-agent.valgrind-log:--95280-- it at http://valgrind.org/support/bug_reports.html.
    ./libnm/tests/test-nm-client.valgrind-log:--95208-- WARNING: unhandled amd64-linux syscall: 315
    ./libnm/tests/test-nm-client.valgrind-log:--95208-- You may be able to write your own handler.
    ./libnm/tests/test-nm-client.valgrind-log:--95208-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
    ./libnm/tests/test-nm-client.valgrind-log:--95208-- Nevertheless we consider this a bug.  Please report
    ./libnm/tests/test-nm-client.valgrind-log:--95208-- it at http://valgrind.org/support/bug_reports.html.
    + echo '>>>> PRINT VALGRIND LOGS (valgrind test) (done)'
    >>>> PRINT VALGRIND LOGS (valgrind test) (done)

(cherry picked from commit 3e616c306d)
(cherry picked from commit a9372112b9)
2020-04-20 07:33:17 +02:00