Commit graph

27704 commits

Author SHA1 Message Date
Thomas Haller 7e8809a9c5
cloud-setup/tests: add unit test for nm-cloud-setup 2021-02-10 18:23:44 +01:00
Thomas Haller bbd36be44a
cloud-setup: fix replacing IPv4 addresses during update
If previously the profile would track two addresses ("10.116.1.130/24",
"10.116.1.65/24"), and during an update the second address was removed
(leaving "10.116.1.130/24"), then the addresses of the profile were
wrongly not changed.

The effect is that removing a secondary IP address might not take
effect.

Fix that.

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

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
2021-02-10 18:23:44 +01:00
Thomas Haller 94a75c8cd6
cloud-setup: build intermediate library "libnm-cloud-setup-core.a"
Next we'll add unit tests, hence we need to link against the code
but we don't want to compile it twice.
2021-02-10 18:23:44 +01:00
Thomas Haller 8d6bd2f6c0
shared/tests: add nmtst_rand_perm_strv() helper 2021-02-10 18:23:44 +01:00
Thomas Haller 826d4fd7a9
shared/tests: add nmtst_ip_address_new() helper 2021-02-10 18:23:44 +01:00
Thomas Haller dfddab88ac
gitignore: ignore *.a files 2021-02-10 18:23:43 +01:00
Yuri Chornoivan d24ad0a202
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/749
2021-02-10 17:52:06 +01:00
Beniamino Galvani 020a2707c4 dhcp: nettools: export broadcast and server-id options
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/426
2021-02-10 09:13:03 +01:00
Thomas Haller 5e6d6c0764
build/meson: include subdir "libnm" before "src/core"
No big change, but eventually I' like to move all source
directories under src/. That must be done one after the other,
so the first step is to move libnm-core/ into src/. If libnm
gets loaded in between, that causes odd ordering.

"src/core" should not depend on "libnm" and vice versa, so this
should have little effect for now.
2021-02-10 08:27:06 +01:00
Thomas Haller b9756df2c6
wifi: merge branch 'balrog-kun:write-iwd-configs' (part 1)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/695
2021-02-09 17:09:43 +01:00
Andrew Zaborowski 9fd0f0c4fa
iwd: Match IWD networks to existing OWE and SAE connection
IWD's "open" networks can be either unsecured or use OWE and "psk"
networks may be using WPA2 personal or WPA3 personal so when looking for
an exsiting NMSettingsConnection matching an IWD KnownNetwork, also
check for these connection key_mgmt types.

Add explicit checks for AP and ADHOC connection modes to exclude OWE and
SAE as they're not supported by IWD in those modes and we don't want to
make it appear like a connection of this type was successfully
activated.
In Infrastructure mode there's won't be any way to know whether IWDxi
established an OWE or unsecured connection (or WPA2-PSK vs. SAE)
regardless of what was set in the NMConnection and it's not considered
to be meaningful (also isn't normally exposed in a GUI) although you
could argue OWE vs. unsecured is a big difference.
2021-02-09 17:09:32 +01:00
Andrew Zaborowski 4aea512b15
iwd: Rename NM_IWD_NETWORK_SECURITY_NONE to _OPEN
IWD doesn't expose on D-Bus, or in the network profile files, the
information on whether a network has no security or uses OWE so they
should be the same thing to the iwd backend (similarly WPA2-Personal and
WPA3-Personal/SAE).  But OWE implies some security against some attacks
so the NONE naming could be misleading.
2021-02-09 17:09:32 +01:00
Andrew Zaborowski ba7a13789f
setting-8021x: Fix descriptions for phase2-auth & phase2-autheap
phase2-auth applies for EAP-TTLS and EAP-PEAP but the interpretation is
different for one than for the other, clarify the difference.
phase2-auth is for the non-EAP inner methods of EAP-TTLS but is also for
the EAP inner methods of EAP-PEAP.  EAP-PEAP doesn't use phase2-autheap
and doesn't support any non-EAP methods.

Given how complicated EAP configuration is it's likely that people just
use example configurations rather than look at the docs.  The example
configuration in man/nm-settings-keyfile.xsl is correct in using PEAP
together with phase2-auth=mschapv2.

[thaller@redhat.com: regenerate documentation files]
2021-02-09 17:09:31 +01:00
Thomas Haller 4fcdd1eb48
all: merge branch 'th/nm-default-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/746
2021-02-09 15:49:42 +01:00
Thomas Haller 7abac1b89a
shared: move redefining G_VARIANT_TYPE() to "nm-glib-aux/nm-default-glib.h"
We redefine G_VARIANT_TYPE() because we don't want to pay a run time
check for what should be a simple cast.

But this is strictly tied to glib, and it must only be done after glib.h
was included. Move it to the right place.
2021-02-09 12:38:19 +01:00
Thomas Haller 318824cb41
libnm: move "nm-version-macros.h" from shared/ to libnm-core/
"nm-version-macros.h" is used directly by libnm-core and indirectly by
libnm and core.

Let's not have it randomly under shared/. Move it closer to where it's
used.
2021-02-09 12:38:19 +01:00
Thomas Haller a2ef576905
shared: move "nm-gassert-patch.h" to "nm-glib-aux" 2021-02-09 12:38:19 +01:00
Thomas Haller c971ee2267
libnm: merge libnm-keyfile into libnm-core
Before there was a licensing conflict between the keyfile code
(libnm-keyfile) and libnm. The latter would require LGPL-2.1+ while
keyfile code was GPL-2.0+.

Consequently we were linking libnm-keyfile into the daemon, but not in
libnm.so.

This conflict has been resolved and keyfile API is part of libnm.so.
There is no more need to build a separate (intermediary) library. Merge
them.

This also makes sense because keyfile code needs access to private code
from libnm-core. It is closely tied to libnm-core, so that building them
separate makes no sense (anymore).
2021-02-09 12:38:19 +01:00
Thomas Haller b13a2b27e9
all: move shared/nm-meta-setting.[hc] to libnm-core and clients
"shared/nm-meta-setting.[hc]" contains meta data about settings.
As such it is similarly used by libnm-core (as internal API) and
by clients (as extension of public API of libnm). However, it must
be compiled twice, because while it defines in both cases a
NMMetaSettingInfo type, these types are different between internal and
public API.
Hence, the files must also be compiled twice (and differently), once
against libnm-core and once against the client helper library.

Previously, the file was under "shared/", but there it's a bit odd
it doesn't clearly belong anywhere.

There are two goals here:

 - copy the file to the two places where it is used. We also have
   a "check-tree" unit test that ensures those files don't diverge in
   the future.

 - we no longer require CFLAGS set during built. Instead, the sources
   should control the build. For that we have new (simple) headers
   "nm-meta-setting-base.h" that define the right behavior for the
   impl files.

There is still an ugliness (among several): the files must be named the
same for libnm-core and clients/common. Preferably, all our sources have
unique names, but that is not possible with this scheme (without
introducing other ugliness). To mitigate that, include the files only at
one exact place.
2021-02-09 12:38:19 +01:00
Thomas Haller 789347e0d6
shared: copy file instead of symlink "nm-ethtool-utils.h"
"nm-ethtool-utils.h" is part of public API in libnm(-core). It is also
used by shared/nm-base, which must have no dependency on libnm-core.

This was previously solved by symlinking the file. I find that error
prone, because the user might edit one file, without realizing that the
other file also changes.

Instead, copy the file and have it twice. Note that we have a unit test
which checks that both files are (and state) the same.

Copy+paste is a valid way of reusing code. By checking that the copy
does not diverge from the original, the downsides of copy+paste are
mitigated.
2021-02-09 12:38:19 +01:00
Thomas Haller 83a97f887b
tests: add "tools/check-tree.sh" script for checking consistency of sources
Our source tree also has certain consistency requirements. Since the
source is in git, this is a rather static check. However, we want to
ensure that future changes don't break it by adding a test.
2021-02-09 12:38:18 +01:00
Thomas Haller fa3ac35031
shared: remove unused "shared/nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller 66eccf7ad7
all: add "nm-default-systemd{,-shared}.h" as replacement for "nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller dc2afc9b77
all: add "src/core/nm-default-daemon.h" as replacement for "nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller 78629830c8
all: add "libnm-core/nm-default-libnm-core.h" as replacement for "nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller a38afcb1d9
all: add "libnm/nm-default-libnm.h" as replacement for "nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller 606612ea59
all: add "libnm/nm-default-client.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
Thomas Haller 8f4f91b667
all: add "nm-glib-aux/nm-default-glib-i18n-prog.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
Thomas Haller bbb86cc11a
all: add "nm-glib-aux/nm-default-glib-i18n-lib.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
Thomas Haller d69f12f9e7
all: add "nm-glib-aux/nm-default-glib.h" as replacement for "nm-default.h" 2021-02-09 12:38:17 +01:00
Thomas Haller dbdac49b81
all: add "nm-std-aux/nm-default-std.h" as replacement for "nm-default.h"
autotools projects commonly should include "config.h" as first header.
Also, commonly we need more headers, like glib.h or our nm_auto macros.
Hence, almost all our sources should as first include "nm-default.h".

However, as we build different parts, "nm-default.h" gets controlled
by the NETWORKMANAGER_COMPILATION define which autotools/meson needs
to specify in the build options.

That is confusing.

One advantage of that was, that theoretically the same sources can
be built twice, with different behavior. However, we should avoid doing
that altogether and build static libraries (once) that we link multiple
times.

Another advantage was that if NETWORKMANAGER_COMPILATION is for example
set to build a DAEMON source, there is a check that we don't include
private headers from libnm-core. However, that should be better solved
by not having public, internal and private headers in the same
directory.

Instead, introduce different "nm-default-*.h" headers that don't require
special defines and behave in a consistent way. This way, we require
fewer CFLAGS and it's immediately clear by looking at the source alone
which headers are included. Also, you will be easier see when a wrong
nm-default-*.h header gets included.

Introduce the first replacement. The others will follow.
2021-02-09 12:38:17 +01:00
Thomas Haller 021e87c084
shared: add "shared/nm-std-aux/nm-networkmanager-compilation.h" header 2021-02-09 12:38:17 +01:00
Thomas Haller 37075878a7
libnm: compile keyfile code like libnm-core
By now, keyfile code got relicensed as LGPL-2.1+ and is just a regular part
of libnm-core (in particular, because it uses private API of libnm-core).

It should no longer be in a separate directory, but for now, at lead compile
it the same as libnm-core.
2021-02-09 12:38:17 +01:00
Thomas Haller 6cbc2d715f
shared/tests: don't include "nm-default.h" in test utils and remove compile check
Remove the check for NETWORKMANAGER_COMPILATION and NETWORKMANAGER_COMPILATION_TEST
define. We will no longer define that, and the check will be wrong.
2021-02-09 12:38:16 +01:00
Thomas Haller ed9ff9c3df
build: remove unused "nm-core-enum-types.[hc].template" files 2021-02-09 12:38:16 +01:00
Thomas Haller 0bcd453e8c
initrd/tests: drop special define for test directory
We got rid of all these redundant defines. All we need, is the base
source directory, which we already define in config.h as
NM_BUILD_SRCDIR. Use that.
2021-02-09 12:38:16 +01:00
Thomas Haller a4ca3acb6b
build: drop duplicate line from Makefile.am 2021-02-09 12:38:16 +01:00
Thomas Haller 1b8ef3282c
core/dhcp: don't include "nm-sd-adapt-shared.h" in "nm-dhcp-nettools.c"
The adapter header is not for direct inclusion. It's only for
the systemd sources.
2021-02-09 12:38:16 +01:00
Thomas Haller 5f47a2d44d
build/meson: cleanup clients/***/meson.build 2021-02-09 12:38:16 +01:00
Thomas Haller a9202a0f3d
build/meson: cleanup dispatcher/meson.build 2021-02-09 12:38:16 +01:00
Thomas Haller ab2dcc3289
meson/build: fix c_args for libnmc
This used c_flags, which was previously defined by dispatcher/meson.build,
something unrelated entirely.
2021-02-09 12:38:16 +01:00
Beniamino Galvani 16d649ea92 wifi: auto-activate devices as soon as the first scan finishes
Currently if we detect that a scan finished in
_scan_notify_is_scanning(), we call immediately _scan_kickoff() (which
might start a new scan) and then we check again whether the device can
autoactivate or whether to remove the wifi-scan pending action.

This means that if the scan takes long enough, when
_scan_notify_is_scanning() is called, it is already time to start
another scan and the device activation will be delayed. It will be
delayed until the scan duration becomes shorter than the
exponentially-growing periodic scan interval.

Fix this by delaying the next scan immediately after a scan result.

Co-authored-by: Thomas Haller <thaller@redhat.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/574
2021-02-09 08:55:52 +01:00
Thomas Haller 60800b33b4
all: drop unnecessary cast of g_object_new()
Our cast macros (like NM_AUTH_SUBJECT()) are plain C pointer casts,
unless when building with more asserts enabled.

Still, they are unnecessary and even their ability to check the type
(with more asserts) is not needed, because we must trust glib's
g_object_new() to return reasonable objects. That is a basic
requirement, that we don't need to assert against.

Also, in the majority of cases we don't do this either.
2021-02-08 17:02:09 +01:00
Thomas Haller 0177cb9ade
clients/tests: better explain how to configure localized tests 2021-02-08 16:38:54 +01:00
Thomas Haller 1a629a11ce
NEWS: update 2021-02-08 16:32:17 +01:00
Thomas Haller f72278eff7
ethtool: add more offload features that kernel supports
New features:

 - ethtool.feature-macsec-hw-offload
 - ethtool.feature-rx-gro-list
 - ethtool.feature-rx-udp-gro-forwarding
 - ethtool.feature-tls-hw-rx-offload
 - ethtool.feature-tx-gso-list
 - ethtool.feature-tx-tunnel-remcsum-segmentation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/735
2021-02-08 15:11:11 +01:00
Thomas Haller 4f9a7f883e
systemd: merge branch systemd into master 2021-02-08 14:18:59 +01:00
Beniamino Galvani 26aab27587 dhcp: merge branch 'bg/dhcp6-pd-stateless'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/647
2021-02-08 11:15:16 +01:00
Beniamino Galvani 6ed95bd8e5 dhcp: fix requesting prefixes in stateless mode
According to RFC3315 section 15.12, Information-request messages can't
include a IA option (such as IA_NA or IA_PD).

When doing stateless DHCPv6, we start the client in the appropriate
mode to issue an Information-request message: with "-S" for dhclient or
calling sd_dhcp6_client_set_information_request(TRUE) for systemd.

However, if we need a prefix later, the client must be restarted to
ask the prefix. Currently both dhclient and systemd clients are still
configured to send an Information-request with prefixes. Fix that.
2021-02-08 11:14:52 +01:00
Beniamino Galvani 1460054815 device: preserve the DHCPv6 mode when renewing the lease 2021-02-08 11:14:52 +01:00