Commit graph

33813 commits

Author SHA1 Message Date
Íñigo Huguet
a1e1dd2978 n-dhcp4: fix resource leaks
The function n_dhcp4_c_connection_send_request does not release or take
ownership of its request argument. Because of that, setting it to NULL
in the caller prevents the auto-cleanup of the variable to be executed,
causing a resource leak. Fix it.

Fixes: e23b3c9c3a ('Squashed 'shared/n-dhcp4/' content from commit fb1d43449')
Fixes: 243cc433fb ('n-dhcp4: add new client probe function to send RELEASE message')
(cherry picked from commit 9edfc0438c)
2025-06-27 10:25:51 +02:00
Íñigo Huguet
d19068c9e3 core: fix use after free in ping operations
Detected by coverity, the ping_op pointers are used after being freed in
cleanup_ping_operations. Although calling to g_list_remove is probably
safe because it only needs the value of the pointer, not to dereference
it, better to follow best practices. One of the use after free was
actually an error because we dereference ping_op->log_domain.

Fixes: 658aef0fa1 ('connection: Support connection.ip-ping-addresses')
(cherry picked from commit ae7de5b353)
2025-06-27 10:25:51 +02:00
Íñigo Huguet
ca39902cee bond-slb: initialize dest hw address in GARP packets
Detected by Coverity:
    1. NetworkManager-1.53.1/src/core/nm-bond-manager.c:885:5: var_decl: Declaring variable "data" without initializer.
    7. NetworkManager-1.53.1/src/core/nm-bond-manager.c:948:13: uninit_use_in_call: Using uninitialized value "data". Field "data.d_hw_addr" is uninitialized when calling "sendto".
       946|               unaligned_write_ne32(data.s_ip_addr, tmp_addr);
       947|               unaligned_write_ne32(data.d_ip_addr, tmp_addr);
       948|->             if (sendto(sockfd, &data, sizeof(data), 0, (struct sockaddr *) &addr, sizeof(addr)) < 0)
       949|                   return FALSE;
       950|           }

Fixes: 3f2f922dd9 ('bonding: send ARP announcement on bonding-slb link/carrier down')
(cherry picked from commit 42edb37499)
2025-06-27 10:25:51 +02:00
Beniamino Galvani
e766920e0b vpn: fix logging message
Fixes: c4a7d6a06f ('vpn: honor the ipvX.method connection property')
(cherry picked from commit ecce8fa461)
2025-06-27 10:25:21 +02:00
Beniamino Galvani
9e640cb751 release: fix validation of gitlab token
If the token is wrong or expired, the command still returns
success. Check the content of the reply instead.

Fixes: f05192ada8 ('release.sh: release to freedesktop.org, not to GNOME')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2148
(cherry picked from commit 481afec6ea)
2025-06-27 10:24:25 +02:00
Beniamino Galvani
75bb71fddf libnm: fix GObject introspection annotations for NMSecretAgentOld
Add some missing "(nullable)" annotations to parameters of the
callback functions in NMSecretAgentOld. Otherwise, PyGObject complains
that those parameters cannot be NULL when implementing a secret agent.

Fixes: d595f7843e ('libnm: add libnm/libnm-core (part 1)')
(cherry picked from commit c01168f4f9)
2025-06-27 10:24:13 +02:00
Íñigo Huguet
c3ed106d63 libnm: macvlan: specify that promiscuous affects to the parent
Fixes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1732
Fixes: 4d0192e661 ('libnm-core: add NMSettingMacvlan')
(cherry picked from commit 1fdcfb7abe)
2025-06-27 10:23:59 +02:00
Beniamino Galvani
9c74fa8e36 device: remove the prefix-delegation IP configuration on cleanup
When a device in IPv6 shared mode obtains a prefix, it adds a new l3cd
of type L3_CONFIG_DATA_TYPE_PD_6 for that prefix. However, that l3cd
is never removed later and so the address lingers on the interface
even after the connection goes down. Remove the l3cd on cleanup.

(cherry picked from commit 4a8bedcd89)
2025-06-27 10:04:39 +02:00
Wen Liang
2fe69da6fd merge: branch 'wl/nm-1-52'
core: ovs: fix NULL pointer dereference in ovsdb read timeout callback

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2204
2025-05-14 17:18:35 +00:00
Íñigo Huguet
9ec498f321 core: ovs: fix NULL pointer dereference in ovsdb read timeout callback
Fixes: f7d321c6d6 ('ovsdb: add watchdog for unparsable JSON data in socket')
(cherry picked from commit dc9bf255ee)
2025-05-14 07:59:44 -04:00
Jan Vaclav
15a68c6a9b merge: branch 'jv/wg-nftables'
wireguard: add connmark and filtering firewall rules

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

(cherry picked from commit 5e17b52810)
2025-05-12 13:38:38 +02:00
Jan Vaclav
ae420a8dd6 firewall/utils: replace ipv4 iptables macro with ipxtables macro
(cherry picked from commit 2106251e46)
2025-05-12 13:38:38 +02:00
Jan Vaclav
3f2c0869dc firewall/utils: remove _share prefix from iptables_get_name
It's no longer used just for shared mode.

(cherry picked from commit 18d5b7d641)
2025-05-12 13:38:38 +02:00
Jan Vaclav
4d0223f8a4 firewall/wireguard: drop packets received to wrong interface
If we receive a packet sent to the WG interface's address,
but it does not come from the WG tunnel, let's assume something
is broken and drop the packet.

This is also inspired by wg-quick firewall rules:
https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/linux.bash?id=17c78d31c27a3c311a2ff42a881057753c6ef2a4#n221

(cherry picked from commit a769c17af7)
2025-05-12 13:38:38 +02:00
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