Commit graph

33324 commits

Author SHA1 Message Date
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
Fernando Fernandez Mancera
27f130ab0c release: bump version to 1.48.6 2024-07-25 22:33:13 +02:00
Beniamino Galvani
1b51404703 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)
2024-07-25 13:30:08 +02:00
Fernando Fernandez Mancera
00e178351b ovs: wait for the link to be ready before activating
When activating an ovs-interface we already wait for the cloned MAC
address to be set, ifindex is present and platform link also present but
in some cases this is not enough.

If an udev rule is in place it might modify the interface when it is in
a later stage of the activation causing some race conditions or
problems. In order to solve that, we must wait until the link is fully
initialized.

(cherry picked from commit 83bf7a8cdb)
2024-07-25 10:41:50 +02:00
Gris Ge
3f3d1a4f54 activation: Allow changing controller of exposed active connection
When activating a port with its controller deactivating by new
activation, NM will register `state-change` signal waiting controller to
have new active connections. Once controller got new active connection,
the port will invoke `nm_active_connection_set_controller()` which lead
to assert error on
    g_return_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self)))

because this active connection is already exposed as DBUS object.

To fix the problem, we remove the restriction on controller been
write-only and notify DBUS object changes for controller property.

Signed-off-by: Gris Ge <fge@redhat.com>
(cherry picked from commit 83a2595970)
2024-07-12 14:53:37 +02:00
Stanislas FAYE
c89debd716 release: bump version to 1.48.5 (development) 2024-07-05 17:02:16 +02:00
Stanislas FAYE
62a0fa9fcb release: bump version to 1.48.4 2024-07-05 17:02:16 +02:00
Jan Vaclav
f6f466ccf8 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)
2024-07-05 16:51:18 +02:00
Jan Vaclav
f1888900bd nmtui: handle write() errors correctly in nmt_newt_edit_string
It might happen that write() returns -1, but the errno is not EINTR.
In that case, the length would be incremented by 1, and the data pointer
to the data being written would be moved back by 1 byte on every error.

Make it so that the function exits with an error if it indicates an error.

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

Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
(cherry picked from commit 13317bd536)
2024-07-05 16:51:09 +02:00
Beniamino Galvani
69bbc0f4e9 merge: branch 'bg/hostname-fallback-hosts'
Consider entries in /etc/hosts for hostname resolution

https://issues.redhat.com/browse/RHEL-33435
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1974
(cherry picked from commit 5aa5d87ed6)
2024-07-05 14:09:34 +02:00