Commit graph

33215 commits

Author SHA1 Message Date
Fernando Fernandez Mancera e59dce9488 merge: branch 'systemd' into ff/sync_systemd 2024-04-19 18:16:22 +02:00
Fernando Fernandez Mancera cd87004dfb systemd: update code from upstream (2024-04-19)
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=fa6ea8095855696cf14cb65214020cdcdee79d6b

(
  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-duid-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-client-internal.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-dhcp-duid.c"
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-internal.h"
nm_copy_sd_core "src/libsystemd/sd-device/device-private.c"
nm_copy_sd_core "src/libsystemd/sd-device/device-private.h"
nm_copy_sd_core "src/libsystemd/sd-device/device-util.h"
nm_copy_sd_core "src/libsystemd/sd-device/sd-device.c"
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-dhcp-duid.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-dhcp6-protocol.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/arphrd-util.h"
nm_copy_sd_shared "src/basic/btrfs.c"
nm_copy_sd_shared "src/basic/btrfs.h"
nm_copy_sd_shared "src/basic/cgroup-util.h"
nm_copy_sd_shared "src/basic/chase.h"
nm_copy_sd_shared "src/basic/constants.h"
nm_copy_sd_shared "src/basic/devnum-util.c"
nm_copy_sd_shared "src/basic/devnum-util.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/iovec-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/namespace-util.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/pidref.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"
2024-04-19 17:39:23 +02:00
Beniamino Galvani 0a3917e6a1 merge: branch 'wwan-ipv6-dhcp-fix'
wwan: Perform SLAAC and DNS assignment when IPv6 is set to auto method, even without address from the bearer

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1440
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1918
2024-04-19 07:42:57 +00:00
Pavel Valach 498142d942 wwan: perform SLAAC and DNS assignment when IPv6 is on auto method
This allows SLAAC for IPv6 to be performed, even when no IPv6
address was passed by the bearer. The link-local address will be
assigned, because of do_auto = TRUE.

The commit also allows the DNS assignment to be made statically when
no IPv6 address has been statically assigned yet. This is to be able
to receive IPv6 DNS servers via signalling, where host SLAAC still
needs to be performed for some modems (e.g. some huawei modems).

This also changes the logging so that SLAAC usage is logged
on a separate line.
2024-04-19 07:35:38 +00:00
Pavel Valach 495a64cc3c wwan: use separate gateway variables for IPv6 in stage3_ip_config_start
Even if this is not strictly necessary, it is more in line with
what is done for IPv4 and it prevents the accidental mixup
of address_string values.
2024-04-19 07:35:38 +00:00
Íñigo Huguet 92e19b01ac release: bump version to 1.47.5 (development) 2024-04-19 08:19:10 +02:00
Jan Vaclav 38c799d883 contrib/rpm: use meson by default for builds on rawhide
As part of our plan to deprecate autotools, we will now be using meson
by default to build NM releases on Rawhide.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1905
2024-04-18 13:31:50 +00:00
Íñigo Huguet cb9a3bdf0c merge: branch 'ih/deprec_comment'
man: fix missing deprecation message

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1922
2024-04-18 13:31:00 +00:00
Íñigo Huguet 7427e9d320 man: fix missing deprecation message
In the gtkdoc comments, the text below tags like `Since: 1.2` is
discarded. In the property `autoconnect-slaves` a line indicating its
deprecation was below one of these tags. As a result, it was missing in
the man page. Fix it.

Fixes: 194455660d ('connection: deprecate NMSettingConnection autoconnect-slaves property')
2024-04-18 13:30:31 +00:00
Jan Vaclav 886146b5b1 platform/netlink: use nm_random_get_bytes() for initial seq value
Coverity warns when a time_t is cast to 32-bits -- however, we do not
need to use the time here at all, since it is only used as an initializing value
that is not expected to be a timestamp, and we can use random bytes instead.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1904
2024-04-17 08:30:46 +00:00
Jan Vaclav e42ef92bfa meson: add runtime_dir option
Adds a runtime_dir option to the meson options, which allows the user to
specify the run directory when building. This commit also changes it so
that `/run` is set as the default run directory if building with /usr prefix.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1919
2024-04-15 15:03:35 +02:00
Íñigo Huguet 94756668f9 merge: branch 'ih/ci-distros'
ci: update distributions that we test in the CI

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1913
2024-04-08 06:37:10 +00:00
Íñigo Huguet 56179465df Updated code format
The CI will use Fedora 40 for code formatting check. Update the code
formatting so it passes.
2024-04-08 06:35:20 +00:00
Íñigo Huguet ff101ada3a ci: update distributions that we test in the CI
We had an agreement on what distributions should we test and when. We'll
test in Tier 2 those distros that can potentially use the current
version of NM and in Tier 3 those distros that are still maintained (not
EOL'd).

So, Tier 2 is to catch errors that might be severe because might be
blocking for the distributions planning to use the current NM version,
they must be fixed ASAP, before doing the release if possible. These
"distribution versions" will be different for main branch than for
stable branches:
 - Debian 12 uses NM-1.42, so Debian 12 should be Tier 2 in the branch
   nm-1-42.
 - However, Debian 12 will never use newer stable versions, so it should
   be Tier 3 in main branch.

We want to run the Tier 3 tests even if those distros won't use newer
vesions of NM because they are useful to test NM compilation with older
compilers and tools. Fixing failures here might not be considered
urgent, though.

To save resources from Freedesktop we'll run Tier 1 on every MR and
Tiers 2 and 3 before doing a release, or on demand if we need.
2024-04-08 06:35:20 +00:00
Fernando Fernandez Mancera 0bb37455c3 merge: branch 'bg/fix-compilation'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1911
2024-04-05 13:27:57 +02:00
Beniamino Galvani 9ff7ff28fc dcb: fix test compilation
GCC 14 with LTO generates the following warning:

  src/core/tests/test-dcb.c: In function 'test_dcb_cleanup':
  src/core/tests/test-dcb.c:283:5: error: array subscript _3 is outside array bounds of 'const char *[0:]' [-Werror=array-bounds=]
    283 |     g_assert_cmpstr(expected.cmds[expected.num], ==, NULL);
        |     ^
  src/core/tests/test-dcb.c:14:17: note: while referencing 'cmds'
     14 |     const char *cmds[];
        |                 ^
  src/core/tests/test-dcb.c:261:24: note: defined here 'expected'
    261 |     static DcbExpected expected = {
        |                        ^

Define the commands as a fixed array instead of flexible array member.
2024-04-05 11:40:45 +02:00
Beniamino Galvani d369f55192 libnm-core: avoid compiler warnings in team settings
GCC 14 with LTO complains with:

  In function 'nm_team_link_watcher_new_ethtool',
      inlined from 'nm_team_link_watcher_new_ethtool' at src/libnm-core-impl/nm-setting-team.c:106:1:
  src/libnm-core-impl/nm-setting-team.c:130:33: error: array subscript 'struct NMTeamLinkWatcher[0]' is partly outside array bounds of 'unsigned char[16]' [-Werror=array-bounds=]
    130 |     watcher->ref_count          = 1;
        |                                 ^
  src/libnm-core-impl/nm-setting-team.c:128:15: note: object of size 16 allocated by 'g_malloc'
    128 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |               ^

even if the warning is disabled via pragma directives in that
code. This looks like the following GCC bug:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80922

saying

  We do not track warning options (and thus optimize pragmas /
  attributes) across LTO because they are not saved in the function
  specific optimization flag section.

We use a (NMTeamLinkWatcher *) to point to a memory area that is
shorter than the struct, because depending on the watcher type we need
to store different parameters; in this way we can save few bytes of
memory for some watcher types. However, this often breaks when
upgrading the compiler; instead just allocate the full struct.
2024-04-05 11:40:45 +02:00
Beniamino Galvani fcea2f174e libnm-glib-aux: fix comments about UUID generation
Whether the length is supplied explicitly or implicitly (via -1), the
result is the same. Update the comment.
2024-04-05 11:40:44 +02:00
Beniamino Galvani 2386c0f52d libnm-glib-aux: fix "maybe-uninitialized" error when generating UUID
GCC 14 complans with:

  src/libnm-glib-aux/nm-uuid.c: In function 'nm_uuid_generate_from_strings_strv':
  src/libnm-glib-aux/nm-uuid.c:492:12: error: '_1' may be used uninitialized [-Werror=maybe-uninitialized]
    492 |     return nm_uuid_generate_from_string_str(s, slen, uuid_type, type_args);
        |            ^
  src/libnm-glib-aux/nm-uuid.c:392:1: note: by argument 1 of type 'const char *' to 'nm_uuid_generate_from_string_str' declared here
    392 | nm_uuid_generate_from_string_str(const char   *s,
        | ^

"-Wmaybe-uninitialized" diagnoses passing pointers or references to
uninitialized memory to functions taking const-qualified arguments.

In this case, nm_uuid_generate_from_string_str()'s first argument is a
"const char *" and so the compiler expects that the string is always
initialized. However, it is not initialized when len is zero.

A non-null zero-length array can be specified in two ways: by setting
len to zero, or by setting len to -1 and having NULL as first
element. Handle both cases in the same way.
2024-04-05 11:40:44 +02:00
Beniamino Galvani c0705faaf2 Revert "fix gcc warnings"
The patch doesn't fix compilation.

This reverts commit 98cabe557f.
2024-04-05 11:40:44 +02:00
Fernando Fernandez Mancera 628371423b release: bump version to 1.47.4 (development) 2024-04-05 10:21:39 +02:00
Beniamino Galvani 5750137c9d merge: branch 'bg/fix-shutdown-crash'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1910
2024-04-04 11:13:52 +02:00
Beniamino Galvani 044620f8ad power-monitor: fix "shutdown" signal definition
NMPowerMonitor emits the "shutdown" signal without arguments; fix the
definition of the signal.

Fixes: bd38a19832 ('connection: add support to down-on-poweroff')
2024-04-04 11:12:18 +02:00
Beniamino Galvani 3f24b99e86 power-monitor: simplify signal handling
Remove intermediate functions that only change the arguments order.
2024-04-04 11:12:18 +02:00
Beniamino Galvani 61e520ca4b power-monitor: fix shutdown callback signature
The D-Bus signal is "PrepareForShutdown(b start)"; therefore, the
callback needs a boolean argument.
2024-04-04 11:12:18 +02:00
Beniamino Galvani 1b60dd9a9e manager: fix assertion failure during shutdown
Fix the following:

  NetworkManager: file ../src/libnm-core-impl/nm-connection.c: line 321 (nm_connection_get_setting): should not be reached
  NetworkManager.service: Main process exited, code=dumped, status=5/TRAP

Fixes: bd38a19832 ('connection: add support to down-on-poweroff')
2024-04-04 11:12:17 +02:00
Íñigo Huguet ad6fd1955d merge: branch 'ih/meson_deprecations'
meson: bump minimum version to 0.51 and remove usages of deprecated features

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1909
2024-04-04 08:13:55 +00:00
Íñigo Huguet ded7b78a7b meson: remove version checks for old versions
We now only support meson >= 0.51, as it is defined in
project(..., meson_version: '>= 0.51.0').

Remove checks for versions older than that.
2024-04-04 08:13:38 +00:00
Íñigo Huguet 873e66a03e meson: use shared_library for target used by linker
Meson has shared_library and shared_module. The latter should be used
only for shared plugins loaded by dlopen, not for shared libraries
linked by the linker.

The target `nm_wwan` was defined as shared_module probably because it
is a library for loadable plugins only, andcontains references to
symbols from the main executable that cannot be resolved at link time.

Do as the deprecation message suggest and convert it to shared_library
with b_lundef=false:

    DEPRECATION: target nm-device-plugin-wwan links against shared module nm-wwan, which is incorrect.
                 This will be an error in the future, so please use shared_library() for nm-wwan instead.
                 If shared_module() was used for nm-wwan because it has references to undefined symbols,
                 use shared_library() with `override_options: ['b_lundef=false']` instead.
2024-04-04 08:13:38 +00:00
Íñigo Huguet ef2438414f meson: remove deprecated ExternalProgram.path
Replaced by full_path:
https://mesonbuild.com/Reference-manual_returned_external_program.html#external_programpath

ExternalProgram.full_path was added in meson 0.55 but we support meson
>= 0.51. Because of that, use path or full_path conditionally depending
on the meson version.

This gets rid of the following deprecation warning:
  NOTICE: Future-deprecated features used:
   * 0.48.0: {'module python3'}
   * 0.55.0: {'ExternalProgram.path'}
2024-04-04 08:13:38 +00:00
Íñigo Huguet 3b72f19694 meson: replace deprecated meson.source_root
Instead, meson.current_source_root or meson.project_source_root should
be used:
https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonsource_root

Also, the documentation referenced above suggest to use `files()` as a
better alternative to refer to files, so do that at the same time.

This gets rid of the deprecation warning:
  NOTICE: Future-deprecated features used:
   * 0.56.0: {'meson.source_root'}
2024-04-04 08:13:38 +00:00
Íñigo Huguet 07f463bc94 meson: replace deprecated dep.get_pkgconfig_variable
Replaced by dep.get_variable:
https://mesonbuild.com/Reference-manual_returned_dep.html#depget_variable

This get rid of the following deprecation warning:
  NOTICE: Future-deprecated features used:
   * 0.56.0: {'dependency.get_pkgconfig_variable'}
2024-04-04 08:13:38 +00:00
Íñigo Huguet 9158f4165f meson: replace deprecated module 'python3'
Replaced by 'python' module:
https://mesonbuild.com/Python-3-module.html.

This get rids of the following deprecation warning:
  NOTICE: Future-deprecated features used:
   * 0.48.0: {'module python3'}
2024-04-04 08:13:38 +00:00
Íñigo Huguet 9d9e5bd6c1 meson: bump minimum version to 0.51
We were already using some features from 0.49:
 WARNING: Project specifies a minimum meson_version '>= 0.47.2' but uses features which were added in newer versions:
 * 0.48.0: {'meson.add_dist_script'}
 * 0.49.0: {'Calling "add_dist_script" with multiple arguments'}

Debian 10 uses meson 0.49.2, but it will get out of support in 2 months
so we can start considering it as a too old version. Next oldest meson
version used by the distros that we follow is Ubuntu 20.04 with meson
0.53.2.

Raise to 0.51 as it is supported by all the distros that we test (except
Debian 10) and it contains all the features that we need for the next
commits.
2024-04-04 08:13:38 +00:00
Íñigo Huguet c6a8a58548 merge: branch 'ih/fix-dist-meson'
meson: exclude intermediate files of docs generation from tarball

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1901
2024-04-04 08:13:14 +00:00
Íñigo Huguet 67eb8c5c2b CI: fix meson tarball testing with old meson version
The test "tarball+meson" fails on systems with old meson version with
the message "ERROR: Neither directory contains a build file
meson.build". This message is raised when calling `meson dist` from the
build directory.

According to meson documentation, `meson dist` is supported since 0.52,
and older vesions need to execute `ninja dist`.
https://mesonbuild.com/Creating-releases.html

Also, when using meson.add_dist_script, the env variable MESON_SOURCE_ROOT
is not passed in versions < 0.54. As we don't use it in the script,
don't assert for it.

We claim to support down to meson 0.47.3 (we need to raise it because we
are actually using a bit newer features, but that's another topic). Use
`ninja dist` that will work fine on old and new meson.

Fixes: 61f0531509 ('gitlab-ci: test re-buildability of distribution tarballs')
2024-04-04 08:17:26 +02:00
Íñigo Huguet 723ad4c0ad meson: exclude intermediate files of docs generation from tarball
We want to distribute the generated documentation when we generate the
tarball because we normally do it when we do a release, but `meson dist`
only includes files that are commited to the repository, so a script
meson-dist-data.sh was added with meson.add_dist_script in commit
1c41066a40 ('build: include documentation in meson dist').

This script was copying the whole documentation folders, including some
intermediate files that are not useful for users that wants to read the
docs. Get rid of them and copy only the files that are useful for users:
the generated html pages in docs/api and docs/libnm and the final man
pages.

Also, including these intermediate files caused at least one build
failure, although quite difficult to reproduce:
- Generate tarball with meson
- Untar the generated tarball
- Using the sources from the tarball, configure the project with
  autotools, but building to an out-of-tree folder, not building in
  the source dir (i.e. using a 'build' subfolder). This is called
  a "VPATH build" by autotools and Make. See:
  - https://www.gnu.org/software/make/manual/html_node/General-Search.html
  - https://www.gnu.org/software/automake/manual/html_node/VPATH-Builds.html
- Build

In that scenario, we get an error trying to generate any file under man/
because the man/ subdirectory has not been created. The reason of this
was that the man/ subdirectory is created by the Makefile when
generating the file man/common.ent. However, this file was present in
the source directory because it has been included in the tarball, so
Make detects it and doesn't run the rules to generate it. The result is
that out-of-tree-dir/man folder is not created.

Not including the intermediate files solves this problem.

Fixes: 1c41066a40 ('build: include documentation in meson dist')
2024-04-04 08:16:25 +02:00
Beniamino Galvani 632c4c260b wifi: merge branch 'bg/wifi-bands'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1899
2024-04-02 16:16:17 +02:00
Beniamino Galvani 4cd4ab518e wifi: fix enumeration of 6 GHz channels from wiphy
Command NL80211_CMD_GET_WIPHY without any flag only returns channels
in the 2 GHz and 5 GHz bands, for backwards compatibility with old
userspace tools. To get the full list we need to pass attribute
NL80211_ATTR_SPLIT_WIPHY_DUMP (added in Linux 3.9 released in 2013),
and allow the handler to be called multiple times.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1500
2024-04-02 16:12:57 +02:00
Beniamino Galvani 8ca7433a14 wifi: fix the ranges of 5 GHz and 6 GHz bands
The 6 GHz band starts from frequency 5950, anything below is 5 GHz.
2024-04-02 16:09:28 +02:00
Fernando Fernandez Mancera 9ac1d6e22b libnm-lldp: use ETH_P_ALL instead of NM_ETHERTYPE_LLDP for the socket
When creating the socket for listening to LLDP frames we are setting
NM_ETHERTYPE_LLDP (0x88cc) as protocol. In most of the cases, that is
correct but when the interface is attached as a port to a OVS bridge,
kernel is not matching the protocol correctly. The reason might be that
some metadata is added to the packet, but we are not completely sure
about it.

Instead, we should use ETH_P_ALL to match all the protocols. Later, we
have a eBPF filter to drop the packet by multicast MAC address or
protocol. This is how lldpd is doing it for example.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1903
2024-04-02 15:59:43 +02:00
Gris Ge 28565cdd32 merge: branch 'fix_f40_build'
fix gcc warnings

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1908
2024-04-02 13:34:12 +00:00
Gris Ge 98cabe557f fix gcc warnings
In Fedora 40+, we have complaining failure:

```
src/libnm-glib-aux/nm-uuid.c: In function 'nm_uuid_generate_from_strings_strv':
src/libnm-glib-aux/nm-uuid.c:490:12: error: '_1' may be used
uninitialized [-Werror=maybe-uninitialized]
  490 |     return nm_uuid_generate_from_string_str(s, slen, uuid_type,
  type_args);
      |            ^
src/libnm-glib-aux/nm-uuid.c:392:1: note: by argument 1 of type 'const
char *' to 'nm_uuid_generate_from_string_str' declared here
  392 | nm_uuid_generate_from_string_str(const char   *s,
      | ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
```

Fixed by set the `s` initial variable to NULL;

Signed-off-by: Gris Ge <fge@redhat.com>
2024-04-02 21:03:51 +08:00
Íñigo Huguet 1556bf3855 merge: branch 'ih/meson-qt-auto'
meson: autodetect Qt dependencies

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1906
2024-04-02 12:59:12 +00:00
Íñigo Huguet f57513097f meson: autodetect Qt dependencies
Configuring the build directory with meson often fails if you don't have
the right Qt dependencies. As they are used only to build some examples,
it is better to autodetect them and, if present, then build the
examples but skip them otherwise.

Still accept forcing qt=true or qt=false as before.

Note that there is a option type called "feature" whose purpose is to
support exactly this: features with enable/disable/auto possible values:
https://mesonbuild.com/Build-options.html#features.  However, they don't
accept true/false values so scripts using qt=true/false would start
failing. Since meson 0.60 the "deprecated" argument can be used for
options (https://mesonbuild.com/Build-options.html#deprecated-options),
but that's a too new version of meson.

Also, this fixes some Gitlab-CI failures that happen when generating the
tarball with make distcheck or meson dist. This is because it tries to
check that the tarball content can be configured and built, but it uses
the default configurations so it was using qt=yes. Now it will use
qt=auto, avoiding the failure.

Fixes: 61f0531509 ('gitlab-ci: test re-buildability of distribution tarballs')
2024-04-02 12:58:26 +00:00
Beniamino Galvani d534f984f7 device: ignore error setting mac if it's a global special value
If the distro sets a global special value for the cloned MAC address
(for example, "stable-ssid") and the driver doesn't support changing
the MAC, all activations will fail on the interface unless users know
that they need to change the cloned MAC. Be more tolerant to errors in
case the MAC is global and special.

https://bugzilla.redhat.com/show_bug.cgi?id=2270062
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1898
2024-03-29 09:48:23 +01:00
Beniamino Galvani f58b281ef4 ndisc: accept unknown ip6-privacy value
The value can be unknown for different reasons:

 - we don't have a value saved in NMDevice's "ip6_saved_properties"
   because NM was restarted or because the device didn't have an
   ifindex when it became managed.

 - the value read from /proc is outside the allowed range (kernel
   allows "echo 42 > /proc/sys/net/ipv6/conf/enp1s0/use_tempaddr")

Note that the second case was already possible before commit
797f3cafee ('device: fall back to saved use_tempaddr value instead
of rereading /proc').

If we can't determine the previous value, pass "unknown" to ndisc; it
will generate a l3cd with "unknown" ip6-privacy, which means to not
set the value when committing the configuration.

Fixes: 797f3cafee ('device: fall back to saved use_tempaddr value instead of rereading /proc')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1907
2024-03-28 19:21:43 +01:00
Íñigo Huguet b4e3095522 merge: branch 'main'
Update Turkish translation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1884
2024-03-26 16:09:25 +00:00
emintufan e179fae31e Update Turkish translation 2024-03-26 15:19:25 +00:00
Beniamino Galvani de130df3e2 manager: fix race condition while enumerating devices at startup
While enumerating devices at startup, we take a snapshot of existing
links from platform and we start creating device instances for
them. It's possible that in the meantime, while processing netlink
events in platform_link_added(), a link gets renamed. If that happens,
then we have two different views of the same ifindex: the cached link
from `links` and the link in platform.

This can cause issues: in platform_link_added() we create the device
with the cached name; then in NMDevice's constructor(), we look up
from platform the ifindex for the given name. Because of the rename,
this lookup can match a newly created, different link.

The end result is that the ifindex from the initial snapshot doesn't
get a NMDevice and is not handled by NetworkManager.

Fix this problem by fetching the latest version of the link from
platform to make sure we have a consistent view of the state.

https://issues.redhat.com/browse/RHEL-25808
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1897
2024-03-26 10:26:02 +01:00