Commit graph

33799 commits

Author SHA1 Message Date
Jan Vaclav
2afcebe0c7 wireguard: add firewall rules to copy mark
When a WG connection is connecting to an IPv6 endpoint, configures a
default route, and firewalld is active with IPv6_rpfilter=yes, it never
handshakes and doesn't pass traffic. This is because firewalld has a
IPv6 reverse path filter which is discarding these packets.

Thus, we add some firewall rules whenever a WG connection is brought up
that ensure the conntrack mark and packet mark are copied over.
These rules are largely inspired by wg-quick:

https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/linux.bash?id=17c78d31c27a3c311a2ff42a881057753c6ef2a4#n221
(cherry picked from commit db557908a2)
2025-05-12 13:38:38 +02:00
Jan Vaclav
57321f78c9 build: add path definition for ip6tables
(cherry picked from commit 0f469b30ad)
2025-05-12 13:38:38 +02:00
Jan Vaclav
ff853203d9 firewall/utils: move logs from sharing to firewall domain
(cherry picked from commit 10c2892d57)
2025-05-12 13:38:38 +02:00
Jan Vaclav
e77a1df6e7 firewall/utils: fix ntf -> nft typo
Fixes: 4badc1f33a ('firewall: fix signalling timeout error reason from _fw_nft_call()')
(cherry picked from commit e39e119636)
2025-05-12 13:38:38 +02:00
Beniamino Galvani
6f480d9494 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

(cherry picked from commit 4f577d677f)
2025-05-09 16:45:50 +02:00
Vladimír Beneš
e568648717 merge: branch 'vb/dnsconfd_oci_backports'
backport oci chnages to nm-1-52

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2188
2025-04-11 13:16:40 +00:00
Lubomir Rintel
0c5e37f34d test-client: add test for OCI VNIC on VM
Tests that we create a connection for disconnected device.

(cherry picked from commit cb7157f552)
2025-04-11 14:45:08 +02:00
Lubomir Rintel
4321cca3e8 test-client: split up _mock_devices()
The new VM OCI VNIC tests will need to create the devices, but leave one
disconnected.

(cherry picked from commit c42322bd0d)
2025-04-11 14:45:03 +02:00
Lubomir Rintel
629d85e4da test-client: expand MAC addresses from variable
Less literals, more expanded variables. Makes it a little easier to read
for me.

(cherry picked from commit 39db524d94)
2025-04-11 14:44:58 +02:00
Lubomir Rintel
a212c9452e test/nm-service: default the devices to DISCONNETED not UNAVAILABLE
It is a little odd that client tests connect "UNAVAILABLE" devices, and
the devices return to "DISCONNECTED" after deactivation.

It differs from what happens in reality, and some client tools
(hey nm-cloud-setup) can break when they rightly assume that the
device is not ready for activation when it's "UNAVAILABLE" not
"DISCONNECTED".

(cherry picked from commit 79b1877c02)
2025-04-11 14:44:53 +02:00
Lubomir Rintel
8371b4733e cloud-setup: configure disconnected wired devices on OCI
On OCI VMs (virtual machines, as opposed to BM -- bare metal), the VNICs
don't get their addresses via DHCP and need us to get the address from
the metadata and apply it.

https://issues.redhat.com/browse/NMT-1432
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2180
(cherry picked from commit 548e27ef5f)
2025-04-11 14:44:48 +02:00
Lubomir Rintel
06e35f165f cloud-setup: add a chicken bit variable for creation of new connections
Make it possible to opt in or out of the behavior of creating
connections for disconnected devices. It's not clear why such policy was
in place, and the feature might come useful outside OCI.

Let's add an (undocumented) knob to configure the behavior. We might
remove it (and perhaps make the behaviour default everywhere), or
document and keep it if it turns out we need to use it.

(cherry picked from commit 0540b3c9bc)
2025-04-11 14:44:43 +02:00
Lubomir Rintel
e933dfaf72 cloud-setup: factor out creation of new connection
We're going to create connections on wired devices for OCI VM VNICs, and
they're going to also need the same user setting. Factor it out.

(cherry picked from commit 93960639e8)
2025-04-11 14:44:37 +02:00
Lubomir Rintel
22f3cdd8ab cloud-setup: add device argument to nmcs_add_and_activate()
This will allow us to add & complete connections for existing devices,
such as VNICs on OCI VMs.

(cherry picked from commit 9895540a24)
2025-04-11 14:44:32 +02:00
Lubomir Rintel
07d549eb5a cloud-setup: split up _nmc_skip_connection_by_type()
Split _nmc_skip_connection_by_type() so that we can get a little
more finely grained error reporting.

(cherry picked from commit 961be7d971)
2025-04-11 14:44:27 +02:00
Wen Liang
3dee98acdc merge: branch 'wl/nm-1-52'
core: fail early if we cannot get current FEC value

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2181
2025-04-07 13:31:15 +00:00
Íñigo Huguet
094a542546 core: optimize hash table search in _ethtool_fec_set
Break the loop as soon as we've found the value.

Fixes: 19bed3121f ('ethtool: support Forward Error Correction(fec)')
(cherry picked from commit 245f0e0b35)
2025-04-07 08:10:47 -04:00
Íñigo Huguet
b7e34f225a core: fail early if we cannot get current FEC value
If we cannot get current FEC value probably we won't be able to set it a
few lines later. Also, if it fails to set, we try to use the value of
the old one that we tried to retrieve without success. In that case, the
variable old_fec_mode would be uninitialized. Fix it by returning early
if we cannot get the current value.

Fixes: 19bed3121f ('ethtool: support Forward Error Correction(fec)')
(cherry picked from commit cbdd0d9cca)
2025-04-07 08:10:39 -04:00
Beniamino Galvani
1ace58c0c2 merge: branch 'dnsconfd_plugin_fixes'
dns: Fix invalid memory access on Dnsconfd DBUS error

Closes #1738

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

(cherry picked from commit a0ff8d20f0)
2025-03-24 09:15:39 +01:00
Tomas Korbar
873adc4dc0 dns: Refactor changing of Dnsconfd plugin state
(cherry picked from commit 7ba27f7a13)
2025-03-24 09:15:39 +01:00
Tomas Korbar
de4f4e870d dns: Fix invalid memory access on Dnsconfd DBUS error
DBus errors were not properly handled after DBus calls and
that caused SIGSEGV. Now they are checked.

Fixes #1738
Fixes: b8714e86e4 ('dns: introduce configuration_serial support to the dnsconfd plugin')

(cherry picked from commit 4ad20787bb)
2025-03-24 09:15:39 +01:00
Íñigo Huguet
995a28fa1c release: bump version to 1.52.0 2025-02-28 14:55:33 +01:00
Íñigo Huguet
f275a4d08a contrib/build: ignore missing signingkey in git config
Fixes: 64f8ec6099 ('rpm/build*.sh: trap failures')
(cherry picked from commit 90c403f4ef)
2025-02-28 14:34:48 +01:00
Íñigo Huguet
1e89a05a20 CI: update images 2025-02-28 14:21:35 +01:00
Lubomir Rintel
837cf2e6e4 gitlab/fedora-install: use yum install --allowerasing
This allows us to drag in packages that replace something in the base
image. Notably, this fixes installing pppd on Fedora 42 that requires
systemd (whereas the image has conflicting systemd-standalone-sysusers).

(cherry picked from commit 979717df4e)
2025-02-28 14:21:19 +01:00
Lubomir Rintel
726e0a5aee fedora/REQUIRED_PACKAGES: remove very old optional package names
Attempting to install these takes time and they are no longer there
since ancient times. CentOS 9 and later are fine.

(cherry picked from commit 39efc8a394)
2025-02-28 14:21:19 +01:00
Lubomir Rintel
3982c5a04d Revert "fedora/REQUIRED_PACKAGES: speed up optional packages installation"
dnf --skip-unavailable not available on CentOS 9.

This reverts commit 5409d4f5cd.

(cherry picked from commit e2aa19a06c)
2025-02-28 14:21:19 +01:00
Lubomir Rintel
57f9d99b8a contrib: drop old gtkdoc patch
This has been integrated 6 years ago.

(cherry picked from commit 054962aeea)
2025-02-28 14:21:19 +01:00
Lubomir Rintel
81f272babe contrib/build: ignore initial failure to set $SOURCE
More fallout from set -e patch, encountered during a release.

Fixes: 64f8ec6099 ('rpm/build*.sh: trap failures')
(cherry picked from commit aea231f489)
2025-02-28 09:43:38 +01:00
Íñigo Huguet
815b3f5885 NEWS: update for 1.52 release 2025-02-28 09:40:55 +01:00
Lubomir Rintel
a0779a9339 keyfile: don't crash on failure to write
The log statement ended up using wrong (always NULL) connection to get
ID from. Fix.

Resolves: https://issues.redhat.com/browse/RHEL-77157
(cherry picked from commit a7cf9d399f)
2025-02-28 09:18:26 +01:00
Lubomir Rintel
5c16bb1d26 Reapply "client/test: add test for VLANs on OCI"
This reverts commit a852b79cf5.

(cherry picked from commit 70872cbb38)
2025-02-26 13:30:08 +01:00
Lubomir Rintel
68d7e17737 Reapply "cloud-setup: create VLANs for multiple VNICs on OCI"
The idea is to create a pair of VLAN and MACVLAN with AddAndActivate if
they are not present, and otherwise follow the ordinary (GetApplied &
Reapply) procedure if the devices are already present.

This reverts commit 87d7ccc580.

(cherry picked from commit 7eee669217)
2025-02-26 13:30:04 +01:00
Lubomir Rintel
369db80086 Reapply "cloud-setup: lookup device by MAC + type instead of just MAC"
This will be useful for updating configuration of Vlans and MacVlans,
some of having same MAC addresses as devices of other type.

This reverts commit cee0515f13.

(cherry picked from commit 6cedd594b6)
2025-02-26 13:30:00 +01:00
Lubomir Rintel
fd6f4f86e4 Reapply "cloud-setup: parse OCI metadata related to VLAN config"
Baremetal instances in Oracle Cloud require special VLAN config. Parse
the metadata related to it.

This reverts commit 5eefd2d59c.

(cherry picked from commit 5c3efeef15)
2025-02-26 13:29:57 +01:00
Lubomir Rintel
b7114d00ed Reapply "manager: create virtual devices on AddAndActivate()"
This reverts commit ccae5dc0e2.

(cherry picked from commit 11045cfa00)
2025-02-26 13:29:53 +01:00
Lubomir Rintel
4a1c51317e manager: make system_create_virtual_device() return a GError
This is done so that AddAndActivate() will return sensible errors in a
future patch that makes it support creating virtual devices.

In effect, all errors are logged in one place, therefore the log levels
are different. I don't think we're losing anything of value by being
a little less verbose here.

(cherry picked from commit 45d82f720c)
2025-02-26 13:29:49 +01:00
Íñigo Huguet
949c7b84a3 policy: fix unitialized variable
The variable 'change' may be used uninitialized.

Fixes: 7acc66699a ('policy: always reset retries when unblocking children or ports')
(cherry picked from commit af6aca3527)
2025-02-24 16:47:19 +01:00
Beniamino Galvani
bc6248a3eb merge: branch 'bg/mptcp-endpoints'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2141

(cherry picked from commit 472a7b48e8)
2025-02-24 09:07:54 +01:00
Beniamino Galvani
ceef38d9a5 l3cfg: only add MPTCP endpoints for non-tentative IPv6 addresses
An IPv6 endpoint is not usable until the address is non-tentative. Add
a mechanism to wait until the address is ready.

(cherry picked from commit 227cd6307b)
2025-02-24 09:07:54 +01:00
Beniamino Galvani
2c5a51201d l3cfg: wait for the address before configuring an MPTCP endpoint
Skip the configuration of the MPTCP endpoint when the address is in
the l3cd but is not yet configured in the platform. This typically
happens when IPv4 DAD is enabled and the address is being probed.

If we configure the endpoint without the address set, the kernel will
try to use the endpoint immediately but it will fail. Then, the
endpoint will not be used ever again after the address is added.

(cherry picked from commit 6bf859af79)
2025-02-24 09:07:54 +01:00
Beniamino Galvani
a301c259f2 core: split nm_netns_watcher_remove_all()
The name suggests that the function always removes all the watchers
with the given tag; instead it removes only "dirty" ones when the
"all" parameter is FALSE. Split the function in two variants.

(cherry picked from commit b6e67c6abc)
2025-02-24 09:07:53 +01:00
Tomas Korbar
39b7a8df91 dns: fix Dnsconfd autostart
When Dnsconfd service is enabled but not started, NetworkManager
should attempt to start it through DBus at least once.

Fixes: c6e1925dec ('dns: Add dnsconfd DNS plugin')
(cherry picked from commit 1463b1c0a3)
2025-02-20 19:02:25 +01:00
Fernando Fernandez Mancera
b8ef2a551e core: prevent the activation of unavailable OVS interfaces only
Preventing the activation of unavailable devices for all device types is
too aggresive and leads to race conditions, e.g when a non-virtual bond
port gets a carrier, preventing the device to be a good candidate for
the connection.

Instead, enforce this check only on OVS interfaces as NetworkManager
just makes sure that ovsdb->ready is set to TRUE.

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

Fixes: 774badb151 ('core: prevent the activation of unavailable devices')
(cherry picked from commit a1c05d2ce6)
2025-02-18 12:29:19 +01:00
Jan Vaclav
8e78a8c28f nmtui/ipv6: add "shared" method to ipv6 options
It was previously only available for IPv4, and the option
was missing from the IPv6 methods.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2138
(cherry picked from commit e983e8a46f)
2025-02-18 12:11:28 +01:00
Fernando Fernandez Mancera
2daeef668d policy: always reset retries when unblocking children or ports
When calling activate_port_or_children_connections() we are unblocking
the ports and children but we are not resetting the number of retries if
it is an internal activation.

This is wrong as even if it's an internal activation the number of
retries should be reset. It won't interferfe with other blocking reasons
like USER_REQUESTED or MISSING_SECRETS.

(cherry picked from commit 7acc66699a)
2025-02-13 12:03:05 +01:00
Beniamino Galvani
d29d591d06 merge: branch 'bg/dnsconfd-fix-pending'
Some fixes for the dnsconfd plugin

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

(cherry picked from commit 006a3fb51a)
2025-02-13 10:38:35 +01:00
Beniamino Galvani
5e18da31a4 dnsconfd: drop "connection-*" entries from the update method
Stop passing "connection-*" entries in the update method to
dnsconfd. The plugin tries to determine the connection from the
ifindex, but it's not possible to do it right at the moment because
the same ifindex can be used at the same time e.g. by a policy-based
VPN like ipsec and a normal device. Instead, it should be NM that
explicitly passes the information about the connection to the DNS
plugin. Anyway, these variables are not used at the moment by
dnsconfd.

Fixes: c6e1925dec ('dns: Add dnsconfd DNS plugin')
(cherry picked from commit 4d84e6cddf)
2025-02-13 10:38:34 +01:00
Beniamino Galvani
e20794989b dnsconfd: set the state to idle when connection fails
If the plugin can't connect to D-Bus, it is not waiting for an update;
set the state to idle.

(cherry picked from commit 2bfd27f74d)
2025-02-13 10:38:34 +01:00
Beniamino Galvani
dc0ff10efb dnsconfd: fix handling of the update-pending flag
After every state change of the plugin there should be an invocation
of _nm_dns_plugin_update_pending_maybe_changed() to re-evaluate
whether we are waiting for an update. send_dnsconfd_update() doesn't
change the state and so there is need to check again afterwards.

(cherry picked from commit 8ff1cbf38b)
2025-02-13 10:38:34 +01:00