Commit graph

33112 commits

Author SHA1 Message Date
Jan Vaclav
9910c8a563 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)

(cherry picked from commit b07f4a058c)
2025-01-21 10:58:12 +01:00
Jan Vaclav
5d7173a5ea platform/test: reenable xgress qos tests
Fixes: 6e30e37ebe ('test: disable vlan_xgress unit test')
(cherry picked from commit 4107a6883f)
(cherry picked from commit 0eb1781b6c)
(cherry picked from commit 779fd8deae)
2025-01-21 10:58:11 +01:00
Jan Vaclav
e6dc4332f3 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)
(cherry picked from commit 6dad779be1)
2025-01-21 10:58:11 +01:00
eaglegai
769ecffad0 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)
(cherry picked from commit 26cc879508)
2025-01-21 10:58:04 +01:00
Beniamino Galvani
a839209859 NEWS: update 2025-01-21 09:55:41 +01:00
Íñigo Huguet
a85941660a 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)
(cherry picked from commit f43af853e6)
2025-01-17 12:26:49 +01:00
Beniamino Galvani
eae3de9c96 bridge: reapply port VLANs only when necessary
Don't touch the bridge VLANs if they are already set.

(cherry picked from commit 447e50d74e)
(cherry picked from commit 92b366545b)
2025-01-14 09:18:09 +01:00
Beniamino Galvani
85fbbe8b7e platform: add nmp_utils_bridge_normalized_vlans_equal()
Add a function to compare two arrays of NMPlatformBridgeVlan. It will
be used in the next commit to compare the VLANs from platform to the
ones we want to set.

To compare in a performant way, the vlans need to be normalized (no
duplicated VLANS, ranges into their minimal expression...). Add the
function nmp_utils_bridge_vlan_normalize.

Co-authored-by: Íñigo Huguet <ihuguet@redhat.com>
(cherry picked from commit 1c43fe5235)
(cherry picked from commit 5b79bb2feb)
2025-01-14 09:18:09 +01:00
Beniamino Galvani
ad60460e71 platform: support reading bridge VLANs
Add a function to read the list of bridge VLANs on an interface.

(cherry picked from commit 7ae4660a77)
(cherry picked from commit dfaadf3d3e)
2025-01-14 09:18:09 +01:00
Beniamino Galvani
f93c008904 device: support reapplying bridge-port VLANs
For now, always reapply the VLANs unconditionally, even if they didn't
change in kernel.

To set again the VLANs on the port we need to clear all the existing
one before. However, this deletes also the VLAN for the default-pvid
on the bridge. Therefore, we need some additional logic to inject the
default-pvid in the list of VLANs.

Co-authored-by: Íñigo Huguet <ihuguet@redhat.com>
(cherry picked from commit c5d1e35f99)
(cherry picked from commit cb5e3ceea7)
2025-01-14 09:18:03 +01:00
Beniamino Galvani
23ef171a7d bridge: change the signature for nm_platform_link_set_bridge_vlans()
Currently, nm_platform_link_set_bridge_vlans() accepts an array of
pointers to vlan objects; to avoid multiple allocations,
setting_vlans_to_platform() creates the array by piggybacking the
actual data after the pointers array.

In the next commits, the array will need to be manipulated and
extended, which is difficult with the current structure. Instead, pass
separately an array of objects and its size.

(cherry picked from commit e00c81b153)
(cherry picked from commit e41844467f)
2025-01-14 09:18:02 +01:00
Wen Liang
7824d5e5ae 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)
(cherry picked from commit b5c46f8a8d)
2025-01-07 09:42:41 -05:00
Gris Ge
6a04a966c2 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)
(cherry picked from commit 0dc07c5ca4)
2025-01-07 09:42:32 -05:00
Íñigo Huguet
1cd59aa431 ci: update distro versions 2024-12-24 16:40:21 +01:00
Íñigo Huguet
3d80f73b3c 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)
(cherry picked from commit fe5a09b1ad)
2024-12-24 16:39:02 +01:00
Íñigo Huguet
e8532d4a41 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)
(cherry picked from commit fc238062bd)
2024-12-24 16:37:54 +01:00
Íñigo Huguet
1c88e026f9 release: bump version to 1.46.5 (development) 2024-12-24 15:47:50 +01:00
Íñigo Huguet
a1b967ee1a release: bump version to 1.46.4 2024-12-24 15:47:50 +01:00
Íñigo Huguet
501cc1e02b release.sh: compare file with nm-1-46
In nm-1-48 it has differences because the build is done with meson and
not with autotools.
2024-12-24 15:15:18 +01:00
Fernando Fernandez Mancera
ea4a976cd1 hsr: fix initialization of port1 and port2 DBus Object property
This was causing test_nml_dbus_meta() unit test to fail and also it was
affecting the notification when the object changed.

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
(cherry picked from commit 1e70f24378)
(cherry picked from commit 622f188621)
(cherry picked from commit 8bedd0934f)
2024-12-24 13:22:47 +01:00
Beniamino Galvani
81ccac1980 ndisc: fix code format
Fixes: d775c3d256 ('ndisc: honor default route parameters from RA route options')
(cherry picked from commit 7185b0eebf)
(cherry picked from commit 4a1b44646a)
2024-12-24 13:22:17 +01:00
Beniamino Galvani
25a8ed7772 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)
(cherry picked from commit 5db6475087)
2024-12-24 13:06:01 +01:00
Íñigo Huguet
47177e65d1 NEWS: update for 1.46.4 2024-12-23 15:45:34 +01:00
Fernando Fernandez Mancera
94035d5473 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)
(cherry picked from commit 35d326324b)
2024-12-23 15:45:33 +01:00
Beniamino Galvani
364e6e199c 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)
(cherry picked from commit 0f9d0cd6a3)
2024-12-23 15:45:32 +01:00
Beniamino Galvani
f3006bf894 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)
(cherry picked from commit 23143c5e3e)
2024-12-23 15:45:32 +01:00
Valentin Blot
37c1f3f367 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)
(cherry picked from commit 60996ccb2c)
2024-12-23 15:45:31 +01:00
Beniamino Galvani
0e20b52449 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)
(cherry picked from commit 95ef14b44e)
2024-12-23 15:45:30 +01:00
Íñigo Huguet
a9b7a8d88e 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)
(cherry picked from commit 75e1d49edf)
2024-12-23 15:45:29 +01:00
Íñigo Huguet
3157504062 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)
(cherry picked from commit 95064b8025)
2024-12-23 15:45:29 +01:00
Íñigo Huguet
4c5b9fef5e 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)
(cherry picked from commit c537e9b750)
2024-12-23 15:45:28 +01:00
Íñigo Huguet
bb018b72f0 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)
(cherry picked from commit e6a29232bc)
2024-12-23 15:45:28 +01:00
Fernando Fernandez Mancera
d5e832a3b5 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)
(cherry picked from commit 8f9b2f22bb)
2024-12-23 15:45:23 +01:00
Fernando Fernandez Mancera
1fa281351c 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)
(cherry picked from commit ba3cff0ffd)
2024-12-23 14:08:11 +01:00
Fernando Fernandez Mancera
7003adb1ef 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)
(cherry picked from commit 73aa5b47fa)
2024-12-23 14:08:11 +01:00
Fernando Fernandez Mancera
931caf236c 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)
(cherry picked from commit e24a6088c7)
2024-12-23 14:08:10 +01:00
Fernando Fernandez Mancera
e994287959 hsr: add hsr setting to docs generate script
The setting was missing from the script. The patch is adding it and also
regenerates the docs.

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
(cherry picked from commit a0696e27b8)
(cherry picked from commit f38dcdf57b)
(cherry picked from commit db895f4f17)
2024-12-23 14:06:56 +01:00
Fernando Fernandez Mancera
93b347bcf2 hsr: use HSR DBus metadata properly
The HSR DBus metadata was defined properly but not exported on the libnm
library properly. This was causing that clients were not showing the HSR
devices.

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
(cherry picked from commit 5e4696a693)
(cherry picked from commit 19929fdc9a)
(cherry picked from commit 029253e2f0)
2024-12-23 14:06:55 +01:00
Fernando Fernandez Mancera
88470dc73f introspection: fix indentation for HSR device introspection
The file was mixing spaces and tabs. It should only use spaces.

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
(cherry picked from commit 4ff3bd3eb5)
(cherry picked from commit bba6cc31a4)
(cherry picked from commit f5bae36ef5)
2024-12-23 14:06:55 +01:00
Beniamino Galvani
ac689ddd86 l3cfg: ensure the probing timeout is initialized on probe start
When handling event TIMEOUT, "acd_data->probing_timeout_msec" needs to
be always initialized before jumping to "handle_start_probing:";
otherwise, an assertion failure is triggered at:

  static void
  _l3_acd_data_timeout_schedule_probing_restart(AcdData *acd_data, gint64 now_msec)
  {
    ...
    nm_assert(acd_data->probing_timeout_msec > 0);

Even if the ACD data is already in state PROBE, that doesn't mean that
the timeout is already initialized because the PROBE state can also be
reached from a INSTANCE_RESET event; and depending on the previous
state "acd_data->probing_timeout_msec" could be uninitialized.

Fixes-test: @iptunnel_restart
Fixes: b8f9d7b5dd ('l3cfg: rework ACD handling in NML3Cfg to support handling conflicts')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2023
(cherry picked from commit a09f9cc616)
(cherry picked from commit 4dde5aa787)
(cherry picked from commit 67b2a5f624)
2024-12-23 13:57:22 +01:00
Jan Vaclav
8d8eaca0d0 nmtui: correctly check that connection list is non-empty
Previously, the "edit" or "delete" buttons were clickable even
if there were no available connections, which was not expected
and caused an assertion to fail when clicked. This is because
the connections list could contain connections that were later
filtered out and not displayed in the final list, but the check
did not take this into account.

Make it so that the buttons are clickable only if we *actually*
have any available connections to edit or delete.

Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1991
(cherry picked from commit c9fefcd095)
(cherry picked from commit f6e4d1b2e0)
(cherry picked from commit de444a4562)
2024-12-23 13:56:52 +01:00
Martin von Gagern
a009cabcb4 core: fix dhcp leases in l3cd cloning.
This will copy DHCP lease from src (not self), fixing an assertion in
nm_l3_config_data_new_clone.

Resolves: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1620
Fixes: 55b722820d ('l3cfg: fix nm_l3_config_data_new_clone() to make exact copy')
(cherry picked from commit a25d593922)
(cherry picked from commit 61e781c4f5)
(cherry picked from commit fdc909741d)
2024-12-23 13:51:48 +01:00
Beniamino Galvani
14d6b7be3e cloud-setup: fix placement of directives in the systemd unit
The "StartLimitIntervalSec" and "StartLimitBurst" directives should be
in the [Unit] section instead of the [Service] one.

Fixes: 927cff9f17 ('cloud-setup: allow bigger restart bursts')
(cherry picked from commit a531458456)
(cherry picked from commit e34c7cd5a2)
(cherry picked from commit 97ee4c688f)
2024-12-23 13:51:23 +01:00
Beniamino Galvani
317b9a3a9c ovs: fix assertion failure in netdev datapath mode
When using the netdev datapath, we wait for the link to appear in
different steps:

 1. initially, in act_stage3_ip_config() connects to platform's
   "link-changed" signal to detect when the TUN interface appears;

 2. when the interface appears, _netdev_tun_link_cb() schedules
   _set_ip_ifindex_tun() in a idle handler;

 3. _set_ip_ifindex_tun() checks if the link is ready (e.g. if the MAC
   address is correct) and in that case it reschedules stage3, which
   will move forward with the activation;

 4. if the link is not ready in _set_ip_ifindex_tun(), the function
   connects again to platform's "link-changed" signal to react to link
   changes;

 5. after the link changes and it is ready, _netdev_tun_link_cb()
   reschedules stage3, which moves forward with the activation;

With the current implementation it is possible that after step 2, if
act_stage3_ip_config() runs because it was already scheduled, it
registers again to the "link-changed" event; then when
_set_ip_ifindex_tun() is invoked it will hit assertion:

  nm_assert(!priv->wait_link.tun_link_signal_id);

Fix this by preventing that the signal gets registered again after
step 2.

Fixes-test: @ovs_datapath_type_netdev_with_cloned_mac

Fixes: acf485196c ('ovs-interface: wait that the cloned MAC changes instead of setting it')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2024
(cherry picked from commit b6e69f3467)
(cherry picked from commit 50da988182)
(cherry picked from commit d82d8a027c)
2024-12-23 13:50:50 +01:00
Jan Vaclav
d13f0c04ed nmcli/edit: fix memory leak in extract_setting_and_property
In case the user selects a setting/property with "goto" command, and
then attempts to tab-complete a setting/property pair, the original sett
and prop strings are overriden without freeing:

  nmcli > goto 802-1x.pac-file
  nmcli 802-1x.pac-file> set 802-1.lal<TAB>

Fixes: 79bc271685 ('cli: TAB-completion for enum-style property values (rh #1034126)')
(cherry picked from commit ca47fd882e)
(cherry picked from commit 796844dc09)
2024-12-23 13:49:51 +01:00
Isidro Arias
005b042b41 examples: fix print parenthesis place in get_ips.py
Fixes: 797d9c4403 ('python: make dbus, gi examples, and debug-helper.py python3 ready')
(cherry picked from commit 75350b3e76)
(cherry picked from commit 87ec6ae44e)
2024-12-23 13:49:26 +01:00
Lubomir Rintel
5d25d69ec7 po/ru: back out unintended changes to the metadata
Seems like and older or broken template has snuck in at some point,
replacing "NetworkManager" with "PACKAGE" and removing copyright notices
of other translations. Bring that back.

Fixes: 3444af517f ('po: update Russian (ru) translation')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1996
(cherry picked from commit 2cd40063c2)
(cherry picked from commit 5a1f1f669f)
2024-12-23 13:48:17 +01:00
Beniamino Galvani
06032aa758 ndisc: preserve router preferences
If we add multiple default routes with the same metric and different
preferences, kernel merges them into a single ECMP route, with overall
preference equal to the preference of the first route
added. Therefore, the preference of individual routes is not
respected.

To avoid that, add routes with different metrics if they have
different preferences, so that they are not merged together.

We could configure only the route(s) with highest preference ignoring
the others, and the effect would be the same. However, it is better to
add all routes so that users can easily see from "ip route" that there
are multiple routers available.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1468
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1983

Fixes: 032b4e4371 ('core: use router preference for IPv6 routes')
(cherry picked from commit c437625a76)
(cherry picked from commit 8445076d55)
2024-12-23 13:46:47 +01:00
Beniamino Galvani
e4d7cb7453 policy: assert that the auto-activate list is empty on dispose
We are currently asserting that the list of devices waiting for
auto-activation in NMPolicy is not empty. This condition is always
false because:

 - NMDevice holds a reference to NMManager
 - NMManager holds a reference to NMPolicy
 - on dispose, NMDevice asserts that it's not in NMPolicy's
   auto-activate list

Therefore if there is any NMDevice alive, NMPolicy must be alive as
well. Instead, if there is no NMDevice alive the list must be empty.

The assertion could fail only when the NMPolicy instance gets
disposed, which usually doesn't happen because it's still referenced
at shutdown.

Fixes: aede228974 ('core: assert that devices are not registered when disposing NMPolicy')
(cherry picked from commit 27b646cfa1)
(cherry picked from commit 1b51404703)
2024-12-23 13:46:32 +01:00
Jan Vaclav
19a8feaad6 agent: print error message character in hex form if it's unprintable
Currently, when the agent manager is sent a registration request
containing UTF-8 characters, it will form an invalid error message
using only one of the bytes from the UTF-8 sequence, which causes
an assertion in glib to fail, which replaces the returned error message
with "[Invalid UTF-8]". It will also print an assertion failure to the
console, or crash NetworkManager on non-release builds.

This commit makes it so that it instead prints out the character in
hexadecimal form if it isn't normally printable, so that it is once
again a valid UTF-8 string.

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

Fixes: a30cf19858 ('agent: add agent manager and minimal agent class')
(cherry picked from commit c9327b2e8b)
(cherry picked from commit f6f466ccf8)
2024-12-23 13:45:54 +01:00