Commit graph

25562 commits

Author SHA1 Message Date
Thomas Haller
799cee5068
ifcfg-rh: support persisting 802-1x.pin and pin-flags property
(cherry picked from commit 655fd1ebd8)
2020-05-29 13:03:23 +02:00
Thomas Haller
5d8a0837b3
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)
2020-05-29 13:02:53 +02:00
Thomas Haller
36ddd266a5
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)
2020-05-29 13:02:53 +02:00
Thomas Haller
8affcc19b6
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)
2020-05-27 10:56:09 +02:00
Thomas Haller
0d35d14faf
libnm: update documentation for 802-1x ca-cert, ca-path and system-ca-certs
(cherry picked from commit 4f21b14b90)
2020-05-27 10:48:07 +02:00
Thomas Haller
67f1da27fe
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)
2020-05-27 10:47:54 +02:00
Thomas Haller
f3f179728e
build: log system-ca-path configure setting in build scripts
(cherry picked from commit f8dcb3fc47)
2020-05-27 10:47:17 +02:00
Thomas Haller
d611647997
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)
2020-05-27 09:44:53 +02:00
Thomas Haller
be1c9ecffa
platform: don't use unsigned constants in _link_type_from_rtnl_type(), _link_type_from_devtype()
(cherry picked from commit 650c550ab5)
2020-05-24 12:17:56 +02:00
Matthias Schiffer
8f99116422
platform: fix crash in binary search for _link_type_from_rtnl_type(), _link_type_from_devtype()
When searching an element that is lower than the first list element (for
example RTNL type "batadv"), imax will be -1 after the last iteration.

Use int instead of unsigned to make the termination condition imin > imax
work in this case. This fixes NetworkManager crashing due to an
out-of-bounds array access whenever interfaces of such types exist.

Fixes: 19ad044359 ('platform: use binary search to lookup NMLinkType for rtnl_type')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/515
(cherry picked from commit 2b54202089)
2020-05-24 12:17:55 +02:00
Beniamino Galvani
30be025e59 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)
2020-05-19 21:42:37 +02:00
Beniamino Galvani
76510c8a61 core: merge branch 'bg/shared-mode-firewall-rh1829637'
https://bugzilla.redhat.com/show_bug.cgi?id=1829637
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/498
(cherry picked from commit 779e5c0efb)
2020-05-19 08:37:26 +02:00
Beniamino Galvani
e7b4644d0a contrib/rpm: enable the firewalld zone in F32 and RHEL8
(cherry picked from commit 016a82e6dd)
2020-05-19 08:36:29 +02:00
Beniamino Galvani
13438e041a device: use the nm-shared firewalld zone in shared mode
When the interface is in IPv4 or IPv6 shared mode and the user didn't
specify an explicit zone, use the nm-shared one.

Note that masquerade is still done through iptables direct calls
because at the moment it is not possible for a firewalld zone to do
masquerade based on the input interface.

The firewalld zone is needed on systems where firewalld is using the
nftables backend and the 'iptables' binary uses the iptables API
(instead of the nftables one). On such systems, even if the traffic is
allowed in iptables by our direct rules, it can still be dropped in
nftables by firewalld.

(cherry picked from commit 3e2b723532)
2020-05-19 08:36:13 +02:00
Beniamino Galvani
ae5f16bb38 build: install a firewalld zone for shared mode
Install a NM-specific firewalld zone to be used for interfaces that
are used for connection sharing. The zone blocks all traffic to the
local machine except some protocols (DHCP, DNS and ICMP) and allows
all forwarded traffic.

(cherry picked from commit c8b5bf402d)
2020-05-19 08:32:59 +02:00
Beniamino Galvani
f50ed7a25e 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)
2020-05-15 09:55:41 +02:00
Beniamino Galvani
f517fc16db ip-tunnel: set ip6gretap MAC address when creating the link
(cherry picked from commit fa4fbd3333)
2020-05-15 09:55:26 +02:00
Beniamino Galvani
78ed14166c 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)
2020-05-15 09:55:24 +02:00
Beniamino Galvani
5d2f2a6549 libnm-core: add _nm_ip_tunnel_mode_is_layer2()
(cherry picked from commit 48c93b3bba)
2020-05-15 09:55:22 +02:00
Thomas Haller
fc46dda772
all: merge branch 'th/ubsan-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/505

(cherry picked from commit 01667694ca)
2020-05-14 13:42:59 +02:00
Thomas Haller
df0f9c8fbd
contrib/rpm: enable undefined-sanitizer libubsan on RHEL-8
(cherry picked from commit 350681e7f1)
2020-05-14 13:42:59 +02:00
Thomas Haller
99966958a8
build/autotools: fix linking nm-online,nm-dispatcher,nm-bt-test with sanitizer flags
(cherry picked from commit 9119e5b618)
2020-05-14 13:42:59 +02:00
Thomas Haller
166a15c374
build/autotools: reject invalid sanitizer options in configure.ac
(cherry picked from commit 1acb351848)
2020-05-14 13:42:58 +02:00
Thomas Haller
de0a372031
clients/tests: set "UBSAN_OPTIONS" to abort tests and set "ASAN_OPTIONS=detect_leaks=1"
(cherry picked from commit 5198bce5ee)
2020-05-14 13:42:58 +02:00
Thomas Haller
f6bdbab51e
clients/tests: preserve caller's ASAN/LSAN/UBSAN environment variables for client tests
(cherry picked from commit c6234e114b)
2020-05-14 13:42:58 +02:00
Thomas Haller
c67881e86c
tests/sanitizer: suppress leak in openssl
Suppress a leak report from openssl:

 Direct leak of 192 byte(s) in 1 object(s) allocated from:
     #0 0x7f6fe9c6b677 in __interceptor_malloc (/lib64/libasan.so.6+0xb0677)
     #1 0x7f6fe4d4046d in CRYPTO_zalloc crypto/mem.c:230
     #2 0x7f6fe4d0a91f in ENGINE_new crypto/engine/eng_lib.c:34
     #3 0x7f6fe4d0c40d in ENGINE_rdrand crypto/engine/eng_rdrand.c:70
     #4 0x7f6fe4d0c40d in engine_load_rdrand_int crypto/engine/eng_rdrand.c:85
     #5 0x7f6fe4d370ec in ossl_init_engine_rdrand crypto/init.c:353
     #6 0x7f6fe4d370ec in ossl_init_engine_rdrand_ossl_ crypto/init.c:347
     #7 0x7f6fe995aace in __pthread_once_slow (/lib64/libpthread.so.0+0x11ace)
     #8 0x7f6fe4da68fc in CRYPTO_THREAD_run_once crypto/threads_pthread.c:118
     #9 0x7f6fe4d378ec in OPENSSL_init_crypto crypto/init.c:723
     #10 0x7f6fe4d378ec in OPENSSL_init_crypto crypto/init.c:620
     #11 0x7f6fe5292280  (/usr/lib64/pkcs11/libsofthsm2.so+0x78280)
     #12 0x7f6fe5292364  (/usr/lib64/pkcs11/libsofthsm2.so+0x78364)
     #13 0x7f6fe526f151 in SoftHSM::C_Initialize(void*) /usr/src/debug/softhsm-2.5.0-4.fc32.3.x86_64/src/lib/SoftHSM.cpp:485
     #14 0x7f6fe523cc97 in C_Initialize (/usr/lib64/pkcs11/libsofthsm2.so+0x22c97)
     #15 0x7f6fe4ecb233 in initialize_module_inlock_reentrant ../p11-kit/modules.c:738
     #16 0x7f6fe4ecb382 in managed_C_Initialize ../p11-kit/modules.c:1584
     #17 0x7f6fe4ecdbdf in p11_kit_modules_initialize ../p11-kit/modules.c:2157
     #18 0x7f6fe4ecdbdf in p11_kit_modules_initialize ../p11-kit/modules.c:2145
     #19 0x7f6fe4ed1a96 in proxy_create ../p11-kit/proxy.c:330
     #20 0x7f6fe4ed1a96 in proxy_C_Initialize ../p11-kit/proxy.c:398
     #21 0x7f6fe9a343b1 in secmod_ModuleInit /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/pk11wrap/pk11load.c:244
     #22 0x7f6fe9a34adb in secmod_LoadPKCS11Module /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/pk11wrap/pk11load.c:501
     #23 0x7f6fe9a419ec in SECMOD_LoadModule /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/pk11wrap/pk11pars.c:1840
     #24 0x7f6fe9a41b27 in SECMOD_LoadModule /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/pk11wrap/pk11pars.c:1876
     #25 0x7f6fe9a0dd00 in nss_Init /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/nss/nssinit.c:712
     #26 0x7f6fe9a0e3ab in NSS_NoDB_Init /usr/src/debug/nss-3.51.0-1.fc32.x86_64/nss/lib/nss/nssinit.c:950
     #27 0x55c942e2f1b2 in _nm_crypto_init libnm-core/nm-crypto-nss.c:61
     #28 0x55c942d6f2da in nm_crypto_load_and_verify_certificate libnm-core/nm-crypto.c:721
     #29 0x55c942c99681 in _cert_impl_set libnm-core/nm-setting-8021x.c:497
     #30 0x55c942c9d83b in nm_setting_802_1x_set_ca_cert libnm-core/nm-setting-8021x.c:1033
     #31 0x55c942c63513 in _test_8021x_cert_from_files libnm-core/tests/test-keyfile.c:382
     #32 0x55c942c6425a in test_8021x_cert libnm-core/tests/test-keyfile.c:436
     #33 0x7f6fe965429d in test_case_run ../glib/gtestutils.c:2633
     #34 0x7f6fe965429d in g_test_run_suite_internal ../glib/gtestutils.c:2721

(cherry picked from commit 8113bc22d4)
2020-05-14 13:42:58 +02:00
Thomas Haller
37672399f7
tests/sanitizer: make ASAN/LSAN/UBSAN options configurable in "tools/run-nm-test.sh"
Also add a suppressions file for LSAN.

(cherry picked from commit 42d45299f9)
2020-05-14 13:42:58 +02:00
Thomas Haller
85a3d80e39
gitlab-ci: add more CentOS images for tests
(cherry picked from commit 0a030da6c2)
2020-05-14 13:42:58 +02:00
Thomas Haller
ad3478fe3f
gitlab-ci: optionally install libasan,libubsan via REQUIRED_PACKAGES script
(cherry picked from commit b846f9aba3)
2020-05-14 13:42:58 +02:00
Thomas Haller
4e8840f6e6
gitlab-ci: accept failure in REQUIRED_PACKAGES script for non-existing qt-devel
On CentOS 8, many devel packages are not available. Even after

  # dnf config-manager --set-enabled PowerTools

certain devel packages are missing. Some of these (libndp-devel,
mobile-broadband-provider-info-devel, teamd-devel) we build in copr
([1]), but libpsl-devel and qt-devel are still missing.

Only install them optionally and allow failure for them not being
present.

[1] https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-8/nmstate-nm-build-deps-epel-8.repo

(cherry picked from commit 1473f00d74)
2020-05-14 13:42:58 +02:00
Thomas Haller
5585b89253
tests: fix uint32 integer constants for TC_H_MAKE()
UBSan marks these:

  libnm-core/tests/test-setting.c:2146:2: runtime error: left shift of 65521 by 16 places cannot be represented in type 'int'
      #0 0x561739bed935 in test_tc_config_qdisc libnm-core/tests/test-setting.c:2146

(cherry picked from commit 14bf28f109)
2020-05-14 13:42:57 +02:00
Thomas Haller
8146b5a313
cli: use nm_strdup_int() in "clients/cli/devices.c"
(cherry picked from commit 446a145db5)
2020-05-14 13:42:57 +02:00
Thomas Haller
82370793a2
cli: fix leak in show_device_lldp_list() for nmc_parse_lldp_capabilities()
(cherry picked from commit a1e12c01df)
2020-05-14 13:42:57 +02:00
Thomas Haller
049ac92b2e
cli: fix leak in show_device_lldp_list()
(cherry picked from commit 589d51ca9d)
2020-05-14 13:42:57 +02:00
Thomas Haller
da93949874
cli: fix memcpy() with %NULL pointers in nmc_get_devices_sorted()
UBSan correctly flags this:

  clients/cli/devices.c:966:2: runtime error: null pointer passed as argument 2, which is declared to never be null

(cherry picked from commit 18b903943d)
2020-05-14 13:42:57 +02:00
Thomas Haller
3a66217cbb
libnm: don't compare invalid mac addresses as equal in nm_utils_hwaddr_matches()
By passing as length of the MAC addresses -1 for both arguments, one
could get through to compare empty strings, NULL, and addresses longer
than the maximum. Such addresses are not valid, and they should never
compare equal (not even to themselves).

This is a change in behavior of public API, but it never made sense to
claim two addresses are equal, when they are not even valid addresses.

Also, avoid undefined behavior with "NULL, -1, NULL, -1" arguments,
where we would call memcmp() with zero length and NULL arguments.
UBSan flags that too.

(cherry picked from commit 54a64edefc)
2020-05-14 13:42:57 +02:00
Thomas Haller
2c9af9db43
build: fix redefinition of VALGRIND define in "nm-sd-adapt-shared.h"
When configuring with sanitizers enabled, ./configure.ac sets
-DVALGRIND=1 in the CFLAGS.

This causes a compilation error later:

  $ /bin/sh ./libtool  --tag=CC   --mode=compile gcc ... -DVALGRIND=1 ... src/dhcp/nm-dhcp-nettools.c
  ...
  In file included from src/dhcp/nm-dhcp-nettools.c:16:
  ./shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:73: error: "VALGRIND" redefined [-Werror]
   #define VALGRIND 0

(cherry picked from commit 3c581cbb78)
2020-05-13 17:24:30 +02:00
Beniamino Galvani
f8452b48e9 cli: unref main loop after destroying NMClient instance
Callbacks might reference the main loop when destroying the NMClient
instance. Unref the main loop later.

  # G_DEBUG=fatal-warnings valgrind --num-callers=100 nmcli device wifi connect home
  ^C
  Error: nmcli terminated by signal Interrupt (2)
  Error: Connection activation failed: (0) No reason given.
  ==11050== Invalid read of size 4
  ==11050==    at 0x4C90D3D: g_main_loop_quit (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x431435: quit (devices.c:934)
  ==11050==    by 0x43272C: connected_state_cb (devices.c:1919)
  ==11050==    by 0x4BF6741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C0A603: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C133AD: g_signal_emit_valist (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C139D2: g_signal_emit (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFB1C3: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFAAEC: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFD86A: g_object_thaw_notify (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x48BA040: _nm_client_notify_event_emit (nm-client.c:937)
  ==11050==    by 0x48CA01F: _dbus_handle_changes_commit (nm-client.c:2850)
  ==11050==    by 0x48CC221: _dbus_handle_changes (nm-client.c:2864)
  ==11050==    by 0x48CC833: _init_release_all (nm-client.c:6969)
  ==11050==    by 0x48D2818: dispose (nm-client.c:7826)
  ==11050==    by 0x4BFBC27: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x43FF93: nmc_cleanup (nmcli.c:941)
  ==11050==    by 0x4410AD: main (nmcli.c:1005)
  ==11050==  Address 0x54738fc is 12 bytes inside a block of size 16 free'd
  ==11050==    at 0x4839A0C: free (vg_replace_malloc.c:540)
  ==11050==    by 0x4C9649C: g_free (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x4410A3: main (nmcli.c:1004)
  ==11050==  Block was alloc'd at
  ==11050==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
  ==11050==    by 0x4C96400: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x4C90A45: g_main_loop_new (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x441020: main (nmcli.c:987)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/501
(cherry picked from commit 211c6fa795)
2020-05-12 23:02:48 +02:00
Thomas Haller
ba6642a478
contrib/rpm: log MD5/SHA sums of release tarball during build_clean.sh
When doing a release, we should care about the checksum of the tarball.
Log all of them... also, because fedpkg uses sha512, ftpadmin@gnome uses
sha256, etc.

(cherry picked from commit 3f6f7b06c6)
2020-05-08 15:24:57 +02:00
Thomas Haller
113f99e3b5
release: bump version to 1.24.1 (development) 2020-05-08 13:05:02 +02:00
Thomas Haller
ea141ba8f8
release: bump version to 1.24.0 2020-05-08 13:04:27 +02:00
Thomas Haller
d7b63a8a8a
NEWS: update 2020-05-08 13:03:27 +02:00
Thomas Haller
747f7d3818
all: use "int/char" instead of "gint/gchar" typedefs
This is also recommended by our checkpatch.pl script.

(cherry picked from commit 2929392855)
2020-05-08 12:57:11 +02:00
Benjamin Porter
1b551ad1c3
man: extents -> extends in man page
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/497
(cherry picked from commit f6e41c19ff)
2020-05-08 08:07:10 +02:00
Thomas Haller
1e1ae9ba07
acd: fix char buffer argument to _acd_event_to_string_buf()
(cherry picked from commit 6e9967939b)
2020-05-08 07:58:12 +02:00
Thomas Haller
ecb9e0e3df
acd: avoid alloca() inside an unbounded loop
(cherry picked from commit b447c80ad8)
2020-05-07 14:02:23 +02:00
Beniamino Galvani
5b88cb6d98 merge: branch 'bg/coverity'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/495
(cherry picked from commit be3549abbd)
2020-05-07 10:54:20 +02:00
Beniamino Galvani
63e0ed1a08 libnm: remove early return statement in test_nm_auth_permissions()
Reported by coverity:

>>> CID 210230: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "i = 0;".

Fixes: 09e17888f7 ('libnm: add mapping functions between string and NMClientPermission enum')
(cherry picked from commit a29b13c7f1)
2020-05-07 10:53:59 +02:00
Beniamino Galvani
bb40de0ca0 ifcfg-rh: check return value of fdopen()
Reported by coverity:

>>> CID 210222: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "NULL" "f" when calling
    "fseek".

Fixes: ac5206aa9c ('2007-11-21')
(cherry picked from commit 581aa981c2)
2020-05-07 10:53:54 +02:00
Beniamino Galvani
144e7e40f0 libnm: fix assertion in NML_IS_DBUS_OBJECT()
Reported by coverity:

>>> CID 210228: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "dbobj" suggests that it may be null, but it has
    already been dereferenced on all paths leading to the check.

Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
(cherry picked from commit 272f19108b)
2020-05-07 10:53:52 +02:00