Commit graph

33393 commits

Author SHA1 Message Date
Fernando Fernandez Mancera
67e71a9d7f 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)
(cherry picked from commit b8ef2a551e)
(cherry picked from commit 8b39a79621)
2025-02-18 12:32:15 +01:00
Jan Vaclav
33784b8dcc 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)
(cherry picked from commit 8e78a8c28f)
(cherry picked from commit 85ed0c0115)
2025-02-18 12:15:00 +01:00
Fernando Fernandez Mancera
b870c94a4c 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)
(cherry picked from commit 2daeef668d)
(cherry picked from commit 52ed8567e2)
2025-02-13 12:12:50 +01:00
Beniamino Galvani
3aa6c46029 merge: branch 'bg/autoconnect-ports-ovs'
Fix autoconnect-ports for OVS interfaces

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

(cherry picked from commit fbd87bf961)

(cherry picked from commit 00ca2d7fe9)
2025-02-12 16:53:51 +01:00
Beniamino Galvani
b495d6bd55 core: prevent the activation of unavailable devices
When autoconnecting ports of a controller, we look for all candidate
(device,connection) tuples through the following call trace:

 -> autoconnect_ports()
   -> find_ports()
     -> nm_manager_get_best_device_for_connection()
       -> nm_device_check_connection_available()
         -> _nm_device_check_connection_available()

The last function checks that a specific device is available to be
activated with the given connection. For virtual devices, it only
checks that the device is compatible with the connection based on the
device type and characteristics, without considering any live network
information.

For OVS interfaces, this doesn't work as expected. During startup, NM
performs a cleanup of the ovsdb to remove entries that were previously
added by NM. When the cleanup is terminated, NMOvsdb sets the "ready"
flag and is ready to start the activation of new OVS interfaces. With
the current mechanism, it is possible that a OVS-interface connection
gets activated via the autoconnect-ports mechanism without checking
the "ready" flag.

Fix that by also checking that the device is available for activation.

(cherry picked from commit 774badb151)
(cherry picked from commit f459c7fecc)
2025-02-12 16:53:51 +01:00
Beniamino Galvani
0045a0240c core: cleanup nm_manager_get_best_device_for_connection()
Rename "unavailable_devices" to "exclude_devices", as the
"unavailable" term has a specific, different meaning in NetworkManager
(i.e. the device is in the UNAVAILABLE state). Also, use
nm_g_hash_table_contains() when needed.

(cherry picked from commit 6c1eb99d32)
(cherry picked from commit da866c4cda)
2025-02-12 16:53:51 +01:00
Jan Vaclav
14e70c20a0 NEWS: update 2025-02-10 13:03:14 +01:00
Íñigo Huguet
decc7788fb po: add nmtui/nmt-page-veth.c to POTFILES.in
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943

Fixes: 187ff4c73b ('nmtui: add veth page')
Reported-by: Piotr Drąg
(cherry picked from commit 01bee5a6ad)
2025-02-10 13:03:14 +01:00
Jan Vaclav
1efa6e5abc merge: branch 'jv/nmtui-veth'
nmtui: add veth page
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943

(cherry picked from commit 7be55d6eff)
2025-02-10 12:29:46 +01:00
Jan Vaclav
485df28273 nmtui: include veth devices in activation dialog
(cherry picked from commit e74f506b81)
2025-02-10 12:27:36 +01:00
Jan Vaclav
e87f1de930 nmtui: add veth page
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943
(cherry picked from commit 187ff4c73b)
2025-02-10 12:27:28 +01:00
Beniamino Galvani
678f2a64f4 release: bump version to 1.48.17 (development) 2025-01-21 10:52:29 +01:00
Beniamino Galvani
c7927af3e4 release: bump version to 1.48.16 2025-01-21 10:52:29 +01:00
Beniamino Galvani
e6e7340a54 NEWS: update 2025-01-21 10:38:25 +01:00
Jan Vaclav
b07f4a058c merge: branch 'jv/fix-qos-mapping'
platform/vlan: fix incorrect type for ingress/egress qos mappings

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

(cherry picked from commit 191aaf0fb2)

(cherry picked from commit f1fc7bd218)
2025-01-21 10:37:35 +01:00
Jan Vaclav
779fd8deae platform/test: reenable xgress qos tests
Fixes: 6e30e37ebe ('test: disable vlan_xgress unit test')
(cherry picked from commit 4107a6883f)
(cherry picked from commit 0eb1781b6c)
2025-01-21 10:37:34 +01:00
Jan Vaclav
6dad779be1 platform/vlan: fix incorrect type for ingress/egress qos mappings
The kernel was updated to add stricter validation to netlink messages,
which revealed this bug:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6c21660fe221a15c789dee2bc2fd95516bc5aeaf

Fixes: a5ea141956 ('platform/vlan: add support for ingress/egress-qos-mappings and changing flags')
(cherry picked from commit 84bcc0eab9)
(cherry picked from commit c8943b758d)
2025-01-21 10:37:34 +01:00
eaglegai
26cc879508 mptcp: fix error handling rp_filter when kernel don't support mptcp
When the kernel don't support mptcp, NetworkManager should disable mptcp
and shouldn't change rp_filter from 1 to 2. However, when checking file
/proc/sys/net/mptcp/enabled, val v's type is defined to guint32, and
nm_platform_sysctl_get_int32 return -1, v becomes a very large number
and can't set mptcp_flags to NM_MPTCP_FLAGS_DISABLED.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1686
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2093

Fixes: c00873e08f ('mptcp: rework "connection.mptcp-flags" for enabling MPTCP')
(cherry picked from commit 9c42177d09)
(cherry picked from commit 50fc3c70af)
2025-01-21 10:37:26 +01:00
Beniamino Galvani
c00240e521 NEWS: update 2025-01-21 09:44:28 +01:00
Íñigo Huguet
f43af853e6 ci: make check-tree optional for branches other than main
Old branches tend to be formatted with a different versions of
clang-format, so when patches are backported, they introduce some
differences in formatting, making the check-tree job to fail.

These changes in formatting are normally small, and we don't pay much
attention to them, causing that the pipelines are always red, increasing
the work required to check if there are important failures or not.

Make check-tree optional for branches other than main. This way,
failures will be shown as a "warning", and if a pipeline only shows a
warning we don't need to inspect it.

(cherry picked from commit 9e47c9bc6a)
(cherry picked from commit b497ce4372)
2025-01-17 12:25:31 +01:00
Wen Liang
a402c3517e merge: branch 'wl/nm-1-48-vpn-backport'
vpn: fix routing rules and custom routing table support in vpn conenctions

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2098
2025-01-07 14:38:12 +00:00
Wen Liang
b5c46f8a8d vpn: fix routing rules support in vpn conenctions
This commit introduces the ability to manage routing rules specifically
for VPN connections. These rules allow finer control over traffic
routing by enabling the specification of policy-based routing for
traffic over the VPN.

- Updated the connection backend to apply rules during VPN activation.
- Ensured proper cleanup of routing rules upon VPN deactivation.

This enhancement improves VPN usability in scenarios requiring advanced
routing configurations, such as split tunneling and traffic
prioritization.

Resolves: https://issues.redhat.com/browse/RHEL-70160
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2092
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1842
(cherry picked from commit 308e34a501)
(cherry picked from commit a24b347e93)
2025-01-07 09:30:43 -05:00
Gris Ge
0dc07c5ca4 vpn: Place gateway route to table defined in ipvx.route-table
Previously, NM create direct route to gateway to main(254) route table
regardless `ipvx.route-table` value.

Fixed by setting `NMPlatformIP4Route.table_any` to `TRUE`.

Resolves: https://issues.redhat.com/browse/RHEL-69901

Signed-off-by: Gris Ge <fge@redhat.com>
(cherry picked from commit 6d06286f1d)
(cherry picked from commit 29f23d3519)
2025-01-06 23:17:28 -05:00
Íñigo Huguet
c7328e5aa4 ci: update distro versions 2024-12-24 15:04:30 +01:00
Íñigo Huguet
fe5a09b1ad ci: Update ci-templates to a version that support Alpine versions
ci-templates only supported alpine:latest, but support for any other
version has been introduced. Use it so our Alpine pipelines stop
failing.

(cherry picked from commit 9354fabaa8)
(cherry picked from commit 2035048449)
2024-12-24 15:02:59 +01:00
Íñigo Huguet
fc238062bd CI: add testlog.txt as build artifacts
That way we will be able to check the logs in the case of failure.

(cherry picked from commit 0d4c8a235a)
(cherry picked from commit b6e2533f82)
2024-12-24 15:02:26 +01:00
Beniamino Galvani
5db6475087 core: increase timeout for test_nm_utils_kill_child()
The test starts a watchdog process that eventually kills the process
group after a certain time. When running under valgrind concurrently
to other tests the current timeout is not enough; increase it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2067
(cherry picked from commit 23ffa5fc6e)
(cherry picked from commit e17f1b93ec)
2024-12-24 13:05:35 +01:00
Íñigo Huguet
4448c91dba release: bump version to 1.48.15 (development) 2024-12-23 16:06:00 +01:00
Íñigo Huguet
749264f122 release: bump version to 1.48.14 2024-12-23 16:06:00 +01:00
Íñigo Huguet
953657ed61 NEWS: update for 1.48.14 2024-12-23 13:09:51 +01:00
Beniamino Galvani
4a1b44646a ndisc: fix code format
Fixes: d775c3d256 ('ndisc: honor default route parameters from RA route options')
(cherry picked from commit 7185b0eebf)
2024-12-23 13:04:48 +01:00
Fernando Fernandez Mancera
35d326324b bonding: steer IGMP queries to the active bond balance-slb primary port
Add chains and rules to steer the IGMP reports to the primary member
port. This rules are adapted from the script provided by Eric Garver.

https://gitlab.com/egarver/virtual-networking/-/blob/master/mlag.sh

Fixes: e9268e3924 ('firewall: add mlag firewall utils for multi chassis link aggregation (MLAG) for bonding-slb')
(cherry picked from commit c691dd7ecf)
(cherry picked from commit b9a733d00b)
2024-12-23 13:03:56 +01:00
Beniamino Galvani
0f9d0cd6a3 ndisc: honor default route parameters from RA route options
RFC 4191 section-3.1 says:

  When processing a Router Advertisement, a type C host first updates a
  ::/0 route based on the Router Lifetime and Default Router Preference
  in the Router Advertisement message header. [...] The Router Preference
  and Lifetime values in a ::/0 Route Information Option override the
  preference and lifetime values in the Router Advertisement header.

Fix the RA parsing so that the parameters from a default route option
are applied to the gateway.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1666
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2072

Fixes: c3a4656a68 ('rdisc: libndp implementation')
(cherry picked from commit 6c18fda519)
(cherry picked from commit d775c3d256)
2024-12-23 13:03:56 +01:00
Beniamino Galvani
23143c5e3e core: fix deleting internal global DNS configuration
The tracking of variable "has_intern" in intern_config_read() is
wrong: we set it when adding any entry to the keyfile, but then we
remove the global DNS section without updating the variable.

The effect is that the function might return an empty keyfile instead
of NULL.

Fix this by moving the check on global DNS above.

Fixes: 55c204b9a3 ('core: add support for reading global DNS configuration from keyfile')
(cherry picked from commit 07113dde30)
(cherry picked from commit 0a1b642a2d)
2024-12-23 13:03:56 +01:00
Valentin Blot
60996ccb2c wwan: remove buggy assertion
Removed an assertion that was not satisfied in the legitimate case of
IPv4 + do_auto.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2061
(cherry picked from commit 4082e7e109)
(cherry picked from commit 9cb6424a18)
2024-12-23 13:03:56 +01:00
Beniamino Galvani
95ef14b44e platform: fix to_string() functions for IPv6 tunnels
We can hit an assertion at trace log level when printing IPv6 tunnel
links, because the buffer for the local and remote addresses is not
big enough. Increase the buffer size.

Fixes: 32f6e1ef2e ('platform: add IP6TNL links support')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2063
(cherry picked from commit eb620e0e7e)
(cherry picked from commit fc09f55ef5)
2024-12-23 13:03:56 +01:00
Beniamino Galvani
f408cd7d4b nmcli: fix handling of connection.down-on-poweroff property
Fix the following error:

  $ nmcli connection modify C connection.down-on-poweroff yes
  **
  nm:ERROR:../src/libnmc-setting/nm-meta-setting-desc.c:1367:_set_fcn_gobject_ternary: assertion failed: (_gobject_property_get_gtype(G_OBJECT(setting), property_info->property_name) == NM_TYPE_TERNARY)
  Bail out! nm:ERROR:../src/libnmc-setting/nm-meta-setting-desc.c:1367:_set_fcn_gobject_ternary: assertion failed: (_gobject_property_get_gtype(G_OBJECT(setting), property_info->property_name) == NM_TYPE_TERNARY)

Fixes: bd38a19832 ('connection: add support to down-on-poweroff')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2055
(cherry picked from commit 4af6cf592a)
(cherry picked from commit f7415f1275)
2024-12-23 13:03:56 +01:00
Beniamino Galvani
f022315bcc merge: branch 'ih/rt-leftover'
l3cfg: remove routes added by NM on reapply

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2080
(cherry picked from commit 3bcbe6ed01)

(cherry picked from commit 57fc796950)
2024-12-23 13:03:03 +01:00
Íñigo Huguet
75e1d49edf l3cfg: get routes to prune from the list of routes configured by NM
We always sync routes in the main table, but routes in tables other
than main are only pruned if were added by NM, by default. Get the list
of routes to prune from other tables using obj_state->os_nm_configured,
as this tracks what routes were effectively added by NM.

The list should be the same that the one obtained from l3cfg_old. It
could be different if we commited the l3cfg with an NMIPRouteTableSyncMode
of NM_IP_ROUTE_TABLE_SYNC_MODE_MAIN, thus not deleting some routes at
commit time. However, since the previous commit, we never do it.

What all this shows is that starting to use different NMIPRouteTableSyncModes
is probably a bad idea: it will be a source of bugs of routes not being
always synced as users expect, and the use case for them is still to be
known.

(cherry picked from commit c06d130c38)
(cherry picked from commit f59a26b1b1)
2024-12-23 13:03:03 +01:00
Íñigo Huguet
95064b8025 l3cfg: remove routes added by NM on reapply
By default, on reapply we were only syncing the main routes table. This
causes that routes added by NM to other tables are not removed on
reapply. This was done to preserve routes added externally, but routes
added by NM itself should be removed.

Add a new route table syncing mode "main + NM routes". This mode
maintains the normal behaviour of syncing completely the main table,
and for other tables removes only routes that were added by us, leaving
the rest untouched. Use this mode by default, as this is what a user
would expect on reapply.

Note: this might not work if NM is restarted between the profile being
modified and the reapply, because NM forgets what routes were added by
itself because of the restart. This is a rare corner case, though.

Use the D-Bus property "VersionInfo" to expose a capability flag
indicating that this bug is fixed. It is the first capability that we
expose in this way. However, it is convenient to do it this way as it's
something that clients like nmstate needs to know, so they can decide
whether a conn down is needed or not. It is not enough to decide that by
version number because it might be fixed via a downstream patch in distros
like RHEL.

https://issues.redhat.com/browse/RHEL-67324
https://issues.redhat.com/browse/RHEL-66262

Fixes: e9c17fcc9b ('l3cfg: default to 'main' route table sync mode')
(cherry picked from commit e330eb9c4a)
(cherry picked from commit 7f6e84b26e)
2024-12-23 13:03:03 +01:00
Íñigo Huguet
c537e9b750 platform: rename NM_IP_ROUTE_TABLE_SYNC_MODE_FULL -> ALL_EXCEPT_LOCAL
The difference between FULL and ALL was not obvious without reading the
documentation. Moreover, a new mode is going to be introduced so the
confusion could grow. Rename to a more explicit name.

(cherry picked from commit e1840ad5fb)
(cherry picked from commit 9682c81ea6)
2024-12-23 13:03:03 +01:00
Íñigo Huguet
e6a29232bc libnmc: fix bug checking VersionInfo's capabilities
Remove the `+ 31u` that was making that it would search for bit 1 at
array's element 1, instead of element 0. Fixed comparison >len that
shoudl be >=len. Fix a few typos.

Fixes: bc6098d441 ('libnm: add internal nmc_client_has_{version_info_v,version_info_capability,capability}() helper')
(cherry picked from commit 5a65170b49)
(cherry picked from commit a53349fa9c)
2024-12-23 13:03:03 +01:00
Fernando Fernandez Mancera
f8afa8d6d0 merge: branch 'ff/garp_bond_slb'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2057

(cherry picked from commit 460f0b4bc9)

(cherry picked from commit 725435f1e4)
2024-12-23 13:02:56 +01:00
Fernando Fernandez Mancera
8f9b2f22bb bonding: send ARP announcement on bonding-slb link/carrier down
When a bond in balance-slb is created, the ports are enabled or disabled
based on carrier and link state. If the link/carrier goes down, the port
becomes disabled and we must make sure the MAC tables of the switches
are updated properly so the traffic is redirected.

In order to solve this, we send a GARP or RARP broadcast packet on the
bond. This fix cover 3 different balance-slb scenarios.

Scenario 1: The bond in balance-slb mode has IPv4 address configured and
some ports connected. Here the bond is acting like active-backup as the
packets will always have as source MAC the address of the bond
interface. When a port goes down, NetworkManager will send a GARP
broadcast announcing the address configured on the bond with the MAC
address configured on the port.

Scenario 2: The bond in balance-slb mode is connected to a bridge and has
some ports connected. The bridge has IPv4 configured. When a port goes
down, NetworkManager will send a GARP broadcast announcing the address
configured on the bridge with the MAC address configured on the port.

Scenario 3: The bond in balance-slb mode is connected to a bridge and
has some ports connected. The bridge does not have IP configuration and
therefore everything is L2. When a port goes down, NetworkManager will
query the FDB table and filter the entries by the ones belonging to the
bridge and the bond ifindexes. Then, it will send a RARP broadcast
announcing every learned MAC address from FDB.

Fixes: e9268e3924 ('firewall: add mlag firewall utils for multi chassis link aggregation (MLAG) for bonding-slb')
(cherry picked from commit 3f2f922dd9)
(cherry picked from commit e9e1768c37)
2024-12-23 13:02:56 +01:00
Fernando Fernandez Mancera
ba3cff0ffd linux-platform: add helper function to query FDB table
The function introduced queries the FDB table via netlink socket. It
accepts a list of ifindexes to filter out the FDB content not related to
it. It returns an array of MAC addresses.

To cltarify this function is unusually exposed directly on
nm-linux-platform.h as we don't want this be part of the whole
NMPlatform object or cache. This, is an exception to the rule to
simplify the integration of this functionality on NetworkManager.

In addition, it also doesn't use the async mechanism that is widely used
on netlink communication across nm-linux-platform. Again, the reason is
to simplify its use, as async communication won't provide a benefit to
the use cases we have planned for this, i.e balance-slb RARP announcing.

(cherry picked from commit 00f47efcb2)
(cherry picked from commit 8af7493627)
2024-12-23 13:02:56 +01:00
Fernando Fernandez Mancera
73aa5b47fa glib-aux: add nm_ether_addr_hash() helper
Add a hash generation helper for NMEtherAddr struct. This can be used
for HashTables containing pointers to NMEtherAddr structs.

(cherry picked from commit a63eec924c)
(cherry picked from commit 6371802087)
2024-12-23 13:02:56 +01:00
Fernando Fernandez Mancera
e24a6088c7 l3cfg: add helper function to fetch all the IPv4 configured addresses
This function would be useful when performing operations related to the
IPv4 addresses configured on the l3cfg. E.g this function will be used
for getting the IPv4 to announce on a GARP on bonding-slb when one of
the ports failover.

(cherry picked from commit 69f3493670)
(cherry picked from commit bfe2047acc)
2024-12-23 13:02:56 +01:00
Íñigo Huguet
365806aa3c release, find-backports: formatting and log small fixes
(cherry picked from commit 0180efed51)
2024-12-23 12:59:54 +01:00
Íñigo Huguet
0074fc4647 find-backports: fix Ignore-Fixes detection
The regex for "Fixes" also matches with "Ignore-Fixes", so the commit is
added twice and then removed only once by the "Ignore-Fixes". It still
remains once in the list of commits to backport, making that
"Ignore-Fixes" does not work. Fix it.
2024-12-23 12:59:54 +01:00
Íñigo Huguet
c5e51bd5d8 release.sh: check the right pipelines
Now we are using scheduled pipelines for various purposes like
regenerating the container images and triage the issues and MRs. That
means that the last pipeline ran for main might not be the pipeline with
the jobs building and testing the code.

Use `source=push` to retrieve only pipelines that are not scheduled.
2024-12-23 12:59:53 +01:00