Commit graph

34335 commits

Author SHA1 Message Date
Tomas Bzatek
592a4f077b nm-initrd-generator: fix a conn_name leak 2025-08-26 07:45:53 +00:00
Tomas Bzatek
6304d51440 nm-initrd-generator: rework NBFT HFI DHCP detection
There are several flags specified in the NVMe Boot Specification
that may indicate DHCP was used to acquire information during the
pre-OS phase. This commit considers these additional sources,
based on actual NBFT table contents from different systems.

Although we've seen slight variations in firmware implementations
regarding the HFI IP Origin values when DHCP was configured, the
new set of rules still align with expectations.
2025-08-26 07:45:53 +00:00
Beniamino Galvani
0c1fba5c95 wireguard: don't add peer routes if they duplicate prefix routes
With this configuration:

  [Interface]
  ...
  Address = 172.16.110.116/28,172.16.111.21/28

  [Peer]
  ...
  AllowedIPs = 172.16.110.112/28

  [Peer]
  ...
  AllowedIPs = 172.16.111.16/28

NetworkManager currently creates the following routes

  (1) 172.16.110.112/28 dev wg0 proto static scope link metric 50 <-- peer route
  (2) 172.16.110.112/28 dev wg0 proto kernel scope link src 172.16.110.116 metric 50 <-- prefix route
  (3) 172.16.111.16/28 dev wg0 proto static scope link metric 50 <-- peer route
  (4) 172.16.111.16/28 dev wg0 proto kernel scope link src 172.16.111.21 metric 50 <-- prefix route

If we try to reach a host in the second peer subnet, route (4)
matches. Route (4) doesn't specify a source IP and so the kernel will
use the first IP set on the interface (172.16.110.116), which is the
wrong one.

  # ip route get 172.16.111.17
  172.16.111.17 dev wg0 src 172.16.110.116 uid 0

To fix this problem, if the AllowedIP subnet is already reachable on
the interface via the prefix route of a static IP address, we should
skip adding the peer route.

wg-quick does something similar here:

  https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/linux.bash?h=v1.0.20250521#n177

The condition in wg-quick is a bit different because it checks that no
duplicate route exists on the interface. We can't do exactly the same
because in NMDeviceWireGuard we don't have visibility on all the
platform routes.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1790
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2254
2025-08-25 16:49:16 +02:00
Íñigo Huguet
933ddab90f merge: branch 'ih/close-parenthesis'
libnmc: fix typo of missing close parenthesis

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2249
2025-08-25 13:35:33 +00:00
Íñigo Huguet
f5c5bcc99d libnmc: fix typo of missing close parenthesis 2025-08-25 13:35:33 +00:00
Íñigo Huguet
7b4d0ef9f2 merge: branch 'ih/release-vpn-gnome'
doc: update the process to release a VPN plugin

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2252
2025-08-25 13:34:54 +00:00
Íñigo Huguet
79ffe55686 doc: update the process to release a VPN plugin 2025-08-25 13:34:54 +00:00
Beniamino Galvani
94d7dd9b11 rpm: change system_ca_path
/etc/pki/tls/cert.pem was a symlink to
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem since Fedora 19 and
it is being removed in Fedora 43.

See https://fedoraproject.org/wiki/Changes/droppingOfCertPemFile

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2257
https://bugzilla.redhat.com/show_bug.cgi?id=2380436
2025-08-25 15:19:47 +02:00
Jan Vaclav
29390b053d merge: branch 'jv/reapply-vfs'
device: add support for reapplying the `sriov.vfs` property

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2255
2025-08-21 08:32:57 +00:00
Jan Vaclav
bbe0e9d8c2 NEWS: update 2025-08-20 09:58:52 +02:00
Jan Vaclav
4ba3ffee67 device: add support for reapplying the sriov.vfs property
Adds support for reapplying the `sriov.vfs` property. Note this
does not include `num_vfs`, as the configuration needs to be reset
and reconfigured from scratch in that case.

Previously, if an existing VF is modified (e.g. if we change the `trust`
flag), we reset all VF configurations, and started from scratch. But in
some cases, this is unnecessarily disruptive.

Resolves: https://issues.redhat.com/browse/RHEL-95844
2025-08-20 09:58:52 +02:00
Jan Vaclav
588a69cd1b device: extract sriov platform vf generation to separate function 2025-08-20 09:58:52 +02:00
Beniamino Galvani
11da867072 merge: branch 'bg/dns-server-valid'
libnm: add nm_dns_server_validate()

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2251
2025-08-18 12:04:03 +00:00
Beniamino Galvani
9f76e11a75 libnm: add nm_dns_server_validate()
Add a new public symbol nm_dns_server_validate() that clients can use
to validate a single DNS server before adding it to the connection.
2025-08-14 11:22:41 +02:00
Beniamino Galvani
d62c25ef2f dns: return error from nm_dns_uri_parse()
Return a GError from nm_dns_uri_parse() to indicate why the URI could
not be parsed. This is useful for logging and user reporting.
2025-08-14 09:40:26 +02:00
Beniamino Galvani
e1a7d5ac06 device: don't generate an assumed connection for ports on wake
After resuming from suspend, devices with wake-on-lan enabled are
temporarily set as unmanaged, and then managed again. At the beginning
of this process, an active device goes from state ACTIVATED to
UNMANAGED and is deconfigured via
"nm_device_cleanup(cleanup_type=CLEANUP_TYPE_DECONFIGURE)".

If the device is attached to a controller, the cleanup doesn't detach
it. Later when the device is managed again, NetworkManager tries to
create an assumed connection. Normally, this would fail because we
detect that the device is not configured. However, if there is a
controller-port relationship, the assumed connection generation
succeeds and the persistent connection doesn't go up.

As this is wrong, prevent the generation of the assumed connection by
detaching the port during a cleanup.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1766
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2242
2025-08-13 13:43:24 +02:00
Íñigo Huguet
600c5452bf po: fix command that should not be translated
The message contains a literal command that should not be translated,
but it was. Fix it.

Fixes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1799
2025-08-12 10:52:29 +02:00
Filip Pokryvka
7562b0e5f9 release: bump version to 1.55.3 (development) 2025-08-01 16:00:58 +02:00
Filip Pokryvka
37dbdd3199 release: bump version to 1.54.0 2025-08-01 15:31:24 +02:00
Íñigo Huguet
4baacfd09d NEWS: update 2025-08-01 14:23:53 +02:00
Beniamino Galvani
a386912ddb platform: fix compilation without LTO
Fix the following error seen when running the build_clean.sh script
with LTO disabled:

  In file included from ../src/libnm-glib-aux/nm-default-glib.h:66,
                   from ../src/libnm-glib-aux/nm-default-glib-i18n-prog.h:13,
                   from ../src/core/nm-default-daemon.h:11,
                   from ../src/core/platform/tests/test-link.c:6:
  In function ‘_nm_auto_freev’,
      inlined from ‘test_link_get_bridge_fdb’ at ../src/core/platform/tests/test-link.c:2732:33:
  ../src/libnm-glib-aux/nm-macros-internal.h:166:8: error: ‘addrs’ may be used uninitialized [-Werror=maybe-uninitialized]
    166 |     if (*p) {
        |        ^
  ../src/core/platform/tests/test-link.c: In function ‘test_link_get_bridge_fdb’:
  ../src/core/platform/tests/test-link.c:2732:33: note: ‘addrs’ was declared here
   2732 |     nm_auto_freev NMEtherAddr **addrs;
        |                                 ^~~~~
  cc1: all warnings being treated as errors

Fixes: 16ef33d380 ('bond-slb: fix memory leak')
(cherry picked from commit b4a22ad2a9)
2025-07-31 15:59:35 +02:00
Beniamino Galvani
1194528b27 nmcli: fix format
Fixes: a9b66e254c ('nmcli: fix compile error')
(cherry picked from commit eff8471de4)
2025-07-31 15:59:34 +02:00
Beniamino Galvani
84c7533760 platform: fix GError free function
Fixes: dd7810c473 ('platform: destroy VFs before changing the eswitch mode')
(cherry picked from commit 394f6281ea)
2025-07-31 15:59:33 +02:00
Beniamino Galvani
43058de07a device: fix signal emission on port detach/release
The "notify::controller" signal must be emitted on the port, not on
the controller.

Fixes: 1f05526ed7 ('core: drop NMDevice master and introduce controller')
(cherry picked from commit 012f1cbfac)
2025-07-31 15:59:32 +02:00
Beniamino Galvani
ca7d42cd7a l3cfg: don't reset the ACD probe timestamp during timer events
acd_data->probing_timestamp_msec indicates when the probing
started. It is used in different places to calculate the timeout for
certain operations. In particular, it is used to detect that the probe
creation took too long when handling the ACD_STATE_CHANGE_MODE_TIMEOUT
event.

If we reset this timestamp at every timer event, we'll never hit the
probe creation timeout. Therefore, the l3cfg will keep trying forever
to create the probe.
See: https://lists.freedesktop.org/archives/networkmanager/2025-July/000418.html

Fix this by not updating the timestamp during a timeout event.

Fixes: a09f9cc616 ('l3cfg: ensure the probing timeout is initialized on probe start')
(cherry picked from commit 407d753a5a)
2025-07-31 15:59:32 +02:00
Beniamino Galvani
2e963061cb l3cfg: fix logging message
Fix spacing in:

 acd[192.168.122.42, probing]: probing currently  stillnot possible
                                                 ^^^^^^^^^

Fixes: b8f9d7b5dd
(cherry picked from commit 74cf2a2bd8)
2025-07-31 15:59:31 +02:00
Beniamino Galvani
8ae10b4148 ndisc: fix logic to limit the number of addresses
Fixes: c2c8c67d8c ('ndisc: rate limit number of accepted RA data to track')
(cherry picked from commit eb7917a387)
2025-07-31 15:59:31 +02:00
Beniamino Galvani
f78dca964f libnm-core: validate the ipvlan mode
The setting must reject unknown ipvlan modes.

Fixes: d238ff487b ('ipvlan: add support to IPVLAN interface')
(cherry picked from commit fdb8f07c44)
2025-07-31 15:59:31 +02:00
Beniamino Galvani
6b01ae3f15 libnm-core: fix p-key validation for Infiniband connections
verify() is setting an error without returning FALSE to make the
validation fail. When the parent is set, the device is a Infiniband
partition and it must have a p-key != -1.

Fixes: d595f7843e ('libnm: add libnm/libnm-core (part 1)')
(cherry picked from commit f4f1ecc7ea)
2025-07-31 15:59:30 +02:00
Beniamino Galvani
976c5dbb5f libnm-core: fix documentation for NMSettingMatch functions
Fixes: 3a8e46f2a5 ('settings: add match for proc cmdline')
(cherry picked from commit 104cafdd44)
2025-07-31 15:59:30 +02:00
Beniamino Galvani
e56bc740d0 core: fix nm_utils_get_nm_gid()
Fixes: 31dbcb81fe ('core: make nm_utils_get_nm_[ug]id() thread safe')
(cherry picked from commit b58a37acfe)
2025-07-31 15:59:30 +02:00
Beniamino Galvani
12e033368f core: fix Wi-Fi data rate tables
Fixes: f2b0092b5b ('wifi: parse BSS IEs for 80211n and 80211ac data rates')
(cherry picked from commit fa80896ee7)
2025-07-31 15:59:30 +02:00
Beniamino Galvani
f4c5ded09b dhcp: fix parsing of the search list option
The DHCP search list option (119) can use the "message compression"
algorithm specified in RFC 1035 section 4.1.4 to reduce the size of
the message in presence of subdomains that appear multiple times.

When using the compression a label starts with:

    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    | 1  1|                OFFSET                   |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where the offset points to a previous domain.

Previously, the parsing code was taking the lower 6 bits of the first
byte, shifting them left 16 bits, and adding the next byte. Instead,
the shift should be of 8 bits.

The effect of this bug was that when the offset was greater than 255,
it was incorrectly parsed as a number larger than the message size,
and the parsing failed.

Note that while a single DHCP option can be at most 255 bytes, a DHCP
message can contain multiple instances of the same option. The
receiver must concatenate all the occurrences according to RFC 3396
and parse the resulting buffer.

Fixes: 6adade6f21 ('dhcp: add nettools dhcp4 client')
(cherry picked from commit a9d7abbc50)
2025-07-31 15:59:29 +02:00
Beniamino Galvani
ce40c72812 dhcp: fix typo in tcp_keepalive_interval option name
Fixes: eed205bff3 ('dhcp/internal: move dhcp options management to shared dhcp codebase')
(cherry picked from commit d017dc67b4)
2025-07-31 15:59:29 +02:00
Beniamino Galvani
85edac5d7c bond-slb: fix memory leak
If sendto() fails, the function returns and the remaining entries are
not deallocated. Use nm_auto_freev instead to free the array and the
pointer it contains.

Add a test to check that nm_auto_freev does the right thing on the
value returned by nm_linux_platform_get_bridge_fdb().

Fixes: 3f2f922dd9 ('bonding: send ARP announcement on bonding-slb link/carrier down')
(cherry picked from commit 16ef33d380)
2025-07-31 15:59:29 +02:00
Beniamino Galvani
a909c6f611 platform: rename nm_linux_platform_get_link_fdb_table()
Rename nm_linux_platform_get_link_fdb_table() to
nm_linux_platform_get_bridge_fdb(). The new name better indicates that
the function returns the bridge FDB entries.

(cherry picked from commit 7d23ed9f73)
2025-07-31 15:59:24 +02:00
Beniamino Galvani
9cddd7c0a4 vrf: fix wrong logging domain
Fixes: 667568d1b2 ('core,libnm: add VRF support')
(cherry picked from commit 20a1d7e816)
2025-07-31 15:42:31 +02:00
Beniamino Galvani
051c2f8ea1 lldp: fix memchr() argument order
The validation of embedded NUL character was skipped due to the wrong
order of arguments to memchr(). Fix it.

Fixes: 4043f82790 ('lldp: cleanup converting binary LLDP fields to string')
(cherry picked from commit ce17284c3f)
2025-07-31 15:42:31 +02:00
Beniamino Galvani
d34d564bb4 supplicant: fix wrong check on "EAP" signal arguments
The check is inverted.

Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
(cherry picked from commit 50a400e16f)
2025-07-31 15:42:31 +02:00
Beniamino Galvani
cbe5da4fd4 libnm-core,core: accept uid/gid up to (2^32 - 2) for tun devices
Linux UIDs/GIDs are 32-bit unsigned integer, with 4294967295 reserved
as undefined.

Before:
  # useradd -u 4294967294 -M testuser
  useradd warning: testuser's uid -2 outside of the UID_MIN 1000 and UID_MAX 60000 range.
  # nmcli connection add type tun ifname tun1 owner 4294967294 ipv4.method disabled ipv6.method disabled
  Error: Failed to add 'tun-tun1' connection: tun.owner: '4294967294': invalid user ID

After:
  # useradd -u 4294967294 -M testuser
  useradd warning: testuser's uid -2 outside of the UID_MIN 1000 and UID_MAX 60000 range.
  # nmcli connection add type tun ifname tun1 owner 4294967294 ipv4.method disabled ipv6.method disabled
  Connection 'tun-tun1' (5da24d19-1723-45d5-8e04-c976f7a251d0) successfully added.
  # ip -d link show tun1
  2421: tun1: <NO-CARRIER,POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 500
      link/none  promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
      tun type tun pi off vnet_hdr off persist on user testuser ...
                                                 ^^^^^^^^^^^^^
Fixes: 1f30147a7a ('libnm-core: add NMSettingTun')
(cherry picked from commit 253800238e)
2025-07-31 15:42:30 +02:00
Beniamino Galvani
a509efdbab ovs: fix logging message
Fixes: a259303e1d ('ovs: add support for "other_config" settings')
(cherry picked from commit 55765d2914)
2025-07-31 15:42:30 +02:00
Beniamino Galvani
2478dca1a1 core: fix properties update for HSR devices
Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
(cherry picked from commit 404a3ec853)
2025-07-31 15:42:30 +02:00
Beniamino Galvani
60e7bb86b8 bond: fix attribute assignment macro
Currently the bug is hidden because the macro is only called with
NM_SETTING_BOND_OPTION_ARP_IP_TARGET.

Fixes: 45c95e9314 ('device/bond: rework setting of arp_ip_target bond options')
(cherry picked from commit 1229fe5abd)
2025-07-31 15:42:30 +02:00
Beniamino Galvani
7eaa10fe10 nmcli: fix compile error
Running the build script with LTO disabled
("contrib/fedora/rpm/build_clean.sh -W lto") gives the following error:

  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-client-aux-extern/nm-default-client.h:11,
                   from ../src/nmcli/connections.c:6:
  In function ‘_nm_auto_unref_ptrarray’,
      inlined from ‘do_connection_add’ at ../src/nmcli/connections.c:6069:35:
  ../src/libnm-std-aux/nm-std-aux.h:1106:12: error: ‘props’ may be used uninitialized [-Werror=maybe-uninitialized]
   1106 |         if (*v)                               \
        |            ^
  ../src/libnm-glib-aux/nm-macros-internal.h:91:1: note: in expansion of macro ‘NM_AUTO_DEFINE_FCN0’
     91 | NM_AUTO_DEFINE_FCN0(GPtrArray *, _nm_auto_unref_ptrarray, g_ptr_array_unref);
        | ^~~~~~~~~~~~~~~~~~~
  ../src/nmcli/connections.c: In function ‘do_connection_add’:
  ../src/nmcli/connections.c:6069:35: note: ‘props’ was declared here
   6069 |     gs_unref_ptrarray GPtrArray  *props;
        |                                   ^~~~~
  cc1: all warnings being treated as errors

Fix it.

Fixes: bb850fda0e ('nmcli: connection: process port-type, type and controller first')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2236
(cherry picked from commit a9b66e254c)
2025-07-31 15:42:30 +02:00
Beniamino Galvani
4deee49763 core: accept hostnames longer than 64 characters from DNS lookup
When resolving the system hostname from DNS lookup, we use
nm_utils_validate_hostname() which checks that the result is a valid
hostname. A valid hostname is at most 64 characters on Linux. Anything
longer is discarded.

However, the reverse DNS lookup doesn't return a hostname, it returns
a DNS name. The DNS name can have multiple labels, each limited to 63
characters. The maximum length of the DNS name is 253 characters.

If the result is longer than 64 characters because it has multiple
labels, we should still accept it, provided that it is a valid DNS
name. Then when setting the hostname in the system, only the first
label will be kept.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2243

Resolves: https://issues.redhat.com/browse/RHEL-104357
(cherry picked from commit b019883a9a)
2025-07-23 11:16:45 +02:00
Beniamino Galvani
93ed7a2c38 merge: branch 'bg/misc-fixes2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2245
2025-07-23 11:13:14 +02:00
Beniamino Galvani
ec996135a9 device: fix comment in attach_port() 2025-07-23 11:12:00 +02:00
Beniamino Galvani
012f1cbfac device: fix signal emission on port detach/release
The "notify::controller" signal must be emitted on the port, not on
the controller.

Fixes: 1f05526ed7 ('core: drop NMDevice master and introduce controller')
2025-07-23 11:11:59 +02:00
Beniamino Galvani
394f6281ea platform: fix GError free function
Fixes: dd7810c473 ('platform: destroy VFs before changing the eswitch mode')
2025-07-23 11:11:59 +02:00
Beniamino Galvani
e4f321c307 merge: branch 'bg/bridge-port-fix-reapply'
bridge: fix reapplying port VLANs

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2240

(cherry picked from commit bd41951f1d)
2025-07-23 11:03:10 +02:00