Commit graph

33333 commits

Author SHA1 Message Date
Fernando Fernandez Mancera
f5bae36ef5 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)
2024-10-04 12:36:08 +02:00
Beniamino Galvani
ca6ca684b2 device: fix bug when deactivating port connections asynchronously
When the attach_port()/detach_port() methods do not return immediately
(currently, only for OVS ports), the following situation can arise:

 - nm_device_controller_attach_port() starts the attachment by sending
   the command to ovsdb. Note that here we don't set
   `PortInfo->port_is_attached` to TRUE yet; that happens only after
   the asynchronous command returns;

 - the activation of the port gets interrupted because the connection
   is deleted;

 - the port device enters the deactivating state, triggering function
   port_state_changed()

 - the function calls nm_device_controller_release_port() which checks
   whether the port is already attached; since
   `PortInfo->port_is_attached` is not set yet, it assumes the port
   doesn't need to be detached;

 - in the meantime, the ovsdb operation succeeds. As a consequence,
   the kernel link is created even if the connection no longer exists.

Fix this by turning `port_is_attached` into a tri-state variable that
also tracks when the port is attaching. When it is, we need to perform
an explicit detach during deactivation.

Fixes: 9fcbc6b37d ('device: make attach_port() asynchronous')

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

Resolves: https://issues.redhat.com/browse/RHEL-58026
(cherry picked from commit a8329587c8)
(cherry picked from commit d809ca6db2)
2024-10-04 12:36:07 +02:00
Beniamino Galvani
67b2a5f624 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)
2024-10-04 12:27:25 +02:00
Jan Vaclav
de444a4562 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)
2024-10-04 12:27:21 +02:00
Martin von Gagern
fdc909741d 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)
2024-10-04 12:27:16 +02:00
Beniamino Galvani
97ee4c688f 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)
2024-10-04 12:27:12 +02:00
Beniamino Galvani
d82d8a027c 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)
2024-10-04 12:27:06 +02:00
Beniamino Galvani
c7035db5b4 libnm-core: fix validation of ovs-dpdk interface name
An ovs-dpdk interface doesn't have a kernel link and doesn't have the
15-character limit on the name.

Fixes: 3efe070dfc ('libnm: validate "connection.interface-name" at one place only')

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2044
(cherry picked from commit fda05b0af0)
(cherry picked from commit f6e4e53775)
2024-09-26 09:51:26 +02:00
Beniamino Galvani
f2e61addc4 dhcp: remove the address synchronously on lease expiry
When the lease expires, the DHCP client emits a LEASE_UPDATE event
with a NULL l3cd. After returning from the handler, it sends
immediately a DHCP DISCOVER message to try to get a new lease.

It is important that when the DISCOVER gets sent the address is no
longer configured on the interface. Otherwise, the server could see
that it is already in use and assign a different one. Therefore,
remove the address synchronously when handling the event.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1532
(cherry picked from commit 514a3cb610)
2024-09-13 10:13:20 +02:00
Jonathan Kang
4e1a93ecbc device: don't enforce IP cleanup on deactivating state
Don't enforce IP cleanup when devices are in deactivating state, to
make sure that network connection is still available for pre-down
dispatcher phase.

Fixes ac4e63ddda ('ip: support dhcp-send-release in NMSettingIpConfig')

https://bugzilla.suse.com/show_bug.cgi?id=1228154
(cherry picked from commit c61c552077)
2024-08-30 12:02:04 +02:00
Íñigo Huguet
c976e21237 cloud-setup: azure: ensure that primary address is placed first
The primary address is that placed at position 0 of all the IP Addresses
of the interface. Sometimes we put it in a different position in the
ipv4s array because we insert them in the order we receive, but it might
happen that the HTTP responses comes back in wrong order.

In order to solve this, we pass the index of the IPv4 address to the
callback and the address is added in the right position directly.

Co-authored-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
(cherry picked from commit 72014db629)
2024-08-30 11:54:10 +02:00
Lubomir Rintel
4dc35c7274 cloud-setup: allow bigger restart bursts
On daemon startup, we may end up enqueueing many nm-cloud-setup.service
restarts in very a short time. That is perfectly fine, just bump the
thresholds so that systemd doesn't get in the way too quickly.

100 requests in 1 seconds seem like a fair choice -- little bit on the
conservative side, yet still giving the service manager some room to
interfere on a chance things really go awry.

https://issues.redhat.com/browse/RHEL-49694
(cherry picked from commit 927cff9f17)
2024-08-29 12:24:11 +02:00
Íñigo Huguet
0eae225f19 NEWS: update NEWS file with last releases changes
We didn't do it when we should.
2024-08-28 12:58:07 +02:00
Íñigo Huguet
d801d36039 Revert "po: add nmtui/nmt-page-veth.c to POTFILES.in"
This hadn't have to be backported.

This reverts commit 3edfc141de.
2024-08-28 08:35:58 +02:00
Íñigo Huguet
3edfc141de 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)
2024-08-27 10:03:09 +02:00
Íñigo Huguet
153c705fbd release: bump version to 1.48.11 (development) 2024-08-26 11:29:05 +02:00
Íñigo Huguet
b14ad1b692 release: bump version to 1.48.10 2024-08-26 11:29:05 +02:00
Jan Vaclav
796844dc09 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)
2024-08-26 10:59:57 +02:00
Íñigo Huguet
f8749a90c3 autotools: fix another filename that was renamed
Fixes: 090d617017 ('src: drop most master references from the code')
(cherry picked from commit fedc37ac48)
2024-08-22 14:47:17 +02:00
Fernando Fernandez Mancera
87e30a6f8a gitlab: fix helper scripts to support DNF5
As Fedora 41 (currently Rawhide) is migrating to DNF5 [1], the
debuginfo-install command is not available anymore according to the
documentation. Instead, the user need to add the package suffix
"-debuginfo" when using the install command.

The implementation of the debuginfo-install plugin is under development
and tracked upstream. [2]

[1] https://fedoraproject.org/wiki/Changes/SwitchToDnf5
[2] https://github.com/rpm-software-management/dnf5/issues/389

(cherry picked from commit 4e50d7d53f)
2024-08-22 14:47:17 +02:00
Íñigo Huguet
4a80410c74 CI: update the imported templates_sha
Without this new version of templates_sha it fails to create Rawhide
containers.
2024-08-22 14:46:46 +02:00
Íñigo Huguet
61ba5469ab autotools: fix filename that was renamed
Fixes: 090d617017 ('src: drop most master references from the code')
(cherry picked from commit 56f3911b49)
2024-08-22 12:06:37 +02:00
Íñigo Huguet
5882d6c791 format: run nm-code-format 2024-08-22 10:53:34 +02:00
Íñigo Huguet
a3fabf163a CI: fix Debian not including policykit-1 and remove EOL'd C8S 2024-08-22 10:51:09 +02:00
Beniamino Galvani
3555dbd2f2 policy: retry hostname resolution when it fails
Currently if the system hostname can't be determined, NetworkManager
only retries when something changes: a new address is added, the DHCP
lease changes, etc.

However, it might happen that the current failure in looking up the
hostname is caused by an external factor, like a temporary outage of
the DNS server.

Add a mechanism to retry the resolution with an increasing timeout.

https://issues.redhat.com/browse/RHEL-17972
(cherry picked from commit 04ad4c86d0)
2024-08-22 10:30:02 +02:00
Íñigo Huguet
08eae55a7e platform: add small backoff time before resync
If the socket's RX buffer is full it's probably because other
process is doing lot of changes very quickly, faster than we
can process them. Let's give the writer a small time to finish:
1. Avoid contending the kernel's RTNL lock, so we don't make
   the whole situation even worse and it can finish earlier.
2. Avoid having to resync again and again due to trying to
   resync while the writer is still doing quick changes, so
   we are unable to catch up yet.

This won't help if this situation takes a long time or is
continuous, but that's unlikely to happen, and if it does,
it's the writer's fault for starving the whole system.

There is no need to progresively increase the backoff time
for the same reason: if this situation takes lot of time,
it's the writer's fault. It's neither a good idea because the whole NM
process will end being sleeping long times, not doing anything at all,
without being able to react when the Netlink messages burst stops.

(cherry picked from commit 830dd4ad9c)
2024-08-22 10:29:32 +02:00
Íñigo Huguet
d12ee5c3cf merge: branch 'bg/bridge-vlan-reapply'
Support reapplying bridge port VLANs

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

(cherry picked from commit 926bfab5b5)
2024-08-22 10:27:56 +02:00
Beniamino Galvani
92b366545b bridge: reapply port VLANs only when necessary
Don't touch the bridge VLANs if they are already set.

(cherry picked from commit 447e50d74e)
2024-08-22 10:27:55 +02:00
Beniamino Galvani
5b79bb2feb 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)
2024-08-22 10:27:54 +02:00
Beniamino Galvani
dfaadf3d3e platform: support reading bridge VLANs
Add a function to read the list of bridge VLANs on an interface.

(cherry picked from commit 7ae4660a77)
2024-08-22 10:27:54 +02:00
Beniamino Galvani
cb5e3ceea7 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)
2024-08-22 10:27:53 +02:00
Beniamino Galvani
e41844467f 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)
2024-08-22 10:27:53 +02:00
Beniamino Galvani
b2eb4a927e platform: add define for IFLA_BOND_SLAVE_PRIO
The enum value was added in kernel 5.19; add a define for it so that
the compilation doesn't fail with earlier kernels.

Fixes: 79221f79a2 ('src: drop most slave references from the code')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1596
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2012
(cherry picked from commit 7d3bfb101f)
2024-08-20 13:31:50 +02:00
Fernando Fernandez Mancera
62d745fc9f merge: branch 'th/lldp-fix-crash'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2007

(cherry picked from commit 79c1f8c93a)
2024-08-19 15:21:53 +02:00
Thomas Haller
a1c18ce20d lldp: fix multiple access to argument in logging macro
Fixes: 630de288d2 ('lldp: add libnm-lldp as fork of systemd's sd_lldp_rx')
(cherry picked from commit 4365de5226)
2024-08-19 15:21:53 +02:00
Thomas Haller
8a2f7bd6e0 lldp: fix crash dereferencing NULL pointer during debug logging
During nm_lldp_neighbor_parse(), the NMLldpNeighbor is not yet added to
the NMLldpRX instance. Consequently, n->lldp_rx is NULL.

Note how we use lldp_x for logging, because we need it for the context
for which interface the logging statement is.

Thus, those debug logging statements will follow a NULL pointer and lead
to a crash.

Fixes: 630de288d2 ('lldp: add libnm-lldp as fork of systemd's sd_lldp_rx')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1550
(cherry picked from commit c2cddd3241)
2024-08-19 15:21:53 +02:00
Wen Liang
8243425c6d policy: unblock the autoconnect for children when parent is available
When parent is available and in the process of activation, we should
unblock the autoconnect and schedule an auto activate for the children.
Notice that when the parent is the ovs-interface, the kernel link is
only created in stage3, if we only unblock the children in the stage1,
then the children device and connection will be blocked again due
to the fact the kernel link for the parent ovs-interface is not
existed yet, thus, we have to separately unblock the children
when the parent ovs-interface is in the activated state.

https://issues.redhat.com/browse/RHEL-46904
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2003
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1735
(cherry picked from commit 5f64f292e6)
2024-08-13 08:33:46 -04:00
Fernando Fernandez Mancera
28ef9dae0b release: bump version to 1.48.9 (development) 2024-08-09 17:14:26 +02:00
Fernando Fernandez Mancera
575134dd67 release: bump version to 1.48.8 2024-08-09 17:14:26 +02:00
Isidro Arias
87ec6ae44e 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)
2024-08-09 17:03:21 +02:00
Lubomir Rintel
5a1f1f669f 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)
2024-08-09 16:58:38 +02:00
Beniamino Galvani
8445076d55 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)
2024-08-09 16:57:07 +02:00
Fernando Fernandez Mancera
a5fc92b986 merge: branch 'ff/drop_offensive_code'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1984

(cherry picked from commit ccee88ad5a)
2024-08-09 16:53:18 +02:00
Fernando Fernandez Mancera
7bf05b7fa5 config: parse autoconnect-ports value on config
As part of the conscious language effort we must provide an alternative
option to configure autoconnect-ports system-wide on NetworkManager
configuration file.

(cherry picked from commit ad68b28843)
2024-08-09 16:53:17 +02:00
Fernando Fernandez Mancera
7db5ce8c65 dbus-interface: rename activation flag to use conscious language
(cherry picked from commit 3203eb3df0)
2024-08-09 16:53:17 +02:00
Fernando Fernandez Mancera
0ba2d9256e src: drop most slave references from the code
While we cannot remove all the references to "slave" we can remove most
of them.

(cherry picked from commit 79221f79a2)
2024-08-09 16:53:17 +02:00
Fernando Fernandez Mancera
345667f893 src: drop most master references from the code
While we cannot remove all the references to "master" we can remove most
of them.

(cherry picked from commit 090d617017)
2024-08-09 16:53:17 +02:00
Fernando Fernandez Mancera
8e54352ec8 keyfile: do not write offensive terms into keyfile
As part of the conscious language efforts we are not writing offensive
terms into keyfiles anymore. This won't break users upgrading as we
still read such values if they are present into the keyfile.

For existing profiles, NetworkManager will remove the offensive terms
when editing the keyfile.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2009
(cherry picked from commit 9f6ecbae69)
2024-08-09 16:52:32 +02:00
Fernando Fernandez Mancera
63dfd3b60b ovs: fix triggering stage3 activation without DHCP client initialized
It is possible that we learn the link is ready on stage3_ip_config
rather than in link_changed event due to a stage3_ip_config scheduled by
another component. In such cases, we proceed with IP configuration
without allocating the resources needed like initializing DHCP client.

In order to avoid that, if we learn during stage3_ip_config that the
link is now ready, we need to schedule another stage3_ip_config to
allocate the resources we might need.

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

Fixes: 83bf7a8cdb ('ovs: wait for the link to be ready before activating')
(cherry picked from commit 40d51b9104)
2024-07-31 11:08:53 +02:00
Fernando Fernandez Mancera
8ab31ce62f release: bump version to 1.48.7 (development) 2024-07-25 22:33:13 +02:00