Commit graph

32682 commits

Author SHA1 Message Date
Beniamino Galvani 5b16c128bb l3cfg: fix pruning of ACD data (take 2)
If a commit is invoked without any change to the l3cd or to the ACD
data, in _l3cfg_update_combined_config() we skip calling
_l3_acd_data_add_all(), which should clear the dirty flag from ACDs.
Therefore, in case of such no-op commits the ACDs still marked as
dirty - but valid - are removed via:

 _l3_commit()
   _l3_acd_data_process_changes()
     _l3_acd_data_prune()
       _l3_acd_data_prune_one()

Invoking a l3cfg commit without any actual changes is allowed, see the
explanation in commit e773559d9d ('device: schedule an idle commit
when setting device's sys-iface-state').

The bug is visible by running test 'bond_addreses_restart_persistence'
with IPv4 ACD/DAD is enabled by default: after restart IPv6 completes
immediately, the devices becomes ACTIVATED, the sys-iface-state
transitions from ASSUME to MANAGED, a commit is done, and it
incorrectly prunes the ACD data. The result is that the IPv4 address
is never added again.

Fix this by doing the pruning only when we update the dirty flags.

This is a respin of commit ed565f9146 ('l3cfg: fix pruning of ACD
data') that was reverted because it was causing a crash. The crash was
caused by unconditionally clearing `acd_data_pruning_needed` in
_l3cfg_update_combined_config(), while we need to do it only when
actually committing the configuration.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1749
2023-10-16 16:58:46 +02:00
Jan Vaclav aa84b5f935 device: fix assertion failure caused by DAD array reuse
This commit fixes an assertion failure caused by the `conflicts` array being reused
when both IPv4 and IPv6 duplicate address detection occurs.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1747
Fixes: afa208c862 ('core: return conflicting addresses from nm_l3cfg_check_ready()')
2023-10-11 08:14:40 +00:00
Beniamino Galvani 8ed1b8daec merge: branch 'bridge-netlink'
platform: add netlink support for bridge port options

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1685
2023-10-09 12:27:00 +00:00
Javier Sánchez Parra b38e8c053b platform: add netlink support for bridge port options
sysfs is deprecated and kernel will not add new bridge port options to
sysfs. Netlink is a stable API and therefore is the right method to
communicate with kernel in order to set the link options.
2023-10-09 12:25:45 +00:00
Beniamino Galvani 6fa4a45470 man: merge branch 'bg/man-license'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1744
2023-10-06 13:30:06 +02:00
Beniamino Galvani abf41bc282 man: improve NM-dispatcher man page 2023-10-06 13:27:59 +02:00
Beniamino Galvani 7a07a0b92d man: replace license blurb with SPDX tag 2023-10-06 13:27:59 +02:00
Beniamino Galvani 6971d53901 docs,m4: remove paragraph about writing to FSF
The Free Software Foundation has changed addresses in the past, and
may do so again. NetworkManager already includes a copy of the
licenses.
2023-10-06 13:27:59 +02:00
Beniamino Galvani b777cbf5a5 man: remove old version of nmtui man page
The man page is now generated from the docbook xml.

Fixes: 5216307b5a ('man: convert nmtui(1) manual to docbook refentry')
2023-10-06 13:27:59 +02:00
Beniamino Galvani 6a63d79fe6 Revert "l3cfg: fix pruning of ACD data"
The commit causes the following assertion failure:

  0  0x00007f4187e22884 in __pthread_kill_implementation () from target:/lib64/libc.so.6
  1  0x00007f4187dd1afe in raise () from target:/lib64/libc.so.6
  2  0x00007f4187dba87f in abort () from target:/lib64/libc.so.6
  3  0x00007f4188386f4e in g_assertion_message (domain=domain@entry=0x6fc1bc "nm", file=file@entry=0x722e94 "../src/core/nm-l3cfg.c", line=line@entry=2134,
     func=func@entry=0x727730 <__func__.49> "_l3_acd_data_add_all", message=message@entry=0x23b3bb0 "assertion failed: (acd_data->info.track_infos[i]._priv.acd_dirty_track)")
     at ../glib/gtestutils.c:3450
  4  0x00007f41883f1597 in g_assertion_message_expr (domain=domain@entry=0x6fc1bc "nm", file=file@entry=0x722e94 "../src/core/nm-l3cfg.c", line=line@entry=2134,
     func=func@entry=0x727730 <__func__.49> "_l3_acd_data_add_all", expr=expr@entry=0x726450 "acd_data->info.track_infos[i]._priv.acd_dirty_track") at ../glib/gtestutils.c:3476
  5  0x0000000000587209 in _l3_acd_data_add_all (self=self@entry=0x23a7020, infos=infos@entry=0x0, infos_len=infos_len@entry=0, reapply=reapply@entry=1)
     at ../src/core/nm-l3cfg.c:2134
  6  0x0000000000587702 in _l3cfg_update_combined_config (self=self@entry=0x23a7020, to_commit=to_commit@entry=1, reapply=reapply@entry=1, out_old=out_old@entry=0x7ffd09ea4ca8,
     out_changed_combined_l3cd=out_changed_combined_l3cd@entry=0x7ffd09ea4c7c) at ../src/core/nm-l3cfg.c:3858
  7  0x000000000058a202 in _l3_commit (self=0x23a7020, commit_type=commit_type@entry=NM_L3_CFG_COMMIT_TYPE_REAPPLY, is_idle=is_idle@entry=0) at ../src/core/nm-l3cfg.c:5046
  8  0x000000000058a49f in nm_l3cfg_commit (self=<optimized out>, commit_type=commit_type@entry=NM_L3_CFG_COMMIT_TYPE_REAPPLY) at ../src/core/nm-l3cfg.c:5115
  9  0x00000000004856cd in nm_device_l3cfg_commit (self=self@entry=0x23ab870, commit_type=commit_type@entry=NM_L3_CFG_COMMIT_TYPE_REAPPLY, commit_sync=commit_sync@entry=1)
     at ../src/core/devices/nm-device.c:4155
  10 0x00000000004b1814 in nm_device_cleanup (self=self@entry=0x23ab870, reason=reason@entry=NM_DEVICE_STATE_REASON_NEW_ACTIVATION,
     cleanup_type=cleanup_type@entry=CLEANUP_TYPE_DECONFIGURE) at ../src/core/devices/nm-device.c:15884
  11 0x00000000004b26c9 in _set_state_full (self=self@entry=0x23ab870, state=state@entry=NM_DEVICE_STATE_DISCONNECTED, reason=NM_DEVICE_STATE_REASON_NEW_ACTIVATION,
     quitting=quitting@entry=0) at ../src/core/devices/nm-device.c:16291
  12 0x00000000004b2fe4 in nm_device_state_changed (self=self@entry=0x23ab870, state=state@entry=NM_DEVICE_STATE_DISCONNECTED, reason=<optimized out>)
     at ../src/core/devices/nm-device.c:16505
  13 0x00000000004b69de in queued_state_set (user_data=user_data@entry=0x23ab870) at ../src/core/devices/nm-device.c:16532
  14 0x00007f41883bf4fd in g_idle_dispatch (source=0x23a88e0, callback=0x4b6956 <queued_state_set>, user_data=0x23ab870) at ../glib/gmain.c:6163
  15 0x00007f41883c34fc in g_main_dispatch (context=0x22c4d10) at ../glib/gmain.c:3460
  16 g_main_context_dispatch (context=0x22c4d10) at ../glib/gmain.c:4200
  17 0x00007f41884216b8 in g_main_context_iterate.isra.0 (context=0x22c4d10, block=1, dispatch=1, self=<optimized out>) at ../glib/gmain.c:4276
  18 0x00007f41883c2aff in g_main_loop_run (loop=0x22c3b50) at ../glib/gmain.c:4479
  19 0x0000000000423a37 in main (argc=<optimized out>, argv=<optimized out>) at ../src/core/main.c:519

This reverts commit ed565f9146.
2023-10-05 21:26:31 +02:00
Beniamino Galvani 11c9ce12f4 merge: branch 'bg/ipv4-dad-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1734
2023-10-05 09:26:15 +02:00
Beniamino Galvani a45024714f core: don't fail if at least one static address passes DAD
It seems more useful to have a best effort approach and configure
everything we can; in that way we achieve at least some connectivity,
and then sysadmin can check the logs in case something is
missing. Currently instead, the whole activation fails (so, no address
is configured) if just one of the addresses fails DAD.

Ideally, we should have a way to make this configurable; but for now,
implement the more useful behavior as default.
2023-10-05 09:05:21 +02:00
Beniamino Galvani 536805231a libnm: better document IPv4 DAD property
Clarify that the value is the *maximum* interval; the actual value is
randomized and can be as low as half the specified one.
2023-10-05 09:05:16 +02:00
Beniamino Galvani 6ebf2c6ba1 l3cfg: log the reason when marking IP configuration dirty 2023-10-05 09:05:13 +02:00
Beniamino Galvani e83e8b73f4 l3cfg: improve logging
- avoid "update" as it is also a commit type
 - make clear that the commit is not happening now
2023-10-05 09:05:07 +02:00
Beniamino Galvani 1f73034719 device: check DAD result for manual method even without carrier
IPv4 and IPv6 DAD work slightly differently: for IPv4 the presence or
absence of carrier doesn't have any effect on the duration of the
probe; for IPv6, DAD never completes without carrier because kernel
never removes the tentative flag.

In both cases, we shouldn't ignore the DAD result because that would
mean that we complete the ipmanual method without addresses actually
configured.
2023-10-05 09:04:59 +02:00
Beniamino Galvani a49913504d dhcp: don't schedule commit of type "update" when clearing acd
We don't know the reason why the DHCP client is being stopped. It is
wrong to schedule a commit of type "update" because the device could
be now unmanaged. Schedule instead a commit of type "auto", which
automatically determines the type of commit based on registered
handles.
2023-10-05 09:04:46 +02:00
Beniamino Galvani ed565f9146 l3cfg: fix pruning of ACD data
If a commit is invoked without any change to the l3cd or to the ACD
data, in _l3cfg_update_combined_config() we skip calling
_l3_acd_data_add_all(), which should clear the dirty flag from ACDs.
Therefore, in case of such no-op commits the ACDs still marked as
dirty - but valid - are removed via:

 _l3_commit()
   _l3_acd_data_process_changes()
     _l3_acd_data_prune()
       _l3_acd_data_prune_one()

Invoking a l3cfg commit without any actual changes is allowed, see the
explanation in commit e773559d9d ('device: schedule an idle commit
when setting device's sys-iface-state').

The bug is visible by running test 'bond_addreses_restart_persistence'
with IPv4 ACD/DAD is enabled by default: after restart IPv6 completes
immediately, the devices becomes ACTIVATED, the sys-iface-state
transitions from ASSUME to MANAGED, a commit is done, and it
incorrectly prunes the ACD data. The result is that the IPv4 address
is never added again.

Fix this by doing the pruning only when we update the dirty flags.
2023-10-05 09:04:32 +02:00
Beniamino Galvani 7548ff57d3 l3cfg: skip ACD for interfaces with IFF_NOARP
Interfaces with IFF_NOARP don't support Address Conflict Detection,
which is based on ARP. Trying to start ACD on them would result in
ENOBUFS always being returned by send(), and n-acd handles such error
by retrying indefinitely.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2023-10-05 09:04:09 +02:00
Beniamino Galvani 687051368f l3cfg: schedule a commit when ACD is not supported
On interfaces not supporting ACD (for example, layer3 interfaces), the
probe fails to be created with message:

 l3cfg[...,ifindex=2]: acd[172.25.17.1, init]: probe-good (interface does not support acd, initial post-commit)
 l3cfg[...,ifindex=2]: acd[172.25.17.1, ready]: set state to ready (probe is ready, waiting for address to be configured)

During the post-commit event, if the address is not yet configured, we
need to schedule a new commit to actually add it.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2023-10-05 09:03:40 +02:00
Beniamino Galvani 23727917b2 n-acd: use separate seed state for each probe of the same acd
Currently, all the probes of an acd instance share the same seed
state. This means that the state is updated by all the probes, and as
a consequence they get different jitters for the wait timeouts;
therefore the order in which addresses become available (and are
configured on the interface) is not deterministic.

Keep a separate seed state for each probe, initialized from the acd
seed. This ensures that all the probes use the same timeouts when
sending probe requests, and that in case of no collision, addresses
are available in the order of probe start.

n-acd pull request: https://github.com/nettools/n-acd/pull/10
2023-10-05 09:02:57 +02:00
Beniamino Galvani e97ebb2441 device: wait DAD before starting dnsmasq in IPv4 shared mode
Currently, IPv4 shared mode fails to start when DAD is enabled because
dnsmasq tries to bind to an address that is not yet configured on the
interface. Delay the start of dnsmasq until the shared4 l3cd is ready.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2023-10-05 09:00:57 +02:00
Beniamino Galvani 9b0b28acf7 release: bump version to 1.45.4 (development) 2023-10-04 14:54:57 +02:00
Beniamino Galvani d643a9ccc7 libnm: add "Since:" annotation to NM_WIFI_DEVICE_CAP_FREQ_6GHZ
The enum value is public API; indicate when it was introduced.

Fixes: 8f438d8d08 ('wifi: add 6ghz device capability flag')
2023-10-04 10:04:18 +02:00
Beniamino Galvani 5ca7d8dbb7 merge: branch 'bg/ifcfg-migration-readme'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1714
2023-10-03 14:14:00 +02:00
Beniamino Galvani cb4c8c2147 contrib/rpm: add note about interface renaming with ifcfg vs keyfile 2023-10-03 14:09:21 +02:00
Beniamino Galvani c3ca0b90cd contrib/rpm: ship a different readme when ifcfg migration is enabled
Ship a different file in /etc/sysconfig/network-scripts to warn that
migration is enabled.
2023-10-03 14:09:21 +02:00
Korbin Bickel 8f438d8d08 wifi: add 6ghz device capability flag
Adds a new WiFi 6GHz capability flag, NM_WIFI_DEVICE_CAP_FREQ_6GHZ,
along side the existing NM_WIFI_DEVICE_CAP_FREQ_2GHZ &
NM_WIFI_DEVICE_CAP_FREQ_5GHZ flags.

Gnome settings utilizes the 2 existing flags to present supported
bands in gnome-settings. I will be using this additional flag in
modifications there.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1739
2023-10-03 08:28:58 +02:00
Beniamino Galvani fa1239df14 merge: branch 'jv/no-pid-upper-bound'
main: increase upper limit of pid when checking pidfile

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1727
2023-10-03 06:25:41 +00:00
Jan Vaclav 50f34217f9 main: use _nm_utils_ascii_str_to_int64 instead of strtol for reading pid
Also removes the errno check, since it's already done within _nm_utils_ascii_str_to_int64()

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1727
2023-10-03 06:25:18 +00:00
Jan Vaclav 28f7a6638f main: don't limit upper bound of pid when checking pidfile
This commit removes the upper bound check for the PID, letting NetworkManager recognize a PID from the pidfile higher than 2^16.
The PID limit is often set higher than 2^16 (65536) on 64-bit systems, resulting in the pidfile being ignored and subsequently deleted if the currently running instance of NetworkManager has a pid higher than 2^16.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1727
2023-10-03 06:25:18 +00:00
Wen Liang ffc377ecc6 device: negate the condition in _get_maybe_ipv6_disabled
The condition in `_get_maybe_ipv6_disabled()` is improperly set which
returns the wrong value on if an device is disabled or not when
generating the assume connection. And when
`/proc/sys/net/ipv6/conf/$DEV/disable_ipv6` is not existed (not
disabling ipv6 through sysctl setting), IPv6 is disabled by default.

Fixes: be655e6ed1 ('core: read "disable_ipv6" sysctl before nm_ip6_config_create_setting()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1743
2023-10-02 15:57:35 -04:00
Beniamino Galvani e85b76b736 merge: branch 'wip/sadiq/qr-border'
libnmc-base/utils: Improve qr code bottom border

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1736
2023-10-02 15:58:31 +00:00
Mohammed Sadiq d9b06a95c9 libnmc-base/utils: Improve qr code bottom border
The bottom border of the generated QR code had a different thickness
compared to other borders.

Improve it by using Upper Half Block so that all borders have similar
thickness.
2023-10-02 15:57:41 +00:00
Beniamino Galvani 9820e791d1 merge: branch 'ungateway-ofono'
wwan/ofono: handle missing default gateway

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1731
2023-10-02 13:27:36 +00:00
Sicelo A. Mhlongo 96ae8b794f wwan/ofono: handle missing default gateway
It is normal for the operator to not provide a default gateway address, in
which case it must be set to 0.0.0.0, as can be seen in upstream ofono test
scripts [1].

[1] https://git.kernel.org/pub/scm/network/ofono/ofono.git/commit/test/process-context-settings?id=945a621a2ddfc01b8bdd8936044cb7d2604e8608

Fixes: a6e81af87f ('wwan: add support for using oFono as a modem manager')
2023-10-02 13:25:48 +00:00
Gris Ge 1486c78b13 merge: branch 'dns_changed_event'
dispatch `dns-change` dispatcher event

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1732
2023-09-28 00:17:51 +00:00
Gris Ge a1db61ebc9 dispatch dns-change dispatcher event
Introducing new dispatcher event -- `dns-change` which will be emitted when
DNS configuration changed(even in `dns=none` mode). This is to solve two
use cases:
 * Invoke dispatch script for DNS changes triggered by the global DNS
   API.

 * Do not invoke [OpenShift resolv-prepender][1] for non-DNS changes.

Bug reference: https://issues.redhat.com/browse/RHEL-1671

[1]: https://github.com/openshift/machine-config-operator/blob/master/templates/common/on-prem/files/resolv-prepender.yaml

Signed-off-by: Gris Ge <fge@redhat.com>
2023-09-26 17:14:58 +08:00
Gris Ge a847ba8075 emit DNS CONFIG_CHANGED signal even dns=none
Instruct the `NMDnsManager` to emit `CONFIG_CHANGED` signal even
`dns=none` or failed to modify `/etc/resolv.conf`.

The `NMPolicy` will only update hostname when DNS is managed.

Signed-off-by: Gris Ge <fge@redhat.com>
2023-09-26 15:00:32 +08:00
Aleksandr Melman 390269807f Update Russian translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1740
2023-09-25 14:21:25 +02:00
Beniamino Galvani 16f667bf2d merge: branch 'remove_csme'
platform: remove CSME related code

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1573
2023-09-25 11:47:39 +00:00
Emmanuel Grumbach 3476135911 platform: remove CSME related code
Remove all the code that was added for the CSME coexistence.
The Intel WiFi team can't commit on when, if at all, this feature will
be completely integrated and tested in the NetworkManager.
The preferred solution for now is the solution that involves the kernel
only.
Remove the code that was merged so far.
2023-09-25 11:46:24 +00:00
Beniamino Galvani 673f9d2154 merge: branch 'th/clicolor-force'
Support CLICOLOR_FORCE variable and fix handling of empty NO_COLOR

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1733
2023-09-25 09:03:28 +00:00
Thomas Haller ae06a607b3 cli: honor CLICOLOR_FORCE= variable to enable colors with nmcli
Note that [1] suggests to also accept an empty value as having the variable
set. That is likely a bug ([2]) in the documentation, makes little sense, and
is not the case with NO_COLOR ([3]).

[1] https://bixense.com/clicolors/
[2] https://github.com/jhasse/clicolors/issues/13
[3] https://no-color.org/
2023-09-25 09:02:17 +00:00
Thomas Haller 0ac5221c40 cli: fix handling empty NO_COLOR= variable
An empty value NO_COLOR= should not be treated to disable colors.
This is also what [1] says (changed a while ago [2]).

[1] https://no-color.org/
[2] 99f90e27d0
2023-09-25 09:02:17 +00:00
Beniamino Galvani 867db80457 merge: branch 'fm/1354-assert-modem-device'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1726
2023-09-25 08:49:34 +00:00
Frederic Martinsons 2d85b11660 devices/wwan: don't assert on unexpected state
On very particular timing, if a connection is currently activating
on a modem device and user remove the remote settings associated
an device state change:

prepare -> deactivating (reason 'connection-removed', sys-iface-state: 'managed')

pops before entering into modem_prepare_result, resulting to a crash
on assertion.

We can simply check for the modem state to failed, set the success flag
to FALSE and continue.

Closes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1354

Signed-off-by: Frederic Martinsons <frederic.martinsons@unabiz.com>
2023-09-25 08:48:25 +00:00
Beniamino Galvani 07b46b7873 release: bump version to 1.45.3 (development) 2023-09-22 13:58:50 +02:00
Íñigo Huguet fcfbbb9a32 Fix version error when building with an old meson version
Addition of list and string is allowed but only from version 0.60 of
meson. We claim to support building with meson 0.47, and there are
distributions like Debian and CentOS Stream 8 that uses versions older
than 0.60. Fix it by converting the offending string to a single item
list.

On newer versions, we get this warning only:
  Project targets '>= 0.47.2' but uses feature introduced in
  '0.60.0': list.<plus>. The right hand operand was not a list.

Fixes: 984642e33f ('build: meson: fix some missing dependencies')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1737
2023-09-22 10:34:24 +02:00
Íñigo Huguet 4ad4a1fbeb nm-meta-setting-desc: refactor and comment when get_gtype is disallowed
The get_gtype field in property_typ_data is intended to specify an enum
type for properties that are really defined as (u)int in the NMSetting
class. Specifying get_gtype for properties that are already defined as
enum in the NMSetting class is rejected as a runtime error. However, the
error message doesn't explain the reason. Put a code comment explaining
the reason.

Explaining it in a comment is actually enough because:
- The error is a runtime assertion that indicates a programming error
- The assertion is checked any time that the property is read or
  written, so it should always be detected at developing time when doing
  changes to the property.

Anyway, the code that did this checks was very difficult to read, so
let's take the opportunity to refactor it, with no functional changes.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1728
2023-09-21 16:02:15 +02:00