Commit Graph

27815 Commits

Author SHA1 Message Date
Beniamino Galvani
f7f4db156f supplicant: detect the SAE interface capability
There isn't a global SAE capability in wpa_supplicant, use the
per-interface one.
2021-02-23 10:22:09 +01:00
Thomas Haller
5747bdb8b8 wwan: fix leaking "bearer" in connect_ready()
Fixes: 105ee6e5a9 ('device: fix crash by handling connection cancellation')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/669
2021-02-23 07:23:41 +01:00
Thomas Haller
e3a7f29e2a iwd: make static variable in object_compare_interfaces() "const" 2021-02-22 13:15:58 +01:00
Jan Palus
2e0752b1bf iwd: terminate interface_order array with NULL
fixes segfault with iwd backend after upgrade to NetworkManager 1.30.0

Signed-off-by: Jan Palus <jpalus@fastmail.com>

Fixes: 43fd93d8f4 ('iwd: Order objects from g_dbus_object_manager_get_objects')
2021-02-22 13:11:16 +01:00
Thomas Haller
1e81827e6f platform/tests: relax unit test for setting IFLA_BR_FORWARD_DELAY/forward_delay
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/665

Fixes: e9278d8659 ('platform/tests: ignore failure for adding bridge with iproute2')
2021-02-21 20:08:13 +01:00
Beniamino Galvani
933e6c140e wifi: merge branch 'georgmu/NetworkManager-ap-disable-wps'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/756
2021-02-19 15:26:57 +01:00
Georg Müller
ba8c61fe9a supplicant: disable wps in wpa supplicant if disabled in config
Before this commit, in AP mode, WPS is started by default and there is no
possibility to disable it. The methods provided as WPS sources seem to
differ from device to device. With some Wifi USB sticks running in AP mode,
the WPS config methods contain "Keypad". Then, I get a pin entry dialog on
Windows machines, even if no pin is configured.

This merge request wires the existing 802-11-wireless-security.wps-method
with wpa_supplicant's configuration to allow disabling WPS.
2021-02-19 14:34:19 +01:00
Thomas Haller
124e085376 libnm/build: merge branch 'th/libnm-core-split'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/755
2021-02-19 09:57:15 +01:00
Thomas Haller
341b6e0704 all: change G_LOG_DOMAIN to "nm"
glib requires G_LOG_DOMAIN defined so that log messages are labeled
to belong to NetworkManager or libnm.

However, we don't actually want to use glib logging. Our library libnm
MUST not log anything, because it spams the user's stdout/stderr.
Instead, a library must report notable events via its API. Note that
there is also LIBNM_CLIENT_DEBUG to explicitly enable debug logging,
but that doesn't use glib logging either.

Also, the daemon does not use glib logging instead it logs to syslog.
When run with `--debug`.

Hence, it's not useful for us to define different G_LOG_DOMAIN per
library/application, because none of our libraries/applications should
use glib logging.

It also gets slightly confusing, because we have the static library like
`src/libnm-core-impl`, which is both linked into `libnm` (the library)
and `NetworkManager` (the daemon). Which logging domain should they use?

Set the G_LOG_DOMAIN to "nm" everywhere. But no longer do it via `-D`
arguments to the compiler.

See-also: https://developer.gnome.org/glib/stable/glib-Message-Logging.html#G-LOG-DOMAIN:CAPS
2021-02-18 19:46:57 +01:00
Thomas Haller
243051a8a6 libnm/build: always compile both crypto backends if library available
We want to see that both backends can actually compile -- at least,
if we have the dependencies detected.
2021-02-18 19:46:54 +01:00
Thomas Haller
fdf9614ba7 build: move "libnm-core/" to "src/" and split it
"libnm-core/" is rather complicated. It provides a static library that
is linked into libnm.so and NetworkManager. It also contains public
headers (like "nm-setting.h") which are part of public libnm API.

Then we have helper libraries ("libnm-core/nm-libnm-core-*/") which
only rely on public API of libnm-core, but are themself static
libraries that can be used by anybody who uses libnm-core. And
"libnm-core/nm-libnm-core-intern" is used by libnm-core itself.

Move "libnm-core/" to "src/". But also split it in different
directories so that they have a clearer purpose.

The goal is to have a flat directory hierarchy. The "src/libnm-core*/"
directories correspond to the different modules (static libraries and set
of headers that we have). We have different kinds of such modules because
of how we combine various code together. The directory layout now reflects
this.
2021-02-18 19:46:51 +01:00
Thomas Haller
2c1f8e9108 release: bump version to 1.31.1 (development) 2021-02-18 18:23:42 +01:00
Thomas Haller
1a1606186c NEWS: update 2021-02-18 18:21:24 +01:00
Thomas Haller
fc29a96097 release: bump version to 1.30.0 2021-02-18 18:09:31 +01:00
Thomas Haller
04290879b7 release: fix pattern in release.sh script for checking branch name 2021-02-18 17:53:15 +01:00
Thomas Haller
9e16c4cc94 platform/tests: relax check for signals in test_ip6_route()
/route/ip6: NMPlatformSignalAssert: ../src/core/platform/tests/test-route.c:449, test_ip6_route(): failure to accept signal one time: 'ip6-route-changed-added' ifindex 0 (2 times received)

(cherry picked from commit 39c3eacb7d)
2021-02-18 17:47:13 +01:00
Thomas Haller
39c3eacb7d platform/tests: relax check for signals in test_ip6_route()
/route/ip6: NMPlatformSignalAssert: ../src/core/platform/tests/test-route.c:449, test_ip6_route(): failure to accept signal one time: 'ip6-route-changed-added' ifindex 0 (2 times received)
2021-02-18 17:40:27 +01:00
Thomas Haller
a592617717 NEWS: update 2021-02-18 17:20:30 +01:00
Thomas Haller
c5916691c9 NEWS: update 2021-02-18 07:31:55 +01:00
Wen Liang
6b78406460 docs: improve manual page about ipv4.addresses
Signed-off-by: Wen Liang <liangwen12year@gmail.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/738
2021-02-17 17:55:56 +01:00
Thomas Haller
b9bdc680ad build: dist "libnm/nm-enum-types.[ch].template" files
(cherry picked from commit b941686b5a)
2021-02-17 14:24:54 +01:00
Thomas Haller
b941686b5a build: dist "libnm/nm-enum-types.[ch].template" files 2021-02-17 14:24:11 +01:00
Beniamino Galvani
12261f8002 initrd: merge branch 'bg/initrd-timeout'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/559

(cherry picked from commit 2b3acd1045)
2021-02-17 11:29:26 +01:00
Beniamino Galvani
329902339e initrd: support the rd.net.dhcp.retry argument
Since we always set autoconnect-retries=1, use the value of
rd.net.dhcp.retry as a multiplier for the DHCP timeout.

(cherry picked from commit 099ce63888)
2021-02-17 11:29:26 +01:00
Beniamino Galvani
772b213321 initrd: accept 'infinity' as argument to rd.net.timeout.dhcp
(cherry picked from commit 97833237bf)
2021-02-17 11:29:26 +01:00
Beniamino Galvani
936c7c9a78 initrd: set autoconnect-retries=1 and increase default DHCP timeout
By default a connection is retried 4 times before it is blocked from
autoconnecting. This means that if a user specifies an explicit DHCP
timeout in the initrd command line, NM will wait up to 4 times more.

Instead, set the "connection.autoconnect-retries" property of
connections always to 1, so that NM only waits for the time
specified.

Before this commit a default DHCP connection would take at most (45 x
4) seconds. Since the multiplier is now only 1, also increase the DHCP
timeout to have a total time of (90 x 1) seconds, which is the half
than before.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/559
(cherry picked from commit 7e126fe898)
2021-02-17 11:29:26 +01:00
Beniamino Galvani
2b3acd1045 initrd: merge branch 'bg/initrd-timeout'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/559
2021-02-17 11:28:00 +01:00
Beniamino Galvani
099ce63888 initrd: support the rd.net.dhcp.retry argument
Since we always set autoconnect-retries=1, use the value of
rd.net.dhcp.retry as a multiplier for the DHCP timeout.
2021-02-17 11:20:18 +01:00
Beniamino Galvani
97833237bf initrd: accept 'infinity' as argument to rd.net.timeout.dhcp 2021-02-17 11:20:18 +01:00
Beniamino Galvani
7e126fe898 initrd: set autoconnect-retries=1 and increase default DHCP timeout
By default a connection is retried 4 times before it is blocked from
autoconnecting. This means that if a user specifies an explicit DHCP
timeout in the initrd command line, NM will wait up to 4 times more.

Instead, set the "connection.autoconnect-retries" property of
connections always to 1, so that NM only waits for the time
specified.

Before this commit a default DHCP connection would take at most (45 x
4) seconds. Since the multiplier is now only 1, also increase the DHCP
timeout to have a total time of (90 x 1) seconds, which is the half
than before.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/559
2021-02-17 11:20:17 +01:00
Thomas Haller
e258410c87 initrd: cleanup parsing DNS in reader_parse_ip() 2021-02-17 08:48:41 +01:00
Thomas Haller
ea198096eb build: rename build option "--with-polkit-agent-helper-1{-path,}"
Suggested-by: Michael Biebl <biebl@debian.org>
(cherry picked from commit d9968b133b)
2021-02-16 21:55:34 +01:00
Thomas Haller
d9968b133b build: rename build option "--with-polkit-agent-helper-1{-path,}"
Suggested-by: Michael Biebl <biebl@debian.org>
2021-02-16 21:54:54 +01:00
Thomas Haller
ea4c64deea wireguard: merge branch 'th/wireguard-dns-endpoint-sticky-addr'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/754

(cherry picked from commit cd86b462fc)
2021-02-16 14:14:47 +01:00
Thomas Haller
2e00d161b2 wireguard: prefer last resolved IP from resolving endpoint from DNS
We periodically re-resolve the DNS name for entpoints. Since WireGuard
has no concept of being connected, we want to eventually pick up
if the DNS name resolves to a different IP address.

However, on resolution failure, we will never clear the endpoint we
already have. Thus, resolving names can only give a better endpoint,
not remove an IP address entirely.

DNS names might do Round-Robin load distribution and the name of the
endpoint might resolve to multiple IP addresses. Improve to stick to
the IP address that we already have -- provided that the IP address
is still among the new resolution result. Otherwise, we continue to
pick the first IP address that was resolved.

(cherry picked from commit 98348ee539)
2021-02-16 14:14:46 +01:00
Thomas Haller
29336aa2e2 platform: ensure NM_SOCK_ADDR_UNION_INIT_UNSPEC() fully initializes union
In C, initialization of a union does not define that excess memory
is initialized. Ensure that, by initializing the largest member of the
NMSockAddrUnion union.

(cherry picked from commit 7bf2ddf73f)
2021-02-16 14:14:46 +01:00
Thomas Haller
cd86b462fc wireguard: merge branch 'th/wireguard-dns-endpoint-sticky-addr'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/754
2021-02-16 14:05:14 +01:00
Thomas Haller
98348ee539 wireguard: prefer last resolved IP from resolving endpoint from DNS
We periodically re-resolve the DNS name for entpoints. Since WireGuard
has no concept of being connected, we want to eventually pick up
if the DNS name resolves to a different IP address.

However, on resolution failure, we will never clear the endpoint we
already have. Thus, resolving names can only give a better endpoint,
not remove an IP address entirely.

DNS names might do Round-Robin load distribution and the name of the
endpoint might resolve to multiple IP addresses. Improve to stick to
the IP address that we already have -- provided that the IP address
is still among the new resolution result. Otherwise, we continue to
pick the first IP address that was resolved.
2021-02-16 13:58:31 +01:00
Thomas Haller
7bf2ddf73f platform: ensure NM_SOCK_ADDR_UNION_INIT_UNSPEC() fully initializes union
In C, initialization of a union does not define that excess memory
is initialized. Ensure that, by initializing the largest member of the
NMSockAddrUnion union.
2021-02-16 13:52:52 +01:00
Thomas Haller
b3909c36f6 policy: update vendor-URL for NetworkManager in polkit policy
The previous URL http://www.gnome.org/projects/NetworkManager/
now redirects to https://wiki.gnome.org/Apps, which isn't very
useful.

Instead, link to our NetworkManager page. The page is still sparsely
populated, but we should improve that.
2021-02-16 11:32:31 +01:00
Thomas Haller
8c04f72e36 contrib/rpm: update URL for NetworkManager in RPM package
The previous URL http://www.gnome.org/projects/NetworkManager/
now redirects to https://wiki.gnome.org/Apps, which isn't very
useful.

Instead, link to our NetworkManager page. The page is still sparsely
populated, but we should improve that.
2021-02-16 11:29:24 +01:00
Thomas Haller
c7fa8d0a16 platform: downgrade severity of message for failure to create NMPNetns
Under restricted permissions (like inside a podman container) opening
"/proc/self/ns/net" fails with Permission denied. Consequently we cannot
create our bottom NMPNetns instance. That is mostly fine, however we
would log an error message with severity <error>.

Note that test "src/core/platform/tests/test-platform-general" asserts
that no <warn> and <error> messages get logged. Hence, the test will
fail.

That is undesirable. Downgrade the message to <debug> so that the test
passes. Also, it's not clear that this error message is useful here.
Being unable to open a netns fd is fine and not necessarily an error
condition.

(cherry picked from commit 0213300dce)
2021-02-15 21:18:06 +01:00
Thomas Haller
f6c07c39e4 platform: reorder code in _netns_stack_get_impl()
We should always register the GArray stack with pthread
for cleanup the thread local storage. Do that first, before
creating the NMPNetns instance at the bottom of the stack.

(cherry picked from commit f9636080ac)
2021-02-15 21:18:05 +01:00
Thomas Haller
4113e93b3b platform/tests: skip tests if "unshare(CLONE_NEWNET|CLONE_NEWNS)" fails
Inside a podman container (without `--priviledged`) we don't have
permissions for "unshare(CLONE_NEWNET|CLONE_NEWNS)".

It's not useful to fail tests in environments where they cannot run.
Skip them.

(cherry picked from commit ecdbb1ab84)
2021-02-15 21:18:04 +01:00
Thomas Haller
0213300dce platform: downgrade severity of message for failure to create NMPNetns
Under restricted permissions (like inside a podman container) opening
"/proc/self/ns/net" fails with Permission denied. Consequently we cannot
create our bottom NMPNetns instance. That is mostly fine, however we
would log an error message with severity <error>.

Note that test "src/core/platform/tests/test-platform-general" asserts
that no <warn> and <error> messages get logged. Hence, the test will
fail.

That is undesirable. Downgrade the message to <debug> so that the test
passes. Also, it's not clear that this error message is useful here.
Being unable to open a netns fd is fine and not necessarily an error
condition.
2021-02-15 21:13:29 +01:00
Thomas Haller
f9636080ac platform: reorder code in _netns_stack_get_impl()
We should always register the GArray stack with pthread
for cleanup the thread local storage. Do that first, before
creating the NMPNetns instance at the bottom of the stack.
2021-02-15 21:11:13 +01:00
Thomas Haller
ecdbb1ab84 platform/tests: skip tests if "unshare(CLONE_NEWNET|CLONE_NEWNS)" fails
Inside a podman container (without `--priviledged`) we don't have
permissions for "unshare(CLONE_NEWNET|CLONE_NEWNS)".

It's not useful to fail tests in environments where they cannot run.
Skip them.
2021-02-15 21:11:13 +01:00
Thomas Haller
67b0deffac tests: add "/bin:/sbin" to "$PATH" for unit tests
We call `tc` from iproute2, which commonly is at "/sbin/tc".
That might not be in the "$PATH" of a regular user, and consequently
we fail to run the test.

Work around that by always adding "/bin" and "/sbin" to the $PATH.

(cherry picked from commit f591aa41c6)
2021-02-15 14:03:20 +01:00
Thomas Haller
f591aa41c6 tests: add "/bin:/sbin" to "$PATH" for unit tests
We call `tc` from iproute2, which commonly is at "/sbin/tc".
That might not be in the "$PATH" of a regular user, and consequently
we fail to run the test.

Work around that by always adding "/bin" and "/sbin" to the $PATH.
2021-02-15 13:58:48 +01:00
Thomas Haller
a18155fc23 shared: refactor nm_assert() for NMRefString
- also check consistency of the string.

- disable more expensive check unless running with NM_MORE_ASSERTS>10.

(cherry picked from commit ac1c66eb34)
2021-02-15 10:24:34 +01:00