Commit graph

212 commits

Author SHA1 Message Date
Thomas Haller 4a548423b9
core: change order/priority of static IPv6 addresses relative to autoconf6/DHCPv6
The order of addresses can matter for source address selection.
This is described in RFC 6724 section 5, but if the rules don't
determine a clear winner, the order matters.

Change the relative order of IPv6 addresses. Previously, we would prefer
autoconf6, over DHCPv6, over manual addresses. Now that got reverted
to make more sense and be consistent with IPv4.
Also, if we had multiple autoconf6 addresses (received at different
moments in time), then previously a newly received address would be
added with highest priority. Now, the older address will be preferred
and that order will be enforced (this can be a problem, see (*) below).

For IPv4, it's all simple and sensible. When we add addresses in kernel
via netlink, the first address (of a subnet) becomes the primary.
Note that we only control the order of addresses of the same subnet.
The addresses in ipv4.addresses" are sorted with primary address first.
In the same way is the order for addresses in NML3ConfigData and for
@known_addresses in nm_platform_ip_address_sync(), all primary-first.
Also, manual addresses are sorted with higher priority compared to DHCPv4
addresses (at least since NetworkManager 1.36). That means the way how we
merge NML3ConfigData makes sense (nm_l3_config_data_merge()) because we first
merge the static configuration, then the DHCPv4 configuration, where we just
append the lower priority DHCPv4 addresses.

For IPv6, the address priority is messed up. On netlink/kernel, the last added
address becomes the preferred one (we thus need to add them in the order of
lowest priority first). Consequently and historically, the IPv6 addresses in
@known_addresses parameter to nm_platform_ip_address_sync() were
lowest priority first. And so they were tracked in NML3ConfigData
and in the profile ("ipv6.addresses"). That is confusing.
Also, we usually want to merge NML3ConfigData with different priorities
(e.g. static configuration from the profile before autoconf6/DHCPv6),
as we do with IPv4. However, since internally IPv6 addresses are tracked in
reverse order, it means later NML3ConfigData would be appended and get effectively
a higher priority. That means, autoconf6 addresses were preferred over DHCPv6 and
over manual "ipv6.addresses", respectively. That seems undesirable and inconsistent
with IPv4. Change that. This is a change in behavior.

Note that changing the order of addresses means to remove and re-add
them in the right (inverse) order, with lease important first. This
means, when we add a new address with lower priority, we need to remove
all higher priority addresses temporarily, before readding them. That
is a problem(*).

Note that in the profile, "ipv6.addresses" is still tracked in reverse
order. This did not change, but might change later.
2022-04-27 15:50:50 +02:00
Lubomir Rintel 6fa1323ce5 nmcli: add --offline option for "add" and "modify"
This adds a global "--offline" option and allows its use with "add" and
"modify" commands. The "add" looks like this:

  $ nmcli --offline conn add type ethernet ens3 ipv4.dns 192.168.1.1 \
      >output.nmconnection

The "modify" is essentially implementing what's been suggested by
Beniamino in bugzilla ticked (referred to below):

  $ nmcli --offline connection modify ens3 ipv4.dns 192.168.1.1 \
      <input.nmconnection >output.nmconnection

Other commands don't support the argument at the moment:

  $ nmcli --offline c up ens3
  Error: 'up' command doesn't support --offline mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1361145
2022-04-19 14:12:42 +02:00
Thomas Haller 54119d4105
dhcp: drop internal systemd DHCPv4 client
This is long replaced by nettools' n-dhcp4 client.
Drop it.

We still require NMDhcpSystemd for the DHCPv6 client.

Note that "[main].dhcp=systemd" now falls back to the internal client.
But this option was undocumented and internal anyway.
2022-04-14 14:51:02 +02:00
Thomas Haller 0f2708f86a
NEWS: update 2022-04-08 17:53:21 +02:00
Thomas Haller 2dc7a3d9f9
dhcp: set "src" for DHCPv4 routes
Let's set the "src" (RTA_PREFSRC) of DHCP routes.
This helps with source address selection.

This can matter if the interface also has static addresses
configured.

Systemd-networkd also does this ([1], [2]).

[1] ac2dce5f36
[2] 5b89bff55f/src/network/networkd-dhcp4.c (L395)

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1995372

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1173
2022-04-07 10:20:46 +02:00
Thomas Haller 8e76b08e1c
NEWS: update 2022-04-06 18:28:06 +02:00
Thomas Haller 1d7bea8cf6
NEWS: update 2022-04-06 16:02:10 +02:00
Lubomir Rintel 79e8f9f258 NEWS: update 2022-03-24 21:33:39 +01:00
Beniamino Galvani 429228bfdd NEWS: update 2022-03-09 15:32:51 +01:00
Beniamino Galvani 392daa5dab core: fall back to loading all known settings plugins
Currently it is possible to specify a list of default settings plugins
to be used when configuration doesn't contain the main.plugins key.

We want to add a mechanism that allows to automatically load any
plugin found in the plugins directory without needing
configuration. This mechanism is useful when plugins are shipped in a
different, optional subpackage, to automatically use them.

With such mechanism, the actual list of plugins will be determined
(in order of evaluation):

 1. via explicit user configuration in /etc, if any
 2. via distro configuration in /usr, if any
 3. using the build-time default, if any
 4. looking for known plugins in /usr/lib
2022-03-06 09:12:06 +01:00
Thomas Haller 38290b1b86
NEWS: update
This paragraph that "it's likely that" some changes will be backported
to 1.34 branch seems unnecessary. Whenever we backport things to 1.34
we will add them to the NEWS file for nm-1-34, and then also mention
them in nm-1-36 and newer. But we don't need to announce that.
2022-02-24 17:44:12 +01:00
Thomas Haller e023ac30f2
NEWS: update 2022-02-23 14:57:49 +01:00
Christian Eggers b26c9723d9
libnm-crypto: add new option for no cryptography
For some embedded systems, no cryptography is required at all (e.g when
only using Ethernet).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1108
2022-02-21 19:12:27 +01:00
Thomas Haller f18bf17dea
wifi: cleanup ensure_hotspot_frequency()
wifi: choose a (stable) random channel for Wi-Fi hotspot

The channel depends on the SSID.

Based-on-patch-by: xiangnian <xiangnian@uniontech.com>

See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1054

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1099
2022-02-21 16:03:24 +01:00
Thomas Haller 365d0e49bc
NEWS: update NEWS file for 1.38 development 2022-02-16 11:11:24 +01:00
Lubomir Rintel 122070142d NEWS: update for 1.36-rc2 2022-02-10 12:29:52 +01:00
Lubomir Rintel dc9d932ecc NEWS: update for 1.36-rc1 2022-02-04 18:04:41 +01:00
Beniamino Galvani d68ab6b8f0 nm-sudo: rename to nm-priv-helper
The name "nm-sudo" reminds of the "sudo" tool, and this is a bit
confusing because it's not related. Rename the service to
"nm-priv-helper", which stands for "NM privileged helper".

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/938
2022-01-11 21:46:55 +01:00
Thomas Haller a2b26e26d9
NEWS: update 2021-11-19 11:16:01 +01:00
Thomas Haller 2cd1a22a78
NEWS: drop unstable warning for 1.34 2021-11-19 11:12:50 +01:00
Thomas Haller b0ac01a06e
NEWS: fix trailing whitespace and use full stop for news entries 2021-11-19 11:12:03 +01:00
Beniamino Galvani 4f52907beb NEWS: update 2021-11-18 16:51:19 +01:00
Ana Cabral c65815bf27 NEWS: update 2021-11-18 15:50:20 +01:00
Ana Cabral 69b6a48faa NEWS: update 2021-10-20 23:46:40 +02:00
Thomas Haller ab028c8eb9
NEWS: update 2021-10-17 10:41:31 +02:00
Thomas Haller 6b3862e39a
NEWS: update 2021-10-06 11:26:32 +02:00
Thomas Haller a44e5c3918
NEWS: add entries that were backported to 1.32 minor releases 2021-10-06 11:04:22 +02:00
Thomas Haller 7f25335767
NEWS: reorder entries from stable releases
Have the newest 1.32 stable release listed first. Then we can look at
the diff between the versions of the NEWS file and see whether they
agree.
2021-10-06 10:56:24 +02:00
Beniamino Galvani f2c7f28881 NEWS: update 2021-09-22 10:07:42 +02:00
Thomas Haller 4012c68365
NEWS: update 2021-07-28 17:47:45 +02:00
Thomas Haller c1ac20abb6
NEWS: update
Add the NEWS entries that were also present in 1.32.2 release.
2021-07-01 11:44:05 +02:00
Thomas Haller c76b15b45b
NEWS: update 2021-07-01 11:36:53 +02:00
Thomas Haller d06efa345f
NEWS: update 2021-06-23 20:33:36 +02:00
Thomas Haller 89af6be1d6
NEWS: belatedly add news entry for 1.32.0 2021-06-21 10:00:20 +02:00
Thomas Haller 35b0b4c938
NEWS: update 2021-06-16 20:14:47 +02:00
Thomas Haller 5286170fa8
NEWS: update 2021-06-16 20:12:07 +02:00
Thomas Haller 32bc29591c
NEWS: update 2021-06-16 16:26:15 +02:00
Beniamino Galvani e29d2f2200 NEWS: update 2021-06-16 15:30:02 +02:00
Thomas Haller 79d9441567
firewall: change default for firewall-backend to "nftables""
It seems that the nftables backend works well. Let's change the default.
This will also be backported to nm-1-32 branch, for 1.32.0 release.

This reverts commit 0609f1f31c.
2021-06-14 11:17:25 +02:00
Thomas Haller 0206642ec3
NEWS: update 2021-06-11 22:32:25 +02:00
Thomas Haller d18172bb2b
NEWS: update 2021-06-04 17:07:09 +02:00
Thomas Haller b4a7330629
NEWS: update 2021-06-04 13:52:27 +02:00
Beniamino Galvani fa832c6590 NEWS: update 2021-06-04 13:43:11 +02:00
Thomas Haller ebab9a32dc
NEWS: update 2021-06-04 10:11:51 +02:00
Thomas Haller 9784956442
NEWS: update 2021-06-04 10:04:26 +02:00
Thomas Haller 04ae0d905c
NEWS: update 2021-06-02 23:13:59 +02:00
Thomas Haller 48dce1b66c
core: drop deprecated PropertiesChanged D-Bus signal (API BREAK)
D-Bus 1.3.1 (2010) introduced the standard "PropertiesChanged" signal
on "org.freedesktop.DBus.Properties". NetworkManager is old, and predates
this API. From that time, it still had it's own PropertiesChanged signal
that are emitted together with the standard ones. NetworkManager
supports the standard PropertiesChanged signal since it switched to
gdbus library in version 1.2.0 (2016).

These own signals are deprecated for a long time already ([1], 2016), and
are hopefully not used by anybody anymore. libnm-glib was using them and
relied on them, but that library is gone. libnm does not use them and neither
does plasma-nm.

Hopefully no users are left that are affected by this API break.

[1] 6fb917178a
2021-05-14 10:57:34 +02:00
Thomas Haller 207cf3d5d4
libnm: normalize "connection.uuid"
For NetworkManager profiles, "connection.uuid" is the identifier of the
profile. It is supposed to be a UUID, however:

- the UUID was not ensured to be all-lower case. We should make sure
  that our UUIDs are in a consistent manner, so that users can rely
  on the format of the string.

- the UUID was never actually interpreted as a UUID. It only was some
  opaque string, that we use as identifier. We had nm_utils_is_uuid()
  which checks that the format is valid, however that did not fully
  validate the format, like it would accept "----7daf444dd78741a59e1ef1b3c8b1c0e8"
  and "549fac10a25f4bcc912d1ae688c2b4987daf444d" (40 hex characters).

Both invalid UUIDs and non-normalized UUID should be normalized. We
don't want to break existing profiles that use such UUIDs, thus we don't
outright reject them. Let's instead mangle them during
nm_connection_normalize().
2021-05-04 15:51:59 +02:00
Thomas Haller 40032f4614
cli: fix resetting values via property alias
Property aliases should really just be shortcuts for one fully spelled
out property (sometimes, they do more like "master").

Anyway, we must also handle resetting the value, otherwise:

  $ nmcli connection add type gsm apn ""

will still result in "gsm.apn=internet", unlike

  $ nmcli connection add type gsm gsm.apn ""
2021-05-03 10:11:23 +02:00
Beniamino Galvani 8d491482ae NEWS: update 2021-04-22 21:44:03 +02:00