Commit Graph

32561 Commits

Author SHA1 Message Date
Íñigo Huguet
03db294c5c man: keyfile: complete the explanation of routes properties
Complete the explanations of routes properties, adding explanations for
routesN_option and routing-rules.
2023-09-21 15:49:24 +02:00
Íñigo Huguet
9d7644af5f man: keyfile: improve explanation of the format
Separate the explanation of the format in various paragraphs so it is
better structured and easier to follow and understand.

Add a note about the properties that, instead of using a semicolon
separated list, use individual key-value pairs per list element
(addresses, routes and routing-rules), since this is also a relevant
difference from the standard key file format and from the settings
specification format.
2023-09-21 15:49:24 +02:00
Wen Liang
4d0cf4924f device: do not set dependency failed for port if master is reconnecting
When a master is re-enslaved, it will be deactivated and reconnecting
immediately, as a result, we should not set the dependency-failed for
its port. Otherwise, we may risk blocking the autoconnect of port
connections with higher autoconnect-priority.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1725
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1473
2023-09-17 20:39:58 -04:00
Íñigo Huguet
510952b036 contrib: add libpsl-dev to debian requirements
It's installed for Fedora and Alpine, and building with meson requires
it by default.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1723
2023-09-13 16:29:01 +02:00
Beniamino Galvani
349665082f wifi: fix code format
Fixes: 04edba879d ('core: use nm_strerror_native() instead of strerror()')
2023-09-13 11:09:30 +02:00
Beniamino Galvani
4fad098e8e merge: branch 'th/strerror_r'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1715
2023-09-12 12:42:47 +00:00
Thomas Haller
c42f6f0997 daemon-helper: use _nm_strerror_r() to avoid non-thread-safe strerror()
Yes, there probably are not multiple threads here. It's a matter of principle to
not use smelly functions.

Also, copy the "errno" value we want to print, before calling various functions.
2023-09-12 12:39:43 +00:00
Thomas Haller
59251cae45 std-aux: extract and add _nm_strerror_r() helper
We have nm_strerror_native_r(), which is the wrapper around strerror_r() that
we want to use in glib components (it also will ensure that the string is valid
UTF-8). However, it's not usable from non-glib components.

Move the part that abstracts strerror_r() out to libnm-std-aux as _nm_strerror_r().
The purpose is that non-glib componenent can use the thread-safe wrapper around
strerror_r().
2023-09-12 12:39:43 +00:00
Thomas Haller
b53f929f40 systemd: drop strerror() define from sd adapter
Systemd does not use strerror(), so this define was unused.
Even if it would use it, we would better patch the upstream
sources, as strerror() is not suitable in multi-threadded applications.
2023-09-12 12:39:43 +00:00
Thomas Haller
04edba879d core: use nm_strerror_native() instead of strerror()
strerror() is not thread-safe. We avoid non-thread-safe API and have instead our own
wrapper nm_strerror_native(). Use it.
2023-09-12 12:39:43 +00:00
Beniamino Galvani
7882920928 merge: branch 'ih/tunnel_mode_doc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1719
2023-09-12 11:32:30 +02:00
Íñigo Huguet
140abc81ec nm-settings-nmcli: show proper valid values of ip-tunnel properties
Show all valid properties for ip-tunnel.mode, not only 2 examples.

Show constants as values suitable for user input in nmcli. That means
showing, for example, "ipip (1)" instead of "IP_TUNNEL_MODE_IPIP (1)".
2023-09-12 09:31:18 +00:00
Beniamino Galvani
7a0d3f53fa release: bump version to 1.45.2 (development) 2023-09-06 14:53:48 +02:00
Wen Liang
fa53b97214 test-client: fix python2 f-string and format compatibility issue
f-string is not supported in python2, and the autotool build complains
about it as follows:
```
  LIBTOOL="/bin/sh ./libtool" "../src/tests/client/test-client.sh" "." ".." "python2" -- TestNmCloudSetup
    File "/builds/NetworkManager/NetworkManager/src/tests/client/test-client.py", line 722
      return f"{major}.{minor}.{micro}"
                                      ^
  SyntaxError: invalid syntax
  test-client.py failed!!
  make[3]: *** [check-local-tests-client] Error 1
    File "/builds/NetworkManager/NetworkManager/src/tests/client/test-client.py", line 722
      return f"{major}.{minor}.{micro}"
                                      ^
  SyntaxError: invalid syntax
  test-client.py failed!!
```

Also, python2 complains about extra comma during argument unpacking.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1718
2023-09-05 07:53:51 -04:00
Beniamino Galvani
3821df2188 merge: branch 'bg/l3cfg-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1712
2023-09-04 18:26:52 +02:00
Beniamino Galvani
aed21d50af l3cfg: remove tna_dirty member
The member is no longer used.

Fixes: 1feaf427d2 ('platform: rework handling of failed routes during nm_platform_ip_route_sync()')
2023-09-04 18:25:42 +02:00
Beniamino Galvani
3fb1c4dc23 l3cfg: fix typo in variable name
Replace "mesc" with "msec".

Fixes: 1feaf427d2 ('platform: rework handling of failed routes during nm_platform_ip_route_sync()')
2023-09-04 18:25:41 +02:00
Beniamino Galvani
8da4d088ba l3cfg: fix log message
nm_utils_addr_family_to_char() requires a valid address family.

Fixes: 1feaf427d2 ('platform: rework handling of failed routes during nm_platform_ip_route_sync()')
2023-09-04 18:25:41 +02:00
Fernando Fernandez Mancera
4b78778e8b man: update default carrier-wait-timeout in NetworkManager.conf
The default value was updated to 6 seconds in
156344b8be.
2023-08-30 17:20:33 +02:00
Gris Ge
3162507d6c checkpoint: Fix segfault crash when rollback
When rolling back a checkpoint, NM will crash due to dereference a NULL
pointer of `priv->removed_devices->len`.

To fix it, we just place a NULL check before that code block.

Fixes: 1f1b71ad9f ('checkpoint: preserve devices that were removed and
                      readded')

Reference: https://issues.redhat.com/browse/RHEL-1526

Signed-off-by: Gris Ge <fge@redhat.com>
2023-08-29 23:50:18 +02:00
Fernando Fernandez Mancera
194b381d38 manager: merge branch 'wl/device_auth_request_fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1716
2023-08-23 16:00:43 +02:00
Wen Liang
b341161e2a nm-manager: ensure device is exported on D-Bus in authentication request
The device authentication request is an async process, it can not know
the answer right away, it is not guarantee that device is still
exported on D-Bus when authentication finishes. Thus, do not return
SUCCESS and abort the authentication request when device is not alive.

https://bugzilla.redhat.com/show_bug.cgi?id=2210271
2023-08-22 12:17:16 -04:00
Wen Liang
52e9600f03 Revert "nm-policy: stop rechecking autoactivation if device is unregistered"
When we register the auto-activate, the device has to be registered in
NMPolicy, the assertion is correct and ensure that.

This reverts commit 712729f652.
2023-08-22 11:46:46 -04:00
Thomas Haller
f55f848833 libnm: chain up "constructed() method in NMAuthSubject
It's not strictly necessary, because GObject.constructed() is
intentionally a NOP, to optionally allow chaining the parent method.

However, for consistency, this is what we commonly do.
2023-08-22 16:45:43 +02:00
Wen Liang
712729f652 nm-policy: stop rechecking autoactivation if device is unregistered
If the device is no longer registered to NMPolicy,
`g_signal_handler_find()` can not find the signal handler that was
disconnected before, therefore, there is no need to schedule a check for
autoactivation.

https://bugzilla.redhat.com/show_bug.cgi?id=2210271
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1711
2023-08-17 07:23:51 -04:00
Fernando Fernandez Mancera
9fab55ad4c l3cfg: merge branch 'bg/dad-failure-log-rh2123212'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1710
2023-08-14 12:39:52 +02:00
Beniamino Galvani
68dc2d3ca9 l3cfg: demote logging level for ACD conflict messages
NMDevice is now emitting those logs at info level.
2023-08-11 13:30:38 +02:00
Beniamino Galvani
9143c1b542 device: log ACD conflicts
l3cfg emits a log for ACD conflicts. However, l3cfg is not aware of
what are the related NMDevice or the currently active connection, and
so it can't log the proper metadata fields (NM_DEVICE and
NM_CONNECTION) to the journal.

Instead, let NMDevice log about ACD collisions; in this way, it is
possible to get the message when filtering by device and connection.
For example:

 $ journalctl -e NM_CONNECTION=d1df47be-721f-472d-a1bf-51815ac7ec3d + NM_DEVICE=veth0
 <info> device (veth0): IP address 172.25.42.1 cannot be configured because it is already in use in the network by host 00:99:88:77:66:55
 <info> device (veth0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
 <warn> device (veth0): Activation: failed for connection 'veth0+'
2023-08-11 13:30:38 +02:00
Beniamino Galvani
db307e69cb l3cfg: return the conflicting MAC address with ACD events
When a collision is detected by the Address Conflict Detection
mechanism, store the conflicting MAC address in NML3AcdAddrInfo, so
that it is available to listeners of NML3Cfg for events of type
NM_L3_CONFIG_NOTIFY_TYPE_ACD_EVENT.
2023-08-11 13:30:38 +02:00
Beniamino Galvani
995539cd30 contrib/rpm: enable ifcfg migration on Fedora 39+
https://fedoraproject.org/wiki/Changes/MigrateIfcfgToKeyfile
2023-08-10 13:21:49 +02:00
Beniamino Galvani
3f220e7dc5 release: bump version to 1.45.1 (development) 2023-08-09 18:05:00 +02:00
Beniamino Galvani
d56e49a4ec release: bump version to 1.44.0 2023-08-09 17:52:19 +02:00
Fernando Fernandez Mancera
4dc85ffa5c NEWS: update
(cherry picked from commit a1f48355de)
2023-08-09 17:19:58 +02:00
Fernando Fernandez Mancera
a1f48355de NEWS: update 2023-08-09 17:19:30 +02:00
Fernando Fernandez Mancera
7d0065062c NEWS: update
(cherry picked from commit 52999c0709)
2023-08-09 16:53:35 +02:00
Fernando Fernandez Mancera
52999c0709 NEWS: update 2023-08-09 16:52:18 +02:00
Íñigo Huguet
28e53fed89 nmcli: warn if daemon version mismatch
When updating NetworkManager to a new version, normally the service is
not restarted by the installer to avoid interrupting networking.
However, next nmcli invocation will use the updated version, but against
the older version of the daemon that is still running. Although this is
suposed to work, it is advisable that nmcli and daemon's versions are
the same. Emit a warning recommending restarting the daemon.

Add nmcli test to check the new feature. To avoid breaking the existing
tests, test-networkmanager-service now reports the same version than the
running nmcli except if it's instructed to report a different one.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1703
(cherry picked from commit fb851f3294)
2023-08-09 16:40:54 +02:00
Beniamino Galvani
49c7565a69 merge: branch 'bg/checkpoint-deleted-device'
https://bugzilla.redhat.com/show_bug.cgi?id=2177590
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1708

(cherry picked from commit b3a9999894)
2023-08-09 16:13:09 +02:00
Beniamino Galvani
8a881e638f checkpoint: fetch new device on rollback
When a device belonging to a checkpoint is removed, we clear the
device pointer from the DeviceCheckpoint and move the object from the
devices list to the removed-devices list of the checkpoint.

Later, when restoring the connection we need to set again the device
pointer in DeviceCheckpoint; otherwise, any connection on that device
can't be reactivated if changed.

Fixes: 0e2f7ac7b5 ('nm-checkpoint: drop reference to NM_DEVICE objects on removal signal')
(cherry picked from commit b80a398306)
2023-08-09 16:13:09 +02:00
Beniamino Galvani
1f1b71ad9f checkpoint: preserve devices that were removed and readded
With flag DISCONNECT_NEW_DEVICES, on rollback we delete devices that
are present in the system and are not in the checkpoint.

The problem is that we remove the device from
`NMCheckpointPriv->devices` when it is deleted and so we lose the
information that the device was in the checkpoint. We need to also
look in the `removed_devices` list.

Fixes: 0e2f7ac7b5 ('nm-checkpoint: drop reference to NM_DEVICE objects on removal signal')
(cherry picked from commit 0fcfd6e24f)
2023-08-09 16:13:09 +02:00
Beniamino Galvani
b3a9999894 merge: branch 'bg/checkpoint-deleted-device'
https://bugzilla.redhat.com/show_bug.cgi?id=2177590
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1708
2023-08-09 16:10:57 +02:00
Beniamino Galvani
b80a398306 checkpoint: fetch new device on rollback
When a device belonging to a checkpoint is removed, we clear the
device pointer from the DeviceCheckpoint and move the object from the
devices list to the removed-devices list of the checkpoint.

Later, when restoring the connection we need to set again the device
pointer in DeviceCheckpoint; otherwise, any connection on that device
can't be reactivated if changed.

Fixes: 0e2f7ac7b5 ('nm-checkpoint: drop reference to NM_DEVICE objects on removal signal')
2023-08-09 16:10:22 +02:00
Beniamino Galvani
0fcfd6e24f checkpoint: preserve devices that were removed and readded
With flag DISCONNECT_NEW_DEVICES, on rollback we delete devices that
are present in the system and are not in the checkpoint.

The problem is that we remove the device from
`NMCheckpointPriv->devices` when it is deleted and so we lose the
information that the device was in the checkpoint. We need to also
look in the `removed_devices` list.

Fixes: 0e2f7ac7b5 ('nm-checkpoint: drop reference to NM_DEVICE objects on removal signal')
2023-08-09 16:10:22 +02:00
Thomas Haller
f930c76a0a merge branch 'th/signedness-check-minmax'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1702
2023-08-07 15:12:08 +02:00
Thomas Haller
5fe6b63a62 std-aux: add static-asserts about signedness for NM_CMP_DIRECT() 2023-08-07 09:24:47 +02:00
Thomas Haller
f27bf0b9ea std-aux: add static-asserts about signedness of NM_MIN()/NM_MAX()/NM_CLAMP()
The macros NM_MIN()/NM_MAX()/NM_CLAMP() use typeof() to accept any
integer type as argument. Internally, they rely on standard C integral
conversions of the <> operators and the ternary operator for evaluating
the comparison and the result(type).

That works mostly great. Except, comparing signed and unsigned values in
C leads to oddities and the caller should explicitly take care of that.

Add static assertions to check that the compared arguments have the same
signedness.
2023-08-07 09:24:47 +02:00
Thomas Haller
3732f08319 std-aux: add _NM_INT_IS_SIGNED() and _NM_INT_SAME_SIGNEDNESS() macros 2023-08-07 09:24:46 +02:00
Thomas Haller
5ff1468717 all: ensure signendess for arguments of NM_{MIN,MAX,CLAMP}() macros matches 2023-08-07 09:24:36 +02:00
Íñigo Huguet
fb851f3294 nmcli: warn if daemon version mismatch
When updating NetworkManager to a new version, normally the service is
not restarted by the installer to avoid interrupting networking.
However, next nmcli invocation will use the updated version, but against
the older version of the daemon that is still running. Although this is
suposed to work, it is advisable that nmcli and daemon's versions are
the same. Emit a warning recommending restarting the daemon.

Add nmcli test to check the new feature. To avoid breaking the existing
tests, test-networkmanager-service now reports the same version than the
running nmcli except if it's instructed to report a different one.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1703
2023-08-03 10:09:06 +02:00
Fernando Fernandez Mancera
1dff015627 wifi: merge branch 'ff/wifi_bandwidth'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1704
2023-08-02 10:26:51 +02:00