Commit Graph

33946 Commits

Author SHA1 Message Date
Beniamino Galvani
32ab60f960 device: remove the "can_reapply_change_ovs_external_ids" device field
NMDevices have a special "can_reapply_change_ovs_external_ids" boolean
field indicating whether the device type supports reapplying the
ovs-external-ids and ovs-other-config settings.

Remove this field and use the standard can_reapply_change() method. No
change in behavior is expected.
2025-04-29 11:03:26 +02:00
Beniamino Galvani
4f577d677f ovs: allow reapplying ovs-bridge and ovs-port properties
Allow reapplying the following properties:

 - ovs-bridge.fail-mode
 - ovs-bridge.mcast-snooping-enable
 - ovs-bridge.rstp-enable
 - ovs-bridge.stp-enable
 - ovs-port.bond-downdelay
 - ovs-port.bond-mode
 - ovs-port.bond-updelay
 - ovs-port.lacp
 - ovs-port.tag
 - ovs-port.trunks
 - ovs-port.vlan-mode
2025-04-29 11:03:26 +02:00
Beniamino Galvani
e8e0d43f04 merge: branch 'bg/ovs-bridge-ext-port'
ovs: only keep bridges and ports with NM interfaces attached

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2193
2025-04-29 07:18:27 +00:00
Beniamino Galvani
476c89b6f2 ovs: only keep bridges and ports with NM interfaces attached
If a OVS bridge created via NM has a port created externally, when the
bridge connections goes down then NM detaches the NM-created
port. However, it finds that the bridge still has a port (the external
one) and so it doesn't remove the bridge from ovsdb.

This is a problem, because it means that an explicity deactivation of
the bridge leaves the bridge up. To fix this, only track the number of
port in the bridge actually created by NM. Also, leave alone bridges
not created by NM.
2025-04-29 09:10:52 +02:00
Beniamino Galvani
78a4e5cf3b ovs: slightly improve _delete_interface()
Add comments, and move variables inside the block where they are used.
2025-04-29 09:10:52 +02:00
Beniamino Galvani
0d10c743a5 merge: branch 'nbft-parser-1'
initrd: add new NBFT parser

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2077
2025-04-28 16:44:24 +00:00
Tomas Bzatek
ec917dc670 ci: add libnvme dependency
Required for the nm-initrd-generator NBFT support.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Tomas Bzatek
f0d6b339bf initrd: skip NBFT parsing when already defined on the cmdline
Skip the internal NBFT table parsing when nbft interfaces
are already defined on the cmdline, e.g. from the original
95nvmf dracut module.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Tomas Bzatek
81839c0da8 initrd: workaround zero v6 prefixes for NBFT HFIs
Some firmware implementations incorrectly report v6 address prefix
of zero. Let's use /64 as a sane workaround.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Tomas Bzatek
d38cbfb3d1 initrd: VLAN support for the NBFT parser
Creates additional connections for VLANs, which are in fact
separate HFI records in the NBFT table. Uses MAC address for
linking parent interface as the interface naming is defined
by an external service.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Tomas Bzatek
8b7c6f8b90 initrd: avoid dynamic linking of libnvme, use dlopen() instead
As suggested during the review process, NBFT is niche and most users
won't need it. So keep the initrd generator light and only open
libnvme when any NBFT table is found.

In a typical dracut host-only scenario the nbft dracut module will
be pulled in only when NBFT is present in the system, packing in
nvme-cli and libnvme in the initramfs image.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Tomas Bzatek
1cb0635d08 initrd: add new NBFT parser
The NVMe Boot Firmware Table (NBFT) is a mechanism of passing context
from a pre-OS Boot environment to an OS runtime, as defined by the
NVM Express Boot Specification. Exposed as an ACPI table it contains
network interface definitions along with NVMe subsystem and namespace
data structures.

This adds new nm-initrd-generator parser that uses libnvme NBFT parser
implementation.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
2025-04-28 16:09:54 +00:00
Jan Vaclav
03f30ac5cf merge: branch 'jv/po-check'
po: add test to check potfiles list contents

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2190
2025-04-24 10:30:33 +00:00
Jan Vaclav
92c776a88d po: update lists 2025-04-24 10:27:36 +02:00
Jan Vaclav
104be9da87 po: add test to check potfiles list contents
We often forget to add new files to POTFILES, and also
have some paths in the skip file that have not existed
for 15+ years. We should ensure that these files include
the paths that should be there, and nothing more.

This commit adds a test that checks whether all the files
in the po lists exist, and vice versa, that all the files
in the source tree that should be included in this list,
are indeed included in this list.
2025-04-24 10:27:36 +02:00
Beniamino Galvani
e22de07553 merge: branch 'carrier-less-conditions'
device: remove activated condition when the carrier was down

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2189
2025-04-22 16:24:52 +00:00
Friedrich Altheide
c7fc8a4d09 device: remove activated condition when the carrier was down
Call nm_device_update_dynamic_ip_setup every time the carrier was down or was seen down and is now up again, without checking if the state is NM_DEVICE_STATE_ACTIVATED.

Change discussed in https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2173
2025-04-21 19:30:30 +00:00
Beniamino Galvani
87453425ef merge: branch 'dnsconfd_vpn_fix'
dns: Make dnsconfd plugin respect dns-priority

Closes #1748

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2187
2025-04-18 12:32:27 +00:00
Tomas Korbar
e41558e08c dns: Make dnsconfd plugin respect dns-priority
Fixes #1748
2025-04-18 12:14:03 +00:00
Beniamino Galvani
7b2924b762 merge: branch 'bg/ethtool-netlink'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2169
2025-04-17 08:11:54 +02:00
Beniamino Galvani
3fb86182eb README: document the required kernel version
Add a new section in README.md that describes the required Linux
kernel version.
2025-04-17 08:10:54 +02:00
Beniamino Galvani
250475c0fd platform: replace ring ethtool ioctl calls with netlink 2025-04-17 08:10:53 +02:00
Beniamino Galvani
3580dfe517 platform: replace EEE ethtool ioctl calls with netlink 2025-04-17 08:10:51 +02:00
Beniamino Galvani
62c841afcf platform: use the new ethtool-netlink API for pause settings 2025-04-17 08:10:51 +02:00
Beniamino Galvani
79ba228c59 platform: add ethtool netlink implementation
Introduce some basic infrastructure to perform ethtool operations via
netlink. As a proof of concept, implement the pause settings.

Netlink has some advantages over ioctl():

 - it can be easily extended with new attributes;

 - it can return descriptive error messages via the extended ack
   mechanism. For example, when setting the ring parameters to a value
   outside the allowed range, userspace receives error code -EINVAL
   and message "requested ring size exceeds maximum". ioctl() gets
   only -EINVAL, which is shared among many error reasons;

 - since it's possible to specify an ifindex in the request, there are
   no race conditions when the interface name changes;

New ethtool API is available only via netlink; however it makes sense
to start using netlink also for the old API that NM is already using
(pause, eee, rings, etc.) over ioctl() because of the advantages
described above.
2025-04-17 08:10:50 +02:00
Beniamino Galvani
e8a3cd611e platform: move ethtool ioctl functions to a separate file
We're going to replace most of the ioctl-based ethtool functions with
a netlink-based equivalent. Move the ioctl ones to a separate file so
that it's easier to see what still needs to be converted. Also add a
common prefix to the function names.
2025-04-17 08:10:49 +02:00
Beniamino Galvani
88efe48916 libnm-setting: remove unused include 2025-04-17 08:10:49 +02:00
Beniamino Galvani
37785a57e0 platform: use consistent naming for ethtool functions
For unknown reasons (wrong copy and paste?) the getter functions had a
"link" in the name. Remove it.
2025-04-17 08:10:48 +02:00
Íñigo Huguet
a3dd1ef2c7 merge: branch 'ih/fix-ovs-timeout-crash'
core: ovs: fix NULL pointer dereference in ovsdb read timeout callback

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2192
2025-04-16 10:16:02 +00:00
Íñigo Huguet
dc9bf255ee core: ovs: fix NULL pointer dereference in ovsdb read timeout callback
Fixes: f7d321c6d6 ('ovsdb: add watchdog for unparsable JSON data in socket')
2025-04-16 10:15:42 +00:00
Jan Vaclav
b62a0ae7b3 merge: branch 'jv/nmtui-lo'
nmtui: add support for configuring loopback interface

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2175
2025-04-16 07:01:02 +00:00
Jan Vaclav
de56b482f3 nmtui/editor: hide "device" field for loopback connections
This field is irrelevant for this device type, since it will always
be just "lo".
2025-04-15 11:43:06 +00:00
Jan Vaclav
2953200a65 core/devices: generate connections with autoconnect=true
Previously, when a generated connection was edited, and the
machine was rebooted, the connection would not apply, and a
new generated connection would be made, because autoconnect
was set to FALSE.

Set autoconnect to be true by default, so that the modified
generated connection is applied.
2025-04-15 11:43:06 +00:00
Jan Vaclav
f489d213f2 nmtui: add page for configuring loopback interface 2025-04-15 11:43:06 +00:00
Beniamino Galvani
b571e2be5a man: fix syntax to match on connection-id
Fixes: 604c611cd0 ('core: add nm_utils_connection_match_spec_list()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1746
2025-04-15 11:15:02 +02:00
Filip Pokryvka
ec6d122cc9 release: bump version to 1.53.3 (development) 2025-04-14 19:16:15 +02:00
Beniamino Galvani
065fd3e046 merge: branch 'bg/rto-min'
platform: always set the lock flag for RTO_MIN

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2179
2025-04-14 14:43:09 +00:00
Beniamino Galvani
6478e5158a platform: always set the lock flag for RTO_MIN
The rto-min value is ignored by kernel unless the lock flag is set.
2025-04-14 16:41:39 +02:00
Beniamino Galvani
2b922a93a5 platform: accept 0 as valid rto_min value
iproute2 and the kernel accept 0 as valid rto_min value:

  # ip route add 172.16.0.1 dev enp1s0 rto_min 0ms
  # ip route show
  172.16.0.1 dev enp1s0 scope link rto_min lock 0ms

Even if a value of 0ms would not be useful in practice, it is better
to exactly track what kernel reports, instead of assuming that when
the value is zero it is "not set".
2025-04-14 16:41:39 +02:00
Beniamino Galvani
14106431fb libnm-core: set ovs-dpdk and ovs-patch as non-base settings
Settings "ovs-dpdk" and "ovs-patch" are currently marked with priority
NM_SETTING_PRIORITY_HW_BASE, which makes them "base" settings. This
means that they can be used as connection type, for example via "nmcli
connection add type ovs-dpdk ...".

This is wrong, as both settings can only belong to a connection of
type "ovs-interface". Decrease their priority and make them non-base
settings.

The problem was spotted when trying to add a ovs-patch connection via
nmcli:

  # nmcli connection add type ovs-patch ifname p con-name q ovs-patch.peer r controller s port-type ovs-port
  Warning: controller='s' doesn't refer to any existing profile.

  (process:4580): nm-CRITICAL **: 10:15:42.807: file ../src/libnm-core-impl/nm-connection.c: line 1682 (_normalize_ovs_interface_type): should not be reached

  (process:4580): nm-WARNING **: 10:15:42.807: connection did not verify after normalization: ??

  (process:4580): nm-CRITICAL **: 10:15:42.807: file ../src/libnm-core-impl/nm-connection.c: line 2170 (_connection_normalize): should not be reached
  Error: Failed to add 'q' connection: ovs-interface.type: A connection with 'ovs-patch' setting must be of connection.type "ovs-interface" but is "ovs-patch"

Fixes: d0ec501163 ('cli: assert that valid_parts are set for base types')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2178
2025-04-14 13:39:13 +02:00
Beniamino Galvani
37d8945b13 libnm: fix memory leak when parsing IP configuration
When the dictionary contains keys "address" and "uri", the first value
is leaked.

  ==4730== 14 bytes in 1 blocks are definitely lost in loss record 51 of 1,755
  ==4730==    at 0x4841866: malloc (vg_replace_malloc.c:446)
  ==4730==    by 0x4CC5CB9: g_malloc (gmem.c:100)
  ==4730==    by 0x4CDF518: g_strdup (gstrfuncs.c:323)
  ==4730==    by 0x496A6B8: g_strdup_inline (gstrfuncs.h:321)
  ==4730==    by 0x496A6B8: nm_inet_ntop_dup (nm-inet-utils.h:355)
  ==4730==    by 0x496A95B: nm_inet_parse_str (nm-inet-utils.c:539)
  ==4730==    by 0x48AF3A3: _notify_update_prop_nameservers (nm-ip-config.c:179)

Fixes: 4422b14704 ('core, libnm: support per-connection DNS URIs')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2184
2025-04-14 13:36:57 +02:00
Íñigo Huguet
26f2673b90 merge: branch 'ih/nmcli-ovs-port-type'
nmcli: connection: process port-type, type and controller properties first

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2165
2025-04-14 10:08:28 +00:00
Íñigo Huguet
9f6562869b nmcli: improve the warning message about no controller found
When nmcli tries to match a controller it filters by its type. The
controller's type must match with the port's port-type. If no controller
matches, the printed warning was "doesn't refer to any existing
profile". However, the profile might exist, but with wrong type. Improve
the message so it makes that clear.

Fixes: aa12bb353b ('cli: discover slave type for a connection with a master')
2025-04-14 10:08:01 +00:00
Íñigo Huguet
87a5d89f75 nmcli: choose the right port-type for OVS
Normally it is possible not to define port-type in nmcli and it deduces
it from connection.type or connection.controller. Some types like 'bond-slave'
have a single possible value for port-type. In other cases nmcli deduces
the port-type by getting the controller's type, like 'bond'.

For OVS connections, the second method of guessing by the controller's
type was used.  However, in OVS it is common to have different devices
with the same name, causing nmcli to use "ovs-interface" as port-type
if it matched by controller name.

Fix if by deducing the port-type from the connection's type. An ovs-port
connection must always have port-type=ovs-bridge, and an ovs-interface
connection must always have port-type=ovs-port.

Note that this is something that should be done in the daemon, not in
the clients, but this is a small patch that makes it to work in nmcli,
at least. Without this, the mechanism of guessing from the parent would
act, leading to wrong results.

Ideally, all this should be done in the daemon, but currently many
checks in nmcli/libnm depends on having the port-type set, and it
would be lot of work to change it.

Fixes: c5324ed285 ('nmcli: streamline connection addition')
2025-04-14 10:08:01 +00:00
Íñigo Huguet
6a133d10a1 nmcli: connection: don't overwrite port-type if explicitly set
When processing the "type" property we deduce the port-type in some
cases and set it. If the user has chosen a port-type we must not
overwrite it. In any case, we should raise an error when validating the
connection.

Fixes: c5324ed285 ('nmcli: streamline connection addition')
2025-04-14 10:08:01 +00:00
Íñigo Huguet
bb850fda0e nmcli: connection: process port-type, type and controller first
If the connection is a port we need to set the connection.port-type
property. Usually this property is guessed by nmcli depending on the
connection type or the chosen controller, so it doesn't need to be
specified by the user. However, if it is explicitly set by the user
we should not guess, but just use it.

When we process arguments like "controller" or "type" we call custom
functions like set_connection_controller that will guess the port-type
if needed. By processing port-type first, it will be set in the
connection by the time that these other properties are processed, so they
won't try to guess.

After port-type, process connection.type and connection.controller, as we
are usually capable of deducing the port-type from them. Type needs to
be processed first because some types like bond-slave or ovs-port have
only one possible port-type value so we must not try to guess from the
controller.

Fixes: c5324ed285 ('nmcli: streamline connection addition')
2025-04-14 10:08:01 +00:00
Beniamino Galvani
fcf304bbf1 merge: branch 'carrier-down'
device: renew dhcp lease if carrier was down

Closes #1663

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2173
2025-04-14 07:48:44 +00:00
Friedrich Altheide
163c2574d8 device: renew dhcp lease only if carrier was down
Make sure nm_device_update_dynamic_ip_setup is called every time a carrier was down before and the link is now up again.
Previously the dhcp lease was not renewed if the carrier went down and then up again quickly enough.
This led to cases where an old IP was retained even though the device was connected to a different network with a different DHCP server.

This commit introduces device_link_carrier_changed_down

Fixes: d6429d3ddb ('device: ensure DHCP is restarted every time the link goes up')
2025-04-14 07:04:03 +02:00
Lubomir Rintel
fe0b6ad68c merge: branch 'lr/oci-vm-new-conn'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2180
2025-04-11 12:09:49 +02:00
Lubomir Rintel
cb7157f552 test-client: add test for OCI VNIC on VM
Tests that we create a connection for disconnected device.
2025-04-11 11:44:05 +02:00