Commit graph

33011 commits

Author SHA1 Message Date
Íñigo Huguet 09f2e1c107 merge: branch 'ih/eswitch_mode'
sriov: add support to configure the NIC's eswitch settings via Devlink

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1867
2024-02-20 15:04:31 +00:00
Íñigo Huguet 7346c5b556 sriov: allow reading empty eswitch paramaters via Devlink
Probably not all drivers and devices return all parameters. Set them to
"unknown" if they are missing and let the caller to decide what to do.

In our case, if the sriov setting has a value different to "preserve" it
will try to set it (and will probably fail). But if the missing
parameter is set to "preserve" in the sriov setting we can continue,
just ignoring it.
2024-02-20 16:01:32 +01:00
Íñigo Huguet 27eaf34fcf sriov: don't fail if sriov_totalvfs sysfs file is missing
If sriov_totalvfs file doesn't exist we don't need to consider it a
fatal failure. Try to create the required number of VFs as we were doing
before.

Note: at least netdevsim doesn't have sriov_totalvfs file, I don't know
if there are real drivers that neither has it.
2024-02-20 16:01:30 +01:00
Íñigo Huguet 4669f01eb0 sriov: set the devlink's eswitch inline-mode and encap-mode
Set these parameters according to the values set in the new properties
sriov.eswitch-inline-mode and sriov.eswitch-encap-mode.

The number of parameters related to SR-IOV was becoming too big.
Refactor to group them in a NMPlatformSriovParams struct and pass it
around.
2024-02-20 16:01:29 +01:00
Íñigo Huguet bf654ef39e devlink: get and set eswitch inline-mode and encap-mode
The setter function allow to set to "preserve" to modify only some of
them.
2024-02-20 16:01:28 +01:00
Íñigo Huguet 8a88386e3a sriov: add eswitch-inline-mode and eswitch-encap-mode properties
Those are related to the eswitch mode and can be configured together.
2024-02-20 16:01:27 +01:00
Íñigo Huguet 770340627b platform: destroy VFs before changing the eswitch mode
It is not safe to change the eswitch mode when there are VFs already
created: it often fails, or even worse, doesn't fail immediatelly but
there are later problems with the VFs.

What is supposed to be well tested in all drivers is to change the
eswitch mode with no VFs created, and then create the VFs, so let's set
num_vfs=0 before changing the eswitch mode.

As we want to change num_vfs asynchronously in a separate thread, we
need to do a multi-step process with callbacks each time that a step
finish (before it was just set num_vfs asynchronously and invoke the
callback when it's done).

This makes link_set_sriov_params_async to become even larger and more
complex than it already was. Refactor it to make it cleaner and easier
to follow, and hopefully less error prone, and implement that multi-step
process.
2024-02-20 16:01:26 +01:00
Íñigo Huguet 837549ea94 sriov: set the devlink's eswitch mode
Use the new property sriov.eswitch-mode to select between legacy SRIOV
and switchdev mode.
2024-02-20 16:01:25 +01:00
Íñigo Huguet c61c87f8a6 sriov: add eswitch-mode property
Add property to allow changing the eswitch mode between legacy SRIOV and
switchdev. Allow also to set "preserve" to prevent NM from modifying the
eswitch mode.
2024-02-20 16:01:25 +01:00
Íñigo Huguet f31d29bbb7 platform: netlink: add devlink support
Add support for Devlink, which is just another family of Generic Netlink
like nl80211. Implement get_eswitch_mode and set_eswitch_mode to allow
changing between legacy SRIOV and switchdev modes.

Devlink's purpose is to allow querying and configuring stuff related to
a piece of hardware but not to any of the usual Linux device classes.

For example, nowadays the Smart NICs normally allow to change the
eswitch mode per PF, because their hardware implements one eswitch per
PF, but future models might have a single eswitch for all the physical
and virtual ports of the NIC allowing more advanced bridge offloads.

Regarding the above example, for the moment we only support PCI network
devices with the "one eswitch per PF" model. The reason is that currently
NM only knows about netdevs so dealing with "devlink devices" that
doesn't map 1-1 with a netdev would require new mechanisms to understand
what they are and their relation with the netdevs that NM manage. We
will deal with that use cases when they arise and we have more
information about the right way to support them.
2024-02-20 16:01:25 +01:00
Íñigo Huguet cc1b970e08 merge: branch 'ih/direct_enum'
nm-setting: implement direct_enum as GObject property of type int

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1861
2024-02-20 14:50:17 +00:00
Íñigo Huguet 260865b1ac nm-setting: implement direct_enum as GObject property of type int 2024-02-20 14:50:15 +00:00
Fernando Fernandez Mancera 8d639abb2f .gitignore: include m4/build-to-host.m4
When the build environment is different from the target runtime
environment, file names may need to be converted from the build env
syntax to the target env syntax. This is handled by some generated
macros. This must be ignored by git.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2024-02-20 12:12:25 +01:00
Sergey Koshelenko 14e7220f5f ndisc: fix IPv6 address lifetimes computation
Background: when router sends router advertisement (RA) message,
NetworkManager processes it and passes data to a lower system layer.
Currently there is a problem that NetworkManager adds one second to both
valid lifetime and preferred lifetime. This happens because of the
algorithm in nm_ndisc_data_to_l3cd() function.

Let's look at an example: let current timestamp be 100450, so now_sec
variable is 100. At this moment RA message was received from the router.
The IPv6 address' valid lifetime is 200 seconds (for example), so
expiration timestamp (ndisc_addr->expiry_msec) is 300450. But after the
_nm_ndisc_lifetime_from_expiry() call, NMPlatformIP6Address lifetime
becomes 201 ((300450-(100*1000)+999)/1000). Which is wrong.

This commit fixes this behaviour by replacing
nm_utils_get_monotonic_timestamp_sec() with
nm_utils_get_monotonic_timestamp_msec() so that timestamps are
calculated more precisely.

Related issue: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1464
Merge request: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1863
2024-02-20 11:19:48 +01:00
Beniamino Galvani 416d596b31 nmcli: fix crash in nmc_connection_check_deprecated()
It's not clear in which circumstances, but 'type' can be NULL as in
the following backtrace:

  nmc_connection_check_deprecated (c=c@entry=0x55d93f937610) at src/nmcli/connections.c:676
  connection_warnings (nmc=nmc@entry=0x55d93f5ae5e0 <nm_cli>, connection=connection@entry=0x55d93f937610) at src/nmcli/connections.c:5464
  add_connection_cb (client=<optimized out>, result=<optimized out>, user_data=0x55d93fc83820) at src/nmcli/connections.c:5510
  g_task_return_now (task=0x55d93fc86fd0 [GTask]) at ../gio/gtask.c:1361
  g_task_return (type=<optimized out>, task=0x55d93fc86fd0 [GTask]) at ../gio/gtask.c:1430
  g_task_return (task=0x55d93fc86fd0 [GTask], type=<optimized out>) at ../gio/gtask.c:1387
  _request_wait_complete () at /lib64/libnm.so.0
  _nm_client_notify_event_emit_parts () at /lib64/libnm.so.0
  _dbus_handle_changes_commit () at /lib64/libnm.so.0
  _nm_client_get_settings_call_cb () at /lib64/libnm.so.0
  _nm_client_dbus_call_simple_cb () at /lib64/libnm.so.0
  g_task_return_now (task=0x55d93f7bd6f0 [GTask]) at ../gio/gtask.c:1361
  g_task_return (type=<optimized out>, task=0x55d93f7bd6f0 [GTask]) at ../gio/gtask.c:1430
  g_task_return (task=0x55d93f7bd6f0 [GTask], type=<optimized out>) at ../gio/gtask.c:1387
  g_dbus_connection_call_done (source=<optimized out>, result=<optimized out>, user_data=0x55d93f7bd6f0) at ../gio/gdbusconnection.c:5895
  g_task_return_now (task=0x55d93f7bd7b0 [GTask]) at ../gio/gtask.c:1361
  complete_in_idle_cb (task=task@entry=0x55d93f7bd7b0) at ../gio/gtask.c:1375
  g_idle_dispatch (source=0x7f15b007c940, callback=0x7f15ca7e4850 <complete_in_idle_cb>, user_data=0x55d93f7bd7b0) at ../glib/gmain.c:6150
  g_main_dispatch (context=0x55d93f77cde0) at ../glib/gmain.c:3344
  g_main_context_dispatch_unlocked (context=0x55d93f77cde0) at ../glib/gmain.c:4152
  g_main_context_iterate_unlocked.isra.0 (context=0x55d93f77cde0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
  g_main_loop_run (loop=0x55d93f7589b0) at ../glib/gmain.c:4419
  main (argc=19, argv=0x7fff77359138) at src/nmcli/nmcli.c:1044

Fixes: f377114d6e ('cli: connection: check for deprecated features')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1872
2024-02-20 11:15:14 +01:00
Fernando Fernandez Mancera aabb4fad8e merge: branch 'ff/systemd_merge'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1866
2024-02-20 11:00:44 +01:00
Beniamino Galvani a80fef9f37 dhcp: remove l3cds when the lease expires
When the lease is lost, NM tries to get a new by restarting the DHCP
transaction. However, it doesn't delete the existing l3cds (one from
the DHCP client with flag ONLY_FOR_ACD, the other from
NMDevice). Therefore, the l3cfg still tracks the ACD state of the
address as "external-removed", and when NM gets the same address via
DHCP, ACD is considered as failed; as a consequence, NM sends a
DECLINE message to the server.

Moreover, the l3cd added by NMDevice for DHCP has a zero ACD timeout,
and so it's not possible to do ACD again on the same address.

Remove those l3cds when the lease expires, so that any ACD state is
cleared and DHCP can perform ACD again.

Fixes: 240ec7f891 ('dhcp: implement ACD (address collision detection) for DHCPv4')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1853
2024-02-20 09:29:55 +01:00
Thomas Haller 06e039b18a
contrib: pass "--noclean" to rpmbuild in "makerepo.sh"
Recent rpmbuild will delete the source directory on successful build.
With `makerepo.sh` that is bad, because we want that directory with the
git history. Pass "--noclean" to avoid that.
2024-02-20 08:41:47 +01:00
Thomas Haller cc7295698e
contrib: add "ulogd" to makerepo.sh script 2024-02-19 17:38:30 +01:00
Fernando Fernandez Mancera a1c503d558 merge: branch 'systemd'
The main change is that lease address and pd getters changed and the new
functions are now used.

In addition, solved several conflicts due to disabled code and added
adapt header to new files.
2024-02-19 13:02:22 +01:00
Thomas Haller 70ced147b1
contrib: add "libnetfilter_log" to makerepo.sh script 2024-02-19 11:47:09 +01:00
Íñigo Huguet 479a9a6745 merge: branch 'nmtui-add-bond-to-bridge-ports'
nmtui: Add bond for creating bridge port interface

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1865
2024-02-19 08:28:57 +00:00
Javier Sánchez Parra 279d559a12 nmtui: Add bond for creating bridge port interface
This commit adds the missing bond option in the nmtui interface for
creating a bridge port interface.

Resolves: https://issues.redhat.com/browse/RHEL-18158
2024-02-19 08:28:25 +00:00
Íñigo Huguet 6c6e344755 merge: branch 'ih/vpn-2fa'
libnmc: support 2FA authentication from VPN plugins

Closes #1434

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1842
2024-02-16 13:48:19 +00:00
Íñigo Huguet 2ab56e82d4 libnmc: allow user input in ECHO mode for 2FA challenges
Depending on the type of challenge used in the 2FA authentication, the
user input doesn't need to be hidden and sometimes it's even undesired
(it makes more difficult to enter the text).

Allow to VPN plugins to indicate that a secret that is being requested
is a 2FA challenge with ECHO mode enabled:
- When using auth dialog: accept a new option "ForceEcho" that can be
  set to TRUE to enable ECHO.
- When using the fallback method: recognize the prefix
  "x-dynamic-challenge-echo". This indicate both that ECHO should be enabled
  and that this is a 2FA challenge (see previous commit).

The correct way to enable echo mode from VPN plugins is doing both
things: pass the hint prefixed with "x-dynamic-challenge-echo" and add the
option "ForceEcho=true" for the auth dialog.

An attempt to support ECHO mode from NM-openvpn was made by passing
"IsSecret=false", but it didn't work because nm-secret-agent-simple
ignores returned values for which "IsSecret=false". It's not a good idea
to start accepting them because we could break other plugins, and anyway
the challenge response is actually a secret, so it is better to keep it
as such and add this new "ForceEcho" option.

This is backwards compatible because existing plugins were not using the
tag nor the auth dialog option. Withouth them, the previous behaviour is
preserved. On the contrary, plugins that want to use this new feature
will need to bump their NM version dependency because old daemons will
not handle correctly the prefix tag.

Secret agents will need to be updated to check secret->force_echo if
they want to support this feature. Until they update, the only drawback
is that ECHO mode will be ignored and the user's input will be hidden.

Updated nmcli and nmtui to support ECHO mode.
2024-02-15 09:45:44 +00:00
Íñigo Huguet c5f46bae43 libnmc: fix secrets request on 2nd stage of 2FA authentication
Clients using nm-secret-agent-simple always asked for some default VPN
secrets, which are dependent on the VPN service, when the auth dialog
can't be used and the fallback method is used instead.

When using 2FA this has to be avoided in the 2nd step because those
default secrets were already requested and validated in the 1st step.

Fix it by adding a new "x-dynamic-challenge" prefix tag that can be used
in the hints received from the VPN plugin. This tag indicates that we
are in the 2nd step of a 2FA authentication. This way we know that we
don't have to request the default secrets this time. Note that the tag
name doesn't explicitly mention VPNs so it can be reused for other type
of connections in the future.

As the default secrets were requested always unconditionally when using
the fallback method, there is no possible workaround to this problem
that avoids having to change libnm-client.

The change is backwards compatible because VPN plugins were not using
the tag and the previous behaviour does not change if the tag is not
used. However, VPN plugins that want to properly support 2FA
aunthentication will need to bump the NM version dependency because
old daemons won't handle properly a hint with the new prefix tag.

Finally, move the macro that defines the "x-vpn-message:" tag in a public
header so it is more visible for users. It has been renamed and prefixed
with the NM_ namespace so it shouldn't collide with macros defined in
the VPN plugins.
2024-02-15 09:45:44 +00:00
Fernando Fernandez Mancera 4a9c08da28 version: add version 1.48 macros 2024-02-14 10:18:41 +01:00
Fernando Fernandez Mancera a14a033efb systemd: update code from upstream (2024-02-12)
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=e2382ef0053a8bf09d4cd43e30fc90e6d377986e

(
  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-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-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/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/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-02-13 15:22:28 +01:00
Íñigo Huguet 9c7fa71068 merge: branch 'ih/news-1-46'
NEWS: add missing new features in 1.46

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1864
2024-02-09 12:08:07 +00:00
Íñigo Huguet a9fde8d965 NEWS: add missing new features in 1.46 2024-02-09 12:52:57 +01:00
Íñigo Huguet 5ec6c72abc merge: branch 'th/gcc-14-fixes-2'
[th/gcc-14-fixes-2] avoid compiler warnings with GCC 14 (systemd)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1859
2024-02-09 08:28:02 +00:00
Thomas Haller 7f2a32fa11 config/tests: fix test failure in "/config/set-values"
GKeyfile changed something about how to handle invalid escape sequences.
As we don't want to test GKeyfile (per-se), just adjust to test to not
hit the problem.

This would fail with glib2-2.79.1-1.fc40:

  # ./tools/run-nm-test.sh -m src/core/tests/config/test-config -p /config/set-values
  TAP version 13
  # random seed: R02Sb8afff1ec38ca5a1b7713e8c40eb4f56
  # Start of config tests
  # GLib-GIO-DEBUG: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ?gio-vfs?
  # (src/core/tests/config/test-config.c:1107) invalid value in config-data .intern.with-whitespace.key2 = (null) (instead of " b c\,  d  ")
  ./tools/run-nm-test.sh: line 307: 245847 Trace/breakpoint trap   (core dumped) "${NMTST_DBUS_RUN_SESSION[@]}" "$TEST" "${TEST_ARGV[@]}"
  exec "src/core/tests/config/test-config" failed with exit code 133
2024-02-09 08:27:41 +00:00
Thomas Haller ced0cf8005 core: ignore unused result warning of audit_log_user_message()
Affects build on rawhide (audit-libs-4.0-8.fc40):

    src/core/nm-audit-manager.c: In function 'nm_audit_log':
    src/core/nm-audit-manager.c:188:9: error: ignoring return value of 'audit_log_user_message' declared with attribute 'warn_unused_result' [-Werror=unused-result]
      188 |         audit_log_user_message(priv->auditd_fd,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      189 |                                AUDIT_USYS_CONFIG,
          |                                ~~~~~~~~~~~~~~~~~~
      190 |                                build_message(&strbuf, BACKEND_AUDITD, fields),
          |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      191 |                                NULL,
          |                                ~~~~~
      192 |                                NULL,
          |                                ~~~~~
      193 |                                NULL,
          |                                ~~~~~
      194 |                                success);
          |                                ~~~~~~~~

86bfa9bf4f
2024-02-09 08:27:41 +00:00
Thomas Haller b1016e3be8 build: workaround -Wno-calloc-transposed-args warning in systemd code
Upstream systemd fixed this compiler warning. What really needs to be
done, is re-importing the upstream code.

In the meantime, suppress the warning that hits on GCC 14.

This is a temporary workaround!

See-also: fdd84270df
2024-02-09 08:27:41 +00:00
Thomas Haller ad22a96da9 build: use "-Wno-nonnull-compare" for building systemd
systemd uses that too. We cannot enable compiler warnings that
upstream doesn't want to support.

See-also: b59bce308d
2024-02-09 08:27:41 +00:00
Thomas Haller a500538fb2 core: workaround "-Wnonnull-compare" warning in nm_lldp_neighbor_tlv_get_oui()
../src/libnm-lldp/nm-lldp-neighbor.c: In function ‘nm_lldp_neighbor_tlv_get_oui’:
  ../src/libnm-std-aux/nm-std-aux.h:191:12: error: ‘nonnull’ argument ‘oui’ compared to NULL [-Werror=nonnull-compare]
    191 |         if (expr)                      \
        |            ^
  ../src/libnm-std-aux/nm-std-aux.h:202:27: note: in expansion of macro ‘_NM_BOOLEAN_EXPR_IMPL’
    202 |                           _NM_BOOLEAN_EXPR_IMPL(NM_UNIQ, expr))
        |                           ^~~~~~~~~~~~~~~~~~~~~
  ../src/libnm-glib-aux/nm-macros-internal.h:1693:31: note: in expansion of macro ‘NM_BOOLEAN_EXPR’
   1693 | #define _G_BOOLEAN_EXPR(expr) NM_BOOLEAN_EXPR(expr)
        |                               ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmacros.h:1244:43: note: in expansion of macro ‘_G_BOOLEAN_EXPR’
   1244 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
        |                                           ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmessages.h:661:9: note: in expansion of macro ‘G_LIKELY’
    661 |     if (G_LIKELY (expr)) \
        |         ^~~~~~~~
  ../src/libnm-lldp/nm-lldp-neighbor.c:651:5: note: in expansion of macro ‘g_return_val_if_fail’
    651 |     g_return_val_if_fail(oui, -EINVAL);
        |     ^~~~~~~~~~~~~~~~~~~~
2024-02-09 08:27:41 +00:00
Íñigo Huguet 806a86fc8a merge: branch 'reapply_default_pvid'
bridge: skip VLAN filtering resetting in reapply if no vlan change changed

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1855
2024-02-09 08:27:13 +00:00
Gris Ge 02c34d538c bridge: skip VLAN filtering resetting in reapply if no vlan change changed
When doing reapply on linux bridge interface, NetworkManager will reset
the VLAN filtering and default PVID which cause PVID been readded to all
bridge ports regardless they are managed by NetworkManager.

This is because Linux kernel will re-add PVID to bridge port upon the
changes of bridge default-pvid value.

To fix the issue, this patch introduce netlink parsing code for
`vlan_filtering` and `default_pvid` of NMPlatformLnkBridge, and use that
to compare desired VLAN filtering settings, skip the reset of VLAN
filter if `default_pvid` and `vlan_filtering` are unchanged.

Signed-off-by: Gris Ge <fge@redhat.com>
2024-02-09 08:25:21 +00:00
Íñigo Huguet 9000e80f39 merge: branch 'main'
po: update Swedish (sv) translation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1860
2024-02-09 06:54:04 +00:00
Luna Jernberg 977ed6493f po: update Swedish (sv) translation
100%
2024-02-08 07:50:01 +00:00
Thomas Haller e4b154e1b0
std-aux: workaround usage of _Pragma() inside nm_assert()
Older gcc versions don't like this. The _Pragam() itself is to workaround a
-Wnonnull-compare warning with gcc 14.

After all, we use compiler warning extensively. They are our linters and have
necessarily false positives. To make them usable across a wide range of
compilers, is a constant effort.

Here is another one.

The error:

  ./src/libnm-std-aux/nm-std-aux.h: In function ‘nm_utils_addr_family_other’:
  ./src/libnm-std-aux/nm-std-aux.h:230:36: error: expected expression before ‘#pragma’
    230 | #define NM_PRAGMA_DIAGNOSTICS_PUSH _Pragma("GCC diagnostic push")
        |                                    ^~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:232:5: note: in expansion of macro ‘NM_PRAGMA_DIAGNOSTICS_PUSH’
    232 |     NM_PRAGMA_DIAGNOSTICS_PUSH _Pragma(_NM_PRAGMA_WARNING_DO(warning))
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:291:9: note: in expansion of macro ‘NM_PRAGMA_WARNING_DISABLE’
    291 |         NM_PRAGMA_WARNING_DISABLE("-Wnonnull-compare");                \
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:953:9: note: in expansion of macro ‘nm_assert’
    953 |         nm_assert(true || NM_UNIQ_T(xx, uniq) == (x));                    \
        |         ^~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:961:27: note: in expansion of macro ‘_NM_IN_SET’
    961 | #define NM_IN_SET(x, ...) _NM_IN_SET(NM_UNIQ, ||, typeof(x), x, __VA_ARGS__)
        |                           ^~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1493:15: note: in expansion of macro ‘NM_IN_SET’
   1493 |     nm_assert(NM_IN_SET((addr_family), NM_AF_INET, NM_AF_INET6))
        |               ^~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1502:9: note: in expansion of macro ‘nm_assert_addr_family’
   1502 |         nm_assert_addr_family(NM_UNIQ_T(_addr_family, uniq));    \
        |         ^~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1510:33: note: in expansion of macro ‘_NM_IS_IPv4’
   1510 | #define NM_IS_IPv4(addr_family) _NM_IS_IPv4(NM_UNIQ, addr_family)
        |                                 ^~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1515:12: note: in expansion of macro ‘NM_IS_IPv4’
   1515 |     return NM_IS_IPv4(addr_family) ? NM_AF_INET6 : NM_AF_INET;
        |            ^~~~~~~~~~

Fixes: 62c1745f62 ('std-aux: suppress "-Wnonnull-compare" warning in nm_assert()')
2024-02-07 12:48:20 +01:00
Thomas Haller 3e8fc01afb
device: fix _prop_get_ipv4_dhcp_dscp() to return value
Fixes: 3cf6a805ba ('device: support the DHCP DSCP property')
2024-02-07 12:39:02 +01:00
Thomas Haller 33336a4cb1
NEWS: update for 1.48 2024-02-07 10:14:59 +01:00
Beniamino Galvani 2dbc4d16e6 merge: branch 'th/gcc-14-fixes'
Fix compiler warnings with gcc-14 (mostly "-Wnonnull-compare")

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1840
2024-02-07 08:42:58 +00:00
Thomas Haller 7a031eef5d libnm: avoid "-Wnonnull-compare warnings with "static" array declarator
With a static array, we indicate that the argument must not be NULL.
Gcc-14.0.1-0.2.fc40 now warns against that:

    CC       src/libnm-base/libnm_base_la-nm-base.lo
  In file included from ../src/libnm-std-aux/nm-default-std.h:102,
                   from ../src/libnm-glib-aux/nm-default-glib.h:11,
                   from ../src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13,
                   from ../src/libnm-base/nm-base.c:3:
  ../src/libnm-base/nm-base.c: In function 'nm_net_devname_infiniband':
  ../src/libnm-std-aux/nm-std-aux.h:191:12: error: 'nonnull' argument 'name' compared to NULL [-Werror=nonnull-compare]
    191 |         if (expr)                      \
        |            ^
  ../src/libnm-std-aux/nm-std-aux.h:202:27: note: in expansion of macro '_NM_BOOLEAN_EXPR_IMPL'
    202 |                           _NM_BOOLEAN_EXPR_IMPL(NM_UNIQ, expr))
        |                           ^~~~~~~~~~~~~~~~~~~~~
  ../src/libnm-glib-aux/nm-macros-internal.h:1693:31: note: in expansion of macro 'NM_BOOLEAN_EXPR'
   1693 | #define _G_BOOLEAN_EXPR(expr) NM_BOOLEAN_EXPR(expr)
        |                               ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmacros.h:1244:43: note: in expansion of macro '_G_BOOLEAN_EXPR'
   1244 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
        |                                           ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmessages.h:656:9: note: in expansion of macro 'G_LIKELY'
    656 |     if (G_LIKELY (expr)) \
        |         ^~~~~~~~
  ../src/libnm-base/nm-base.c:57:5: note: in expansion of macro 'g_return_val_if_fail'
     57 |     g_return_val_if_fail(name, NULL);
        |     ^~~~~~~~~~~~~~~~~~~~

  ../src/libnm-core-impl/nm-setting-wireguard.c: In function '_nm_wireguard_peer_set_public_key_bin':
  ../src/libnm-core-impl/nm-setting-wireguard.c:316:8: error: 'nonnull' argument 'public_key' compared to NULL [-Werror=nonnull-compare]
    316 |     if (!public_key)
        |        ^

Convert these checks to an nm_assert() to suppress the warning.
2024-02-07 08:26:25 +00:00
Thomas Haller 62c1745f62 std-aux: suppress "-Wnonnull-compare" warning in nm_assert()
When we use a "static" array declarator to a function, we understand
and tell the compiler that the argument must not be NULL.

But now gcc-14.0.1-0.2.fc40 starts warning about NULL checks for
such arguments.

  static void foo(char args[static 10]) {
      nm_assert(args);
      sprintf(args, "hi");
  }

Granted, the compiler is right, and we know that this condition is not
supposed to be violated. A logical thing would be just to drop the
assertion.

Instead, suppress "-Wnonnull-compare" warnings inside a nm_assert(). An
nm_assert() is more than a run time check, it's an additional
self-documenting code of the invariants.

It's fine to assert for something that is true. Actually, all the
conditions that we assert against, hold. The compiler telling us that
the condition that we assert against is valid, is not useful.
2024-02-07 08:26:25 +00:00
Thomas Haller c0338526f3 std-aux: move NM_PRAGMA_WARNING_DISABLE() macro from libnm-glib-aux to libnm-std-aux
Will be used by nm_assert().
2024-02-07 08:26:25 +00:00
Thomas Haller 025d6898fe std-aux: add NM_STRINGIFY() macro 2024-02-07 08:26:25 +00:00
Thomas Haller 63ab0d926d libnm: use flexible array member in NMUtilsStrStrDictKey
Otherwise, gcc-14.0.1-0.2.fc40 warns:

  ../src/libnm-core-impl/nm-utils.c: In function _nm_utils_strstrdictkey_create:
  ../src/libnm-core-impl/nm-utils.c:5076:16: error: allocation of insufficient size '1' for type 'NMUtilsStrStrDictKey' {aka 'struct _NMUtilsStrStrDictKey'} with size '2' [-Werror=alloc-size]
   5076 |         return g_malloc0(1);
        |                ^~~~~~~~~~~~
2024-02-07 08:26:25 +00:00
Thomas Haller 5715feebe7 libnm: avoid "-Walloc-size" warning in nm_team_link_watcher_new_ethtool()
gcc-14.0.1-0.2.fc40 warns:

    CC       src/libnm-core-impl/libnm_core_impl_la-nm-setting-team.lo
  ../src/libnm-core-impl/nm-setting-team.c: In function nm_team_link_watcher_new_ethtool:
  ../src/libnm-core-impl/nm-setting-team.c:127:13: error: allocation of insufficient size 16 for type NMTeamLinkWatcher with size 48 [-Werror=alloc-size]
    127 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |             ^
2024-02-07 08:26:25 +00:00