Commit graph

27428 commits

Author SHA1 Message Date
Beniamino Galvani
ca8162cb41 release: bump version to 1.29.7 (development) 2020-12-23 09:55:22 +01:00
Antonio Cardace
ff6cb8f528
wifi: merge branch 'ac/wpa3eap_suiteb192'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/709
2020-12-22 18:30:34 +01:00
Antonio Cardace
e874ccc917
wifi: add WPA-EAP-SUITE-B-192 support
Add a new key management option to support WPA3 Enteprise wifi
connection.

Only supported with wpa_supplicant for the time being.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-12-22 18:28:56 +01:00
Thomas Haller
ee4f806959
merge branch 'th/gitlab-ci-alpine' (part 3)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/704
2020-12-22 16:34:00 +01:00
Thomas Haller
89c8592f93
libnm: allow opt-out of including system headers in <NetworkManager.h>
In public libnm headers we include some libc/linux headers, although
libnm doesn't strictly need them.

The <linux/*.h> headers conflict with some network headers provided by
libc and they need to be included in the right order. As
<NetworkManager.h> drags in some linux headers, this makes it
unnecessarily complicated.

It also feels ugly to include headers we don't need, only for the
sake of convenience. Allow to opt out.

Also, for internal build, don't do this. When building NetworkManager
we need control about the headers and their order of inclusion.
2020-12-22 16:33:35 +01:00
Thomas Haller
45ed23c46e
libnm: avoid in_addr_t/in6addr use in libnm header
"in_addr_t" and "struct in6_addr" require headers from libc (or linux).

In particular, some libc headers conflict with the linux headers
(or they have to be included in a specific order). To avoid that
we want that our libnm headers include a minimum of other headers
(and only drag in glib headers, which we anyway need).

- instead of "in_addr_t", use guint32. For all practical purposes,
  "in_addr_t" is a plain 32 bit integers and we can do this replacement
  in our public headers.

- forward declare "struct in6_addr".
2020-12-22 16:33:34 +01:00
Thomas Haller
0fca809bfd
all: explicit include <linux/if_{ether,infiniband,vlan}.h> as needed
Currently libnm headers include <linux/if_{ether,infiniband,vlan}.h>.
These are public headers, that means we drag in the linux header to all
users of <NetworkManager.h>.

Often the linux headers work badly together with certain headers from libc.
Depending on the libc version, you have to order linux headers in the right
order with respect to libc headers.

We should do better about libnm headers. As a first step, assume that
the linux headers don't get included by libnm, and explicitly include
them where they are needed.
2020-12-22 16:33:33 +01:00
Thomas Haller
e711aa1423
core: avoid "__u32","__u8" types in "src/nm-manager.c"
These typedefs are defined by some libc headers, and we drag
them in by including some other standard headers.

It's not clear which headers we exactly need for them, and that
all libcs provide them the same.

Instead, just avoid them.
2020-12-22 16:33:32 +01:00
Thomas Haller
90704dafae
libnm: include "nm-core-enum-types.h" in libnm headers with quotes
In C, includes with <> are for system headers, while "" prefers the
current working directory (implementation defined).

For libnm headers that include other libnm headers, we tend to use
"" instead of <>. That makes sense to me. Be consistent about that.
2020-12-22 16:33:27 +01:00
Fernando Fernández Mancera
871c34d94e Merge branch 'missing_veth_prop' into 'master'
nmtui: list veth devices when creating the connection

See merge request NetworkManager/NetworkManager!708
2020-12-22 09:46:17 +00:00
Fernando Fernandez Mancera
cf89e428af nmtui: fix listing veth devices on nmtui
When activating a connection using nmtui, veth connections where not
being listed. This patches fixes this and they are now being listed.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-12-21 11:29:32 +01:00
Beniamino Galvani
2fa8ef9fb9 ovs: fix indentation
Fixes: ec7d8ddb29 ('ovs: fix leaks')
2020-12-18 17:20:25 +01:00
Beniamino Galvani
725cebc528 hostname: merge branch 'bg/hostname-dns-fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/710/
2020-12-18 17:17:50 +01:00
Beniamino Galvani
12df3efccd hostname: start a new lookup every time the DNS configuration changes
If the DNS configuration changes, the hostname previously determined
via reverse DNS lookup could be stale. Clear the resolver data of every
interface and try again.

Fixes: 09c8387114 ('policy: use the hostname setting')
2020-12-18 11:13:19 +01:00
Beniamino Galvani
785aef7103 device: log dns resolver state as string 2020-12-17 14:32:31 +01:00
Beniamino Galvani
ec7d8ddb29 ovs: fix leaks
Fixes: 1eeca3c606 ('core/ovs: track external-ids for cached ovsdb objects')
2020-12-15 10:59:31 +01:00
Beniamino Galvani
a60ea8af7d merge branch 'ffmancera/eth_prio'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/707
2020-12-14 18:08:48 +01:00
Fernando Fernandez Mancera
b19b800c95 libnm: adjust nm_device_get_type_description for Veth
Veth interfaces should be shown as Ethernet from
nm_device_get_type_description in order to provide backward
compatibility.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-12-14 17:35:07 +01:00
Fernando Fernandez Mancera
3dc202579e libnm: NMDeviceEthernet uses PRIO_20 instead of PRIO_30
As NMDeviceVeth has a NMDeviceEthernet as parent, it should use PRIO_20
in order to report NMDeviceVeth when configured and do not report
NMDeviceEthernet.

An unit test case has been added.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-12-14 17:35:07 +01:00
Beniamino Galvani
c7a470dd66 release: bump version to 1.29.6 (development) 2020-12-14 15:29:03 +01:00
Beniamino Galvani
53fa956004 Revert "ovs: clean up interfaces from ovsdb at startup"
The commit breaks ovs system interfaces on daemon restart. Revert the
change until a better solution is found.

This reverts commit e5113a7fd9.
2020-12-14 13:35:34 +01:00
Thomas Haller
590211a669
merge branch 'th/gitlab-ci-alpine' (part 2)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/704
2020-12-13 21:26:00 +01:00
Rasmus Thomsen
6a009610a6
systemd: don't use qsort_r() on musl
[thaller@redhat.com: modified original patch]
2020-12-13 21:25:46 +01:00
Rasmus Thomsen
b28c9e4535
systemd: add missing definitions for __compar_d_fn_t with musl 2020-12-13 21:25:46 +01:00
Thomas Haller
4cf41a43fd
systemd: don't include <printf.h>
It doesn't exist on alpine/musl.
2020-12-13 21:25:39 +01:00
Thomas Haller
d828f5b021
systemd: include <fcntl.h> instead of <sys/fctnl.h>
On alpine/musl we get a compiler warning:

    CC       shared/systemd/src/basic/libnm_systemd_shared_la-env-file.lo
  In file included from ../shared/systemd/src/basic/fileio.h:9,
                   from ../shared/systemd/src/basic/env-file.c:10:
  /usr/include/sys/fcntl.h:1:2: error: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Werror=cpp]
      1 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
        |  ^~~~~~~
2020-12-13 17:10:54 +01:00
Rasmus Thomsen
d38b5d92ee
shared/nm-glib-aux: don't use RTLD_DEEPBIND on musl
[thaller@redhat.com: original patch modified]
2020-12-13 17:10:53 +01:00
Thomas Haller
712516f2ac
shared: fix _POSIX_C_SOURCE not being defined for nm-errno.c
This is the case with musl.

Based-on-patch-by: Rasmus Thomsen <oss@cogitri.dev>
2020-12-13 17:10:53 +01:00
Thomas Haller
ba4142b328
libnm: replace <netinet/ether.h> by <net/ethernet.h>/<net/if_arp.h> in "nm-utils.c"
Including <netinet/ether.h> with musl leads to a conflict with <linux/if_ether.h>,
due to redefining ethhdr struct. As we include <linux/if_ether.h> in "nm-utils.h",
that is a problem.

Avoid that, by including other headers.
2020-12-13 17:07:42 +01:00
Thomas Haller
7f4a7bf433
all: remove unnecessary <netinet/ether.h> includes
<netinet/ether.h> with musl defines ethhdr struct, which conflicts
with <linux/if_ether.h>. The latter is included by "nm-utils.h",
so this is a problem.

Drop includes of "netinet/ether.h" that are not necessary.
2020-12-13 16:56:51 +01:00
Thomas Haller
0a730fe0ea
core: log whether assertions are enabled for the build 2020-12-11 18:41:47 +01:00
Thomas Haller
344247cdc1
gitlab-ci: merge branch 'th/gitlab-ci-alpine' (part 1)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/704
2020-12-11 18:28:26 +01:00
Thomas Haller
a1002bd93a
gitlab-ci: enable test build on alpine linux
Alpine is especially interesting because it uses musl as libc.

The build does not yet succeed. There are several issues that
need to be fixed.

However, it will be simpler to fix things, if we have tests
in place -- even if at the moment they are known to be broken.

See-also: https://git.alpinelinux.org/aports/tree/community/networkmanager?h=master
2020-12-11 18:14:10 +01:00
Thomas Haller
a6e234349c
gitlab-ci: update used "ci-templates" version 2020-12-11 18:14:10 +01:00
Thomas Haller
4ce62b6df3
gitlab-ci: fix failure to enable PowerTools on CentOS8 build
Seems that the repository was renamed (or can sometimes have
a different name). Try both the "PowerTools" and "powertools" name.
2020-12-11 18:06:52 +01:00
Thomas Haller
77a6fde1e2
man,cloud-setup: merge branch 'th/man-nm-cloud-setup'
https://bugzilla.redhat.com/show_bug.cgi?id=1867997
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/600

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/701
2020-12-11 17:37:56 +01:00
Thomas Haller
a4f1fa0893
man: add man 8 nm-cloud-setup
https://bugzilla.redhat.com/show_bug.cgi?id=1867997
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 600
2020-12-11 17:36:38 +01:00
Thomas Haller
be8a3f9902
cloud-setup: simplify cancellation in _get_config_fetch_cancelled_cb()
If we call g_cancellable_connect() on a GCancellable that is already
cancelled, then the callback is invoked synchronously. We need to
handle that.

However, we can slightly simplify the code. There is no change in
behavior, but we can always let the cancelled callback return the
result.
2020-12-11 17:36:37 +01:00
Thomas Haller
422ab25626
cloud-setup: in EC2's _get_config_task_maybe_return() cancel internal requests on any error
"iface_data->cancellable" is an internal cancellable for the parallel
HTTP requests. Once we encounter a failure, those requests are all
obsolete and must be cancelled.
2020-12-11 17:36:37 +01:00
Thomas Haller
399c04e810
cloud-setup: fix handling cancellation of internal GET operation for EC2 provider
There are two GCancellable at work: one is provided by the user
during nmcs_provider_get_config(), and one is used internally for the
individual HTTP GET requests.

In _get_config_fetch_done_cb(), if the error reason is "cancelled",
then it means that our internal iface_data->cancellable was cancelled.
Probably because an error happend (like a timeout or the user cancelled
the external GCancellable).

In that case, we must not report that the task completed with a
cancellation, because we need to preserve the error that was the
original cause.
2020-12-11 17:36:37 +01:00
Thomas Haller
d07cd5dbf2
all: avoid GNU "which" from shell scripts
"which" is a separate package and may not be installed.
Also, shell has a built-in command for the same purpose.
Use that.
2020-12-11 16:42:23 +01:00
Thomas Haller
b9d4026f85
tools: improve detection of "ci-fairy" command in "tools/check-gitlab-ci.sh"
The previous implementation would print

    ./tools/check-gitlab-ci.sh: line 22: ci-fairy: command not found

also, it's not nice to execute the program, just to find out whether
we have it.
2020-12-11 16:08:47 +01:00
Thomas Haller
3c39ab8836
tests: skip "check-local-gitlab-ci" test on gitlab-ci 2020-12-11 16:08:47 +01:00
Thomas Haller
76f3cf41ac
tests: allow to skip check-local-gitlab-ci via "$NMTST_SKIP_CHECK_GITLAB_CI"
This will be used on our gitlab-ci tests. We do have a separate,
dedicated test on gitlab-ci for checking that "gitlab-ci.yml" is
correct.

We may intentionally want to violate that condition, but then our
`make check` should not fail.

Add a way to skip that test.
2020-12-11 16:08:46 +01:00
Thomas Haller
e5699dbcb7
libnm: suppress "-Warray-bounds" warning in nm_team_link_watcher_new_ethtool()
gcc-11.0.0-0.7.fc34 warns here:

    CC       libnm-core/libnm_core_la-nm-setting-team.lo
  libnm-core/nm-setting-team.c: In function ‘nm_team_link_watcher_new_ethtool’:
  libnm-core/nm-setting-team.c:127:33: error: array subscript ‘NMTeamLinkWatcher[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
    127 |     watcher->ref_count          = 1;
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  libnm-core/nm-setting-team.c:125:15: note: referencing an object of size 16 allocated by ‘g_malloc’
    125 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  libnm-core/nm-setting-team.c:128:33: error: array subscript ‘NMTeamLinkWatcher[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
    128 |     watcher->type               = LINK_WATCHER_ETHTOOL;
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
  libnm-core/nm-setting-team.c:125:15: note: referencing an object of size 16 allocated by ‘g_malloc’
    125 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  libnm-core/nm-setting-team.c:129:33: error: array subscript ‘NMTeamLinkWatcher[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
    129 |     watcher->ethtool.delay_up   = delay_up;
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  libnm-core/nm-setting-team.c:125:15: note: referencing an object of size 16 allocated by ‘g_malloc’
    125 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  libnm-core/nm-setting-team.c:130:33: error: array subscript ‘NMTeamLinkWatcher[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
    130 |     watcher->ethtool.delay_down = delay_down;
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
  libnm-core/nm-setting-team.c:125:15: note: referencing an object of size 16 allocated by ‘g_malloc’
    125 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe we should not use this trick and just malloc() a struct of the
intended size, however:

 - the code below does a similar thing, doing it differently for ethtool
   watcher is confusing.

 - the NMTeamLinkWatcher is a union which cannot alter its type. In no
   case is it correct to access the fields of the wrong union type. By
   allocating a smaller chunk, valgrind might catch such bugs.
   Also, NMTeamLinkWatcher's definition is private to the C source file,
   in no case must anybody assume that the rest of the buffer actually
   exists.

Hence, workaround the warning by suppressing it.
2020-12-11 16:08:46 +01:00
Thomas Haller
bba81ca13c
libnm: merge branch 'th/ovs-external-ids-for-system-interface'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/702
2020-12-11 09:38:45 +01:00
Thomas Haller
9cc242596d
libnm: allow OVS external-ids also for system interface
Note that reapply currently does not work for OVS system interface.
That is, because the code does not make it easy to implement that.
2020-12-11 09:38:16 +01:00
Thomas Haller
a9bc3eecc6
libnm: move detection/normalization of "connection.slave-type" to a separate function
We allow normalizing the slave-type, but sometimes, we may want to
validate a profile according to the set slave-type.

For example, a "ovs-external-ids" setting should only be allowed for
"connection.slave-type=ovs-interface". But during verify, the slave-type
may be missing and not yet normalized. We need to be able to obtain
the actually used slave-type.
2020-12-11 09:38:12 +01:00
Thomas Haller
e5b8fad96e
build: merge branch 'maxice8:reallocarray-in-stdlib' into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/703
2020-12-10 12:36:45 +01:00
Leo
c992f460c7
build: check for reallocarray in stdlib.h 2020-12-10 12:36:38 +01:00