Commit graph

256 commits

Author SHA1 Message Date
Thomas Haller
587f5afb5a
all: differentiate NM_CLONED_MAC_IS_SPECIAL() for wired/wireless
Will be used next, when we support "stable-ssid" for
"wifi.cloned-mac-address" property.
2023-11-16 13:07:53 +01:00
Thomas Haller
901a1b096b
core: support "${NETWORK_SSID}" for connection.stable-id
For Wi-Fi profiles, this will encode the SSID in the stable-id.
For other profiles, this encodes the connection UUID (but the SSID and
the UUID will always result in distinct stable IDs).

Also escape the SSID, so that the generated stable-id is always valid
UTF-8.
2023-11-16 13:07:53 +01:00
Thomas Haller
36629ae710
libnm: rename "ethtool.eee" property to "ethtool.eee-enabled"
There are various properties related to EEE, that we might want to add
support for in the future (for example, "ethtool.eee-advertise").

Don't use up the base name "eee", instead make it "eee-enabled". All
properties should have different prefixes, and "ethtool.eee" would be a
prefix of "ethtool.eee-advertise".

Also, the #define is already called NM_ETHTOOL_OPTNAME_EEE_ENABLED. This
also should be consistent.

Rename.

Fixes: 3165d9a2de ('ethtool: introduce EEE support')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1792
2023-11-15 09:36:29 +01:00
Thomas Haller
38ad9e5211
cli: sort nmcli device output by active-connection first
Previously, we first sort by the device's state, then by the active
connection's state. Contrast to `nmcli connection`, which first sorts
by the active connection's state.

It means, the sort order is somewhat different. Fix that.

In most cases, that shouldn't make a difference, because the
device's state and the active-connection's state should
correspond. However, it matters as we now treat external activations
different, and that is tied to the active connection.
2023-11-15 09:34:47 +01:00
Thomas Haller
a5f9f2fbfc
cli: sort external connections later in nmcli connection|device
EXTERNAL connections are special. Sort them later. This affects output
of `nmcli connection` and `nmcli device`.
2023-11-15 09:34:47 +01:00
Thomas Haller
8ccd1f7bfe
cli: refactor active_connection_get_state_ord()
Additional logic will be added, that makes the switch() approach
more cumbersome. Use a sorted array instead to find the priority.
2023-11-15 09:34:46 +01:00
Thomas Haller
8e1330964d
cli: fix sorting of active connections
CMP() is a confusing pattern. Sure enough, the sort order was wrong, for
example, `nmcli connection` would show

    $ nmcli -f STATE,UUID,DEVICE c
    STATE       UUID                                  DEVICE
    activating  3098c902-c59c-45f4-9e5a-e4cdb79cfe1b  nm-bond
    activated   e4fc23ac-54ab-4b1a-932a-ebed12c96d9b  eth1

("activating" shown before "activated").

With `nmcli device`, we sort with compare_devices(). This first sorts by
device state (with "connected" being sorted first). Only when the device
state is equal, we fallback to nmc_active_connection_cmp().  So with
`nmcli device` we usually get "connected" devices first, and we don't
really notice that there is a problem with nmc_active_connection_cmp().

On the other hand, `nmcli connection` likes to sort first via
nmc_active_connection_cmp(), which gets it wrong. Profiles in
"activating" state are sorted first. That's inconsistent with `nmcli
device`, but it's also not what is intended.

Fix that.

Note the change in the test output. Both eth1 and eth0 are connected to
to the same profile, but one "eth0" the active-connection's state is
DEACTIVATING, while on "eth1" it's ACTIVATED (but both device's states
are "CONNECTED"). That's why "eth1" is now sorted first (as desired).

Fixes: a1b25a47b0 ('cli: rework printing of `nmcli connection` for multiple active connections')
2023-11-15 09:34:46 +01:00
Thomas Haller
b4dd83975e
all: use NM_MIN() instead of MIN() 2023-11-15 09:32:20 +01:00
Thomas Haller
6f4a60b6f2
all: ensure same signedness of arguments to MIN()/MAX()
Comparing integers of different signedness gives often unexpected
results. Adjust usages of MIN()/MAX() to ensure that the arguments agree
in signedness.
2023-11-15 09:32:18 +01:00
Íñigo Huguet
539d6f436a
gen-metadata-nm-settings-nmcli: fix some printf warnings on 32 bit platforms
The specifiers %ld and %lu are not correct for 64 bit integers on 32 bit
platforms, triggering a warning. Use instead the GLib constants to
correctly define them.

Fixes: 925d4df801 ('man nm-settings-nmcli: add "Valid values" field')
Fixes: 5c6ae44e00 ('man nm-settings-nmcli: add "Special values" field')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1790
2023-11-14 19:14:12 +01:00
Thomas Haller
832065b6e6
libnm/docs: fix generated documentation
Fixes: 82e2eeeb2a ('libnm/docs: clarify default `ipv4.dhcp-client-id` generated by nettools/internal DHCP plugin')
2023-11-14 12:51:22 +01:00
Johannes Zink
3165d9a2de ethtool: introduce EEE support
Some Applications require to explicitly enable or disable EEE.
Therefore introduce EEE (Energy Efficient Ethernet) support with:

 * ethtool.eee on/off

Unit test case included.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
2023-11-03 15:41:21 +00:00
Thomas Haller
0554ef3808
all: use nm_g_array_index() instead of g_array_index()
nm_g_array_index() performs additional nm_assert() checks for
correctness.

In this case, it's pretty clear that the assertion will hold and that
the code is correct. Note that most of the time when having assertions,
we expect that they hold. Since nm_assert() is disabled in release
build, arguing that an assertion holds is not a strong argument against
having the assert (they are always supposed to hold, quite obviously so!).

The reason to change is that we should use the wrappers that perform
additional checks. Especially when the additional checks are nm_assert()
or static-asserts, as they are not present in release builds. To find
how well we are doing in this regard we can check `git grep -w
g_array_index`. If that gives many uses of the unchecked function, then
we cannot manually check them all to be really obviously correct.
Instead, we should not use g_array_index() and trivially see that all
array accesses are guarded by assertions.

"checkpatch.pl" also recommends against g_array_index().
2023-10-30 17:15:06 +01:00
Beniamino Galvani
80dd179ffd libnm: add ethtool channels properties
ethtool "channels" parameters can be used to configure multiple queues
for a NIC, which helps to improve performances. Until now, users had
to use dispatcher scripts to change those parameters. Introduce native
support in NetworkManager by adding the following properties:

 - ethtool.channels-rx
 - ethtool.channels-tx
 - ethtool.channels-other
 - ethtool.channels-combined
2023-10-18 06:53:07 +00:00
Beniamino Galvani
55d31ab11d ethtool: fail build on missing handling of ethtool types
Convert the open-coded conditions to a switch/case so that the
compilation will fail if a new ethtool type is added and is not
handled in various places.
2023-10-18 06:53:07 +00:00
Íñigo Huguet
123ca26770 nmcli: don't warn version mismatch with daemon not running
Fixes: fb851f3294 ('nmcli: warn if daemon version mismatch')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1750
2023-10-18 08:13:22 +02:00
Íñigo Huguet
c794363ce9 dhcp: document the new ipv4.dhcp-client-id special value "none"
Also, improve the explanation about what happens when no default value
is set, and the client-id value is left dependant on the plugin.
2023-10-18 08:01:09 +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
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
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
Íñigo Huguet
f4fbc59a16 man nm-setting-*: proper format for gtkdoc constants
Gtkdoc comments are used, among other things, to generate the various
nm-setting-* manual pages. When a constant is referenced in a gtkdoc
comment (i.e. `%NM_IP_TUNNEL_MODE_IPIP`) it is expanded to show the C name
and the value (i.e. `NM_IP_TUNNEL_MODE_IPIP (1)`). To generate the
nm-setting-* manual pages, we don't use gtkdoc, but we process this data
with the custom script tools/generate-docs-nm-settings-docs-gir.py.
This script was expanding the constants in the same way than gtkdoc.

Showing the constants in that way in nm-setting-* manual pages makes
little sense, because users are not going to use the C identifiers.
Let's show them with a more appropriate format.

Additionally, the different nm-setting-* pages might require different
formats than the other. For example, for nm-setting-nmcli a format like
`"ipip" (1)` is prefered, but for nm-setting-dbus it's better
`1 (ipip)`. Let's generate different nm-settings-docs-gir-*.xml files for
nmcli, dbus, keyfile and ifcfg-rh, using the right format for each one.
2023-09-21 15:57:35 +02:00
Íñigo Huguet
5c6ae44e00 man nm-settings-nmcli: add "Special values" field
If there are properties that accept special values apart from the
normally accepted values, or any of those values has an special meaning,
it can be shown as "Special value", indicating the nicknames and numbers
that can be used to select it.
2023-09-21 15:57:35 +02:00
Íñigo Huguet
925d4df801 man nm-settings-nmcli: add "Valid values" field
Show a new field called "Valid values" in those properties that only
accept a limited set of values, like enums, ints with a valid range of
values, etc.

As there is some complex logic behind getting this information, this
logic has been put in nm-meta-setting-desc and nm-enum-utils so they can
be re-used, avoiding duplicity and errors. Some refactor has been done
in nm-meta-setting-desc in this direction, too.
2023-09-21 15:57:35 +02:00
Íñigo Huguet
af5c1c8019 man nm-settings-nmcli: autogenerate the "Format" field
Instead of deducing the type from the GLib's types, use the properties'
metadata available in nm-meta-setting-desc.c which is the most accurate
representation of what the expected input from the user is.
2023-09-21 15:57:35 +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
Íñ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
2115032869 nmcli: show bandwidth on wifi device output
Example output:

```
NAME:                                   AP[3]
SSID:                                   testX
SSID-HEX:                               4D4F5649535441525F504C55535F32453037
BSSID:                                  80:78:71:90:2E:15
MODE:                                   Infra
CHAN:                                   104
FREQ:                                   5520 MHz
RATE:                                   540 Mbit/s
BANDWIDTH:                              40 MHz
SIGNAL:                                 32
BARS:                                   ▂▄__
SECURITY:                               WPA2
WPA-FLAGS:                              (none)
RSN-FLAGS:                              pair_ccmp group_ccmp psk
DEVICE:                                 wlp0s20f3
ACTIVE:                                 yes
IN-USE:                                 *
DBUS-PATH:                              /org/freedesktop/NetworkManager/AccessPoint/3
```
2023-08-02 00:54:32 +02:00
Frederic Martinsons
ac327cb855 nmcli: avoid freeing NULL GString and correct error message
Fixes #1362

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-07-31 13:01:20 +02:00
Jan Vaclav
16f3e64307 nmcli: replace occurrences of master/slave with controller/port in internal code
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1334
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1697
2023-07-25 14:18:22 +02:00
Íñigo Huguet
d414265ab1 nmcli: fix endless loop with --offline --ask
If --offline and --ask were used at the same time, and endless loop
showing the readline's prompt but without waiting for user's input
happened.

This was because when using --offline, all arguments are parsed and
resolved before running the g_main_loop. In nmc_readline_helper it was
checked that the main loop is running, so if g_main_loop_quit is called
we can stop waiting for user's input.

Fix this bug by continue polling for user input if the main loop is
running or if we are in offline mode.  Cancelling the user input is
still possible both in normal and offline mode with Ctrl+C or Ctrl+D.

Added a test case to verify that this still works after future changes.
2023-07-17 12:58:07 +02:00
Íñigo Huguet
5490604084 nmcli: move offline flag from NmCli to NmcConfig struct
This flag is a setting that changes the behaviour of nmcli, it's not
only the current state of the program, so it makes more sense to put it
in NmcConfig than in NmCli.

Furthermore, it's needed to fix a bug in next commit, too.
2023-07-17 12:56:03 +02:00
Thomas Haller
cbbf5fed49
libnm/docs: better descripe "ipv[46].dns-options" in man nm-settings-nmcli 2023-06-12 10:01:23 +02:00
Thomas Haller
5e3e38f291
ifcfg: better handle non-full-membership PKEY_ID with new PKEY_ID_NM variable
Infiniband profiles can have a p-key set. Both in kernel API
("create_child" sysctl) and in NetworkManager API, that key can range
from 0x0001 to 0xFFFF (0x8000 excluded). NetworkManager does not support
renaming the interface, so kernel always assigns the interface name
"$PHYSDEV.$PKEY_ID" (with $PKEY_ID as 4 character hex digits).

Note that the highest bit in the p-key (0x8000) is the full-membership
flag. Internally, kernel only supports full-membership so when we create
for example "ib0.00c1" and "ib0.80c1" interfaces, their actually used
p-key is in both cases 0x80c1 and you can see it with `ip -d link`.
Nonetheless, kernel and NetworkManager allow to configure the p-key
without the highest bit set, and the result differs in the interface
name.

Note that initscripts' ifup-ib0 would always internally coerce the
PKEY_ID variable to have the high bit set ([1]). It also would require
that the `DEVICE=` variable is specified and matches the expected
interface name. So both these configurations are identical and valid:

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x80c1

and

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x00c1

Historically, NetworkManager would also implement the same restrictions
([2], [3], [4]). That meant, not all valid NetworkManager infiniband
profiles could be expressed as  ifcfg file. For example, NetworkManager
allows to have "connection.interface-name" (`DEVICE=`) unset (which
ifup-ib and ifcfg reader did not allow). Also, NetworkManager would
allow configuring a "infiniband.p-key" without full membership flag, and
the reader would mangle that.

This caused various problems to the point that when you configure an
infiniband.p-key with a non-full-membership key, the ifcfg-rh written by
NetworkManager was invalid. Either, you could leave
"connection.interface-name" unset, but then the reader would complain
about missing `DEVICE=`. Or, we could write `DEVICE=ib0.00c1;
PKEY_ID=0x00c1`, which was invalid as we expected `DEVICE=ib0.80c1`.

This was addressed by rhbz 2122703 ([5]). The fix was to

  - not require a `DEVICE=` ([6]).
  - don't mangle the `PKEY_ID=` in the reader ([7]).

which happened in 1.41.2 and 1.40.2 (rhel-8.8).

With this change, we could persist any valid infiniband profile to ifcfg
format. We also could read back any valid ifcfg file that NetworkManager
would have written in the past (note that it could not write valid ifcfg
files previously, if the p-key didn't have the full-membership key set).

The problem is, that users were used to edit ifcfg files by hand, and
users would have files with:

  DEVICE=ib0.80c1
  PHYSDEV=ib0
  PKEY_ID=0x00c1

This files had worked before, but now failed to verify as we would
expect `DEVICE=ib0.00c1`. Also, there was a change in behavior that
PKEY_ID is now interpreted without the high bit set. This is reported as
rhbz 2209164 ([8]).

We will do several things to fix that:

1) we now normalize the "connection.interface-name" to be valid. It was
  not useful to set it anyway, as it was redundant. Complaining about a
  redundant setting, which makes little sense to configure, is not useful.
  This is done by [9].

2) we now again treat PKEY_ID= as if it had 0x8000 flag set. This was done by
  [10].

With step 1) and 2), we are able to read any existing ifcfg files out
there in the way we did before 1.41.2.

There is however one piece missing. When we now create a profile using
nmcli/libnm/D-Bus, which has a non-full-membership p-key, then the
profile gets mangled in the process.

If the user uses NetworkManager API to configure an interface and
chooses a non-full-membership p-key, then this should work the same as
with keyfile plugin (or on rhel-9, where keyfile is the default). Note
that before 1.41.2 it didn't work at all, when the user used ifcfg-rh
backend. Likely(?) there are no users who rely on creating such a profile
with nmcli/libnm/D-Bus and expect to automatically have the p-key
normalized. That didn't work before 1.41.2 and didn't behave that way
between 1.41.2 and now.

This patch fixes that by introducing a new key PKEY_ID_NM= for holding
the real p-key. Now ifcfg backend is consistent with handling infiniband
profiles, and old, hand-written ifcfg files still work as before.

There is of course change in behavior, that ifcfg files between 1.41.2
and now were interpreted differently. But that is bug 2209164 ([8]) and
what we fix here.

For now strong reasons, we keep writing the PKEY_ID to file too. It's
redundant, but that is what a human might expect there.

[1]  05333c3602/f/rdma.ifup-ib (_75)
[2]  https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/1.40.0/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c#L5386
[3]  cb5606cf1c (a7a78fccb2c8c945fd09038656ae734c1b0349ab_3493_3532)
[4]  cb5606cf1c (a7a78fccb2c8c945fd09038656ae734c1b0349ab_3493_3506)
[5]  https://bugzilla.redhat.com/show_bug.cgi?id=2122703
[6]  4c32dd9d25
[7]  a4fe16a426
[8]  https://bugzilla.redhat.com/show_bug.cgi?id=2209164
[9]  4610fd67e6
[10] f8e5e07355
2023-06-05 10:38:01 +02:00
Thomas Haller
ea18e66ef6
libnm/docs: clarify behavior of infiniband.p-key property 2023-05-25 14:55:46 +02:00
Thomas Haller
30a6742d96
cli: fix offline mode for parsing "connection.secondaries"
$ nmcli --offline connection add type ethernet con-name x connection.secondaries foo

  (process:48855): nm-CRITICAL **: 09:16:03.051: nm_client_get_connections: assertion 'NM_IS_CLIENT(client)' failed
  **
  nm:ERROR:src/nmcli/common.c:437:nmc_find_connection: assertion failed: (connections)
  Bail out! nm:ERROR:src/nmcli/common.c:437:nmc_find_connection: assertion failed: (connections)
  Aborted (core dumped)
2023-05-22 19:18:20 +02:00
Thomas Haller
63cc5b3104
docs: don't generate <description> tag in "gen-metadata-nm-settings-nmcli"
"gen-metadata-nm-settings-nmcli" previously printed the <description>.
But that tag is not very useful for further processing.

For the most part it itself comes from "src/libnmc-setting/settings-docs.h",
which is generated (but lost formatting information already to be
suitable for where it's used).

Some parts are original texts from "src/libnmc-setting/nm-meta-setting-desc.c",
like TEAM_DESCRIBE_MESSAGE. However those text are also not really suitable
for any other purpose.

Rename the tag, so that the tools that process "gen-metadata-nm-settings-nmcli.xml"
don't use it.

The file "gen-metadata-nm-settings-nmcli.xml" is currently only used to
generate "man/nm-settings-docs-nmcli.xml", and that file slightly
changes with this patch. However, the manual page which is generated by
"man/nm-settings-docs-nmcli.xml" does not change.
2023-05-19 12:52:00 +02:00
Thomas Haller
5d58792848
libnm: add nmcli specific documentation override for "ipv6.addr-gen-mode" 2023-05-19 12:51:59 +02:00
Thomas Haller
92e32c4b7a
libnm/docs: reword documentation for "ipv6.{addr-gen-mode,token}" 2023-05-19 12:51:58 +02:00
David Woodhouse
715921a1fd nmcli, nmtui: reduce duplication around openconnect auth helper
Pull a bunch of stuff into nm_vpn_openconnect_authenticate_helper() that
both callers were doing for themselves, and make its API a bit simpler.
It's given the NMSettingVpn and the GPtrArray of secrets, and it simply
succeeds or fails.
2023-05-11 13:15:53 +01:00
David Woodhouse
f8d82c7f10 nmcli, nmtui: update authentication for OpenConnect
Since OpenConnect 8.20, 'openconnect --authenticate' will return the
full gateway URL, including the hostname and the path. This allows
servers behind SNI-based proxies to work. To ensure we end up at the
same IP address even behind round-robin DNS, there is a separate
--resolve argument.

Update nmcli/nmtui to use this, as NetworkManager-openconnect does.

Shift some of the logic into the nm_vpn_openconnect_authenticate_helper()
function instead of duplicating it in the callers.

Also, pass the correct protocol in rather than only supporting Cisco
AnyConnect.
2023-05-11 13:15:53 +01:00
Fernando Fernandez Mancera
2f0571f193 bonding: add support to prio property in bond ports
Add per port priority support for bond active port re-selection during
failover. A higher number means a higher priority in selection. The
primary port still has the highest priority. This option is only
compatible with active-backup, balance-tlb and balance-alb modes.
2023-05-03 10:44:06 +02:00
Marc Muehlfeld
0cb43c9e42
man: rewrite ipv4.method and ipv6.method man page descriptions
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1275

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1611
2023-04-27 09:09:11 +02:00
Thomas Haller
21cf2dc58f
libnm,core: make "default${CONNECTION}" the built-in stable ID
The "connection.stable-id" supports placeholders like "${CONNECTION}" or
"${DEVICE}".

The stable-id can also be specified in global connection defaults in
NetworkManager.conf, by leaving it unset in the profile. Global
connection defaults always follow the pattern, that they correspond to a
per-profile property, and only when the per-profile value indicates a
special default/unset value, the global connection default is consulted.
Finally, if the global connection default is also not configured in
NetworkManager.conf, a built-in default is used (which may not be
constant either, for example ipv6.ip6-privacy's built-in default depends
on a sysctl value).

In any case, every possible configuration that can be achieved should be
configurable both per-profile and via global connection default. That
was not given for the stable-id, because the built-in default generated
an ID in a way that could not be explicitly expressed otherwise.

So you could not:
- explicitly set the per-profile value to the built-in default, to avoid
  that the global-connection-default overwrites it.
- explicitly set the global-connection-default to the built-in default,
  to avoid that a lower priority [connection*] section overwrites the
  stable-id again.

Fix that inconsistency to make it possible to explicitly set the
built-in default.

Change behavior for literally "default${CONNECTION}" and make it behave
as the built-in default. Also document that the built-in default has that
value.

It's unlikely that this breaks an existing configuration, but of course,
if any user configured "connection.stable-id=default${CONNECTION}", then
the behavior changes for them.
2023-04-21 12:49:18 +02:00
Beniamino Galvani
f9c1d06e64 libnm,nmcli: add ipv6.dhcp-pd-hint property
Add a new property to specify a hint for DHCPv6 prefix delegation.
2023-04-03 16:04:55 +02:00
Thomas Haller
6043910bff
doc: use "Returns:" annotation instead of deprecated aliases 2023-03-29 11:46:48 +02:00
Thomas Haller
98dd4180ec
all: various fixes to gtk-doc annotations
- drop annotations from "@error" which has defaults.

- ensure all annotations are on the same line. That's useful
  when searching for an annotation, to find the line that specifies
  the argument name.

- convert a few plain docs into gtkdoc annotations.
2023-03-29 11:46:48 +02:00
Fernando Fernandez Mancera
9d4bbf78f0 dns: add support to no-aaaa option
Users can set `no-aaaa` DNS option to suppress AAAA queries made by the
stub resolver, including AAAA lookups triggered by NSS-based interfaces
such as getaddrinfo. Only DNS lookups are affected.
2023-03-28 12:53:58 +02:00
Beniamino Galvani
231128d28d nmcli: increase strength of generated hotspot passwords
The password currently generated has ~48 bits of entropy; increase the
length from 8 to 12 to get ~70 bits. While at it, exclude characters
that look similar and might be entered wrongly by users.
2023-03-28 09:58:29 +02:00
Beniamino Galvani
e446d2b632 nmcli: don't set a fixed channel for wifi hotspots
Since commit f18bf17dea ('wifi: cleanup
ensure_hotspot_frequency()'), NetworkManager automatically selects a
stable channel for AP connections that don't specify a fixed one. The
advantage of this approach is that NM can select a channel that works
well in the current regulatory domain.

However, nmcli still sets fixed channels 1 for 2.4GHz and 7 for 5GHz
when using the "device wifi hotspot". In particular, channel 7 on 5GHz
seems a bad choice because according to [1] it is not usable anywhere
in the world.

It seems difficult to select channel that works everywhere in the 5GHz
band, so it's better to not set a channel in the profile and let NM
find a usable one. For consistency, do the same also for the 2.4GHz
band even if the default choice (channel 1) should always work; by
letting NM choose a channel, different hotspot created with nmcli have
the chance of using different bands and not interfere with each other.

[1] https://en.wikipedia.org/wiki/List_of_WLAN_channels
2023-03-28 09:46:11 +02:00