Commit Graph

32449 Commits

Author SHA1 Message Date
Thomas Haller
6a3db3e121 mailmap: update Jordi's identity 2023-06-28 13:50:25 +02:00
Jordi Mas
08b32641e1 po: update Catalan (ca) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1664
2023-06-28 13:47:41 +02:00
Thomas Haller
c59e7dfdee nm-in-container: install pytest by default
It is useful for running unit tests on NetworkManager-ci.
2023-06-28 12:20:11 +02:00
Thomas Haller
d563b4e009 gitlab-ci: fix setup of debian:9 container
Debian:9 (stretch) is archived. We need to patch the sources.list
for it to be usable.

Although it's end of life, we are still interested, whether we
are able to build with such old compiler. Fix the test.
2023-06-28 12:14:21 +02:00
Thomas Haller
ddcb396495 tests: avoid Python3 f-string in "test-cloud-meta-mock.py"
It breaks tests on Debian:9, which use Python2 still.

Fixes: e1f3acf3a6 ('test-cloud-meta-mock: allow configuring the provider that are mimicked')
2023-06-28 12:14:21 +02:00
Thomas Haller
42689d1c90 systemd/README: improve readme 2023-06-27 19:00:38 +02:00
Fernando Fernandez Mancera
18bf32d913 merge: branch 'ff/fix_bridge_unit'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1672
2023-06-27 17:54:56 +02:00
Fernando Fernandez Mancera
f1992994fc tests: rename controller port unit test and variables
Rename the variables and function name to use conscious language. In
addition, rename `type` and `link_type` variables to `port_type` and
`controller_type` to make it more intuitive.
2023-06-27 17:49:52 +02:00
Fernando Fernandez Mancera
b0b31548d9 tests: fix linux bridge port option test
When configuring the bridge port options the code was checking on port
link type instead of controller link type. In addition, the test is now
being skipped for nm-fake-platform.
2023-06-27 17:49:52 +02:00
Thomas Haller
f08102bf41 contrib: autodetect the Fedora version for "nm-code-format-container.sh" script
From time to time we bump the used clang-format (and Fedora) version.
Previously, we had to change more than one places.

Instead, let the "nm-code-format-container.sh" parse it from ".gitlab-ci/config.yml".
2023-06-27 15:19:01 +02:00
Wen Liang
a705975a9e systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1666
2023-06-27 09:01:36 -04:00
Beniamino Galvani
6bc35621fe docs: merge branch 'bg/device-doc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1671
2023-06-27 14:29:37 +02:00
Beniamino Galvani
7aeadee8b1 docs: add daemon internal documentation
Add documentation about the implementation of the daemon.
2023-06-27 14:29:18 +02:00
Beniamino Galvani
2b8197d0dc docs: add device internal documentation
Add documentation about the implementation of NMDevice.
2023-06-27 14:29:17 +02:00
Beniamino Galvani
c7d5caf81e gitlab: improve issue and merge-request templates 2023-06-27 09:51:46 +02:00
Wen Liang
cf6b7bb096 systemd: update code from upstream (2023-06-13)
This is a direct dump from systemd git.

  $ git clean -fdx && \
    git cat-file -p HEAD | sed '1,/^======$/ d' | bash - && \
    git add .

======

SYSTEMD_DIR=../systemd
COMMIT=5c193a7c3cba491a530556b7143e3a49ef704847

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files -z :/src/libnm-systemd-core/src/ \
                :/src/libnm-systemd-shared/src/ \
                :/src/libnm-std-aux/unaligned-fundamental.h \
                :/src/libnm-std-aux/unaligned.h | \
  xargs -0 rm -f

nm_copy_sd_shared() {
    mkdir -p "./src/libnm-systemd-shared/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/libnm-systemd-shared/$1"
}

nm_copy_sd_core() {
    mkdir -p "./src/libnm-systemd-core/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/libnm-systemd-core/$1"
}

nm_copy_sd_stdaux() {
    mkdir -p "./src/libnm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./src/libnm-std-aux/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/network-common.c"
nm_copy_sd_core "src/libsystemd-network/network-common.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd/sd-device/device-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-device.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-option.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/cgroup-util.h"
nm_copy_sd_shared "src/basic/constants.h"
nm_copy_sd_shared "src/basic/dns-def.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/glyph-util.c"
nm_copy_sd_shared "src/basic/glyph-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/inotify-util.c"
nm_copy_sd_shared "src/basic/inotify-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/label.c"
nm_copy_sd_shared "src/basic/label.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/locale-util.c"
nm_copy_sd_shared "src/basic/locale-util.h"
nm_copy_sd_shared "src/basic/lock-util.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_syscall.h"
nm_copy_sd_shared "src/basic/missing_threads.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/ordered-set.c"
nm_copy_sd_shared "src/basic/ordered-set.h"
nm_copy_sd_shared "src/basic/origin-id.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/ratelimit.c"
nm_copy_sd_shared "src/basic/ratelimit.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.c"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/user-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/fundamental/logarithm.h"
nm_copy_sd_shared "src/fundamental/macro-fundamental.h"
nm_copy_sd_shared "src/fundamental/memory-util-fundamental.h"
nm_copy_sd_shared "src/fundamental/sha256.c"
nm_copy_sd_shared "src/fundamental/sha256.h"
nm_copy_sd_shared "src/fundamental/string-util-fundamental.c"
nm_copy_sd_shared "src/fundamental/string-util-fundamental.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_shared "src/shared/log-link.h"
nm_copy_sd_shared "src/shared/web-util.c"
nm_copy_sd_shared "src/shared/web-util.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
nm_copy_sd_stdaux "src/fundamental/unaligned-fundamental.h"
2023-06-26 10:45:34 -04:00
Thomas Haller
0505a1fc52 platform/trivial: add code comment to NMP_SYSCTL_PATHID_NETDIR_A() 2023-06-26 15:15:59 +02:00
Thomas Haller
f727c233c4 platform: rename NMP_SYSCTL_PATHID_NETDIR() to have "_A" suffix
The macro uses g_alloca(). Using alloca() is potentially dangerous. For
example, it must never be used in an unbounded loop. This should be
immediately obvious from the name, so we don't accidentally use them
in the wrong context.

All other alloca() macros should have such a prefix already. And they
always have to be macros, because you couldn't use alloca() to return
memory from a function.
2023-06-26 15:15:49 +02:00
Javier Sánchez Parra
ee80fabadb po: fix marking "nmtui-radio.c" for translation
Fixes: b3b8323499 ('tui: Enable/disable Wi-Fi and WWAN radios')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1665
2023-06-26 10:42:25 +02:00
Thomas Haller
d63f56d52b settings,libnm: merge branch 'th/settings-version-id'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1667
2023-06-26 10:35:36 +02:00
Thomas Haller
e883ae765f settings: add "version-id" argument to Update2() D-Bus call
We want to guard against concurrent modifications of profiles. We cannot
lock profiles, so what we instead do is expose (and bump) a version ID.
The user can check the version ID, plan ahead what to do, and tell
NetworkManager to only make the modification if no concurrent
modification was done. The conflict can be detected via the version ID.

The Update2() D-Bus call gets a parameter to only allow the request if
the version ID still matches.

nmcli should use this, but it is quite some effort to retry upon
concurrent modification. This is still to do.

Note that the user might make a decision that is based on multiple
profiles. As the new version-id is only per-profile, we cannot guard
against such inter-profile modifications. What would be needed, is a
UpdateMany() call, where we could modify multiple profiles at once, and
the action only takes effect if all version IDs show no concurrent
modification. That's not done yet, and maybe never will be.
2023-06-26 10:35:36 +02:00
Thomas Haller
cf5c576d55 settings,libnm: add version-id to settings/remote connection 2023-06-26 10:35:35 +02:00
Thomas Haller
9bc9fde506 settings: refactor error handling in update_auth_cb() 2023-06-26 10:35:35 +02:00
Beniamino Galvani
454f8fc7d6 gitlab: add template messages for issues and merge requests
Add template messages to help contributors to create issues and merge
requests that are useful and complete.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1669
2023-06-26 10:08:37 +02:00
Thomas Haller
152bc92c4d systemd/README: add hints for reimporting systemd 2023-06-26 09:48:06 +02:00
qyecst
7aebda5631 man: fix description of environment variable NM_CONFIG_ENABLE_TAG
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1670
2023-06-26 09:09:53 +02:00
Miroslav Suchy
8c5aec7a1b contrib/rpm: migrate to SPDX license
Fedora is moving to SPDX standard in naming a licenses.
See https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_2 .

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1668
2023-06-23 10:14:56 +02:00
Thomas Haller
be438ec103 device/trivial: add code comment to _internal_activate_device() about how activation should work 2023-06-15 09:58:24 +02:00
Thomas Haller
3a15a41d6f device/trivial: rename internal identifier carrier_wait_until_ms to have _msec suffix
"_ms" isn't very clear. We should use instead suffices like _sec, _msec, _usec, _nsec.
Rename.
2023-06-15 09:20:57 +02:00
Thomas Haller
85fc59d0e2 release: bump version to 1.43.10 (development) 2023-06-14 18:57:15 +02:00
Thomas Haller
b9231a0e18 core: better handle ignore-carrier=no for bond/bridge/team devices
By default, bond/bridge/team devices ignore carrier, and so do their
ports. However, it can make sense to set '[device*].ignore-carrier' for
the controller device. Meaningfully support that.

This is a follow up to commit 8c91422954 ('device: handle carrier
changes for master device differently'), which didn't fully solve the
problem.

What already works, is that when you set ignore-carrier for the
controller, then after loss of carrier and a carrier wait timeout, the
controller and ports go down. If both the controller and port profiles
have autoconnect disabled, they stay down and that's it. It works as
expected, but is not very useful, because when we want to automatically
react on carrier loss, we also want to automatically reconnect.

For controller profiles, carrier only makes sense when ports are
attached. However, we can (auto) activate controller profiles without
ports. So when the user enables autoconnect for the controller profile,
then the profile will eagerly reconnect. That means, after loss of
carrier, the device goes down and reconnects right away. It means, when
configuring a bond with ignore-carrier=no and autoconnect=yes, then
the sensible thing happens (an immediate reconnect). That is just not
a useful configuration.

The useful way to configure configure ignore-carrier=no for a controller
device, autoconnect on the master must be disabled while being enabled
on the ports. After all, it's the ports that will autoconnect based on
the carrier state and bring up the controller with them.

Note that at the moment when a port decides to autoconnect, the
controller profile is not yet selected. That only happens later during
_internal_activate_device() after searching it with find_master().  At
that point, the port profile checks whether it should autoconnect based
on its own carrier state, and abort if not.

If autoconnect is aborted due to lack of carrier, the profile gets
blocked from autoconnect with reason "failed". Hence, when the carrier
returns, we need to clear any "failed" blocked reasons and schedule
another autoconnect check,

Note that this really only works if the port is itself a simple device,
like an ethernet. If the port is itself a software device (like a bond,
or a VLAN), then the carrier state in _internal_activate_device() is
unknown, and we cannot avoid autoconnect. It's unclear how that could
make sense, if at all.

This setup can be combined with "connection.autoconnect-slaves=yes". In
that case, we have the first port to autoconnect when they get carrier,
bringing up the controller too. Usually the other ports that don't have
carrier would not autoconnect, but with autoconnect-slaves they will.
The effect is, that we autoconnect whenever any of the ports has
carrier, and then we immediately also bring up the ports that don't have
carrier (which we usually would not).

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1658
2023-06-14 18:46:46 +02:00
Thomas Haller
e57b3c8072 cloud-setup: log a warning when no provider is detected
When using nm-cloud-setup (and enabling any providers), then we expect
to also detect a provider. Otherwise, the user is running in an
environment where none of the provider exists (in which case they should
disable nm-cloud-setup) or there is an unexpected failure. In either
case, that's worth a warning message.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1659
2023-06-14 16:24:21 +02:00
Thomas Haller
6f9f90417e ppp: merge branch 'th/pppd-so-rename'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1312

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1660
2023-06-14 16:17:59 +02:00
Thomas Haller
0a7145a061 ppp/autotools: add missing check for symbols of libnm-ppp-plugin 2023-06-14 14:53:31 +02:00
Thomas Haller
84e21d8bbc ppp: fix plugin name for "rp-pppoe.so" with ppp 2.5
Between ppp 2.4.8 and 2.4.9, "rp-pppoe.so" was renamed to "pppoe.so" (and a
symlink created). Between 2.4.9 and 2.5.0, the symlink was dropped.

See-also: b2c36e6c0e

I guess, NetworkManager always meant to use ppp's "(rp-)pppoe.so"
plugin, and never the library from the rp-pppoe project.
If a user actually wants to use the plugin from rp-pppoe project, then
this is going to break.

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

Fixes: afe80171b2 ('ppp: move ppp code to "nm-pppd-compat.c"')
2023-06-14 14:27:25 +02:00
Thomas Haller
3e66c0bde1 ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place,
in "nm-pppd-compat.c", after including the ppp headers. That was nice
and easy.

However, with that way, we could only detect it after including ppp
headers, and given the ugliness of ppp headers, we only want to include
them in "nm-pppd-compat.c" (and nowhere else).

In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it
thus can only be linked into a ppp plugin, not in NetworkManager core
itself. But at some places we will need to know the ppp version, outside
of the ppp plugin and "nm-pppd-compat.c".

Additionally, detect it at configure time and place it in "config.h".
There is a static assert that we are in agreement with the two ways of
detection.
2023-06-14 14:25:44 +02:00
Thomas Haller
dafe66905f core: merge branch 'th/device-match'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1657
2023-06-14 12:02:15 +02:00
Thomas Haller
bd3162ad89 core: allow resetting blocked reason for a device in nm_manager_devcon_autoconnect_blocked_reason_set() 2023-06-14 11:15:52 +02:00
Thomas Haller
6d75b7f348 core: reorder return in find_master()
It feels ugly to set the out arguments, in case we are failing the
function. Note that there is no change in behavior here. This is purely
cosmetic.
2023-06-14 11:15:52 +02:00
Thomas Haller
44076802a9 core: various minor code cleanups around find_master() 2023-06-14 11:15:52 +02:00
Thomas Haller
2b09512481 core: add nm_config_data_get_ignore_carrier_for_port() helper
Will be used later.
2023-06-14 11:15:46 +02:00
Thomas Haller
13690f445a core: rename nm_config_data_get_ignore_carrier() to nm_config_data_get_ignore_carrier_by_device() 2023-06-14 11:07:34 +02:00
Thomas Haller
97d6b7e92a core: add nm_config_data_get_device_config() helper to lookup by match-data 2023-06-14 11:07:34 +02:00
Thomas Haller
ac7b6e532f core: rename nm_config_data_get_device_config_*() variants
The fully generic way to lookup a device config is using the
NMMatchSpecDeviceData. Rename the accessors that operate on a NMDevice
instead.
2023-06-14 11:07:34 +02:00
Thomas Haller
5251806651 core: refactor _match_section_infos_lookup() to accept match_data argument
This makes the code more generic, where _match_section_infos_lookup()
accepts a match_data argument. Previously, it supported two hard-coded
approaches (from-device, from-platform).

Note that _match_section_infos_lookup() still accepts either a
"match_data" or a "device" argument. It might be nicer, if
_match_section_infos_lookup() would only accept "match_data". If a
caller wants lookup by "device", they would need to call
nm_match_spec_device_data_init_from_device() first. However, it's done
this way with a separate "device" argument, because often we don't have
any configuration to search for, and the initialization of the
match-data can be saved. So for the common case where we want to lookup
by "device", we initialize the "match-data" lazy and on demand.
2023-06-14 11:07:34 +02:00
Thomas Haller
ccaecf7f3e core: add nm_match_spec_device_data_init_from_platform() helper 2023-06-14 11:07:34 +02:00
Thomas Haller
798ea93c45 device: add nm_match_spec_device_data_init_from_device() helper
Will be used later.
2023-06-14 11:07:34 +02:00
Thomas Haller
dbb45f14d3 device: add nm_device_get_s390_subchannels() accessor 2023-06-14 11:07:34 +02:00
Thomas Haller
c47d6b17d5 core: replace multiple arguments of nm_match_spec_device() with struct
Struct allow named arguments, which seems easier to maintain instead of
a function with many arguments. Also, adding a new parameter does not
require changes to most of the callers.

The real advantage of this is that we encode all the search parameters
in one argument. And we can add that argument to
_match_section_infos_lookup(), alongside lookup by NMDevice or
NMPlatformLink.
2023-06-14 11:07:34 +02:00
Thomas Haller
cba8eb9784 core: add nm_match_spec_match_type_to_bool() helper to convert enum to boolean
All callers eventually want a boolean instead of a NMMatchSpecMatchType.

I think the NMMatchSpecMatchType enum still has value at the lower
layers, where the enum values are clearer (when reading the code). So
don't drop NMMatchSpecMatchType entirely.

However, let's add nm_match_spec_match_type_to_bool() to convert the
match-type to a boolean to avoid duplicating the code.
2023-06-14 10:49:14 +02:00