Commit graph

661 commits

Author SHA1 Message Date
Alex Henrie 6cb14ae6a6 device: introduce ipv6.temp-valid-lifetime and ipv6.temp-preferred-lifetime properties
When IPv6 privacy extensions are enabled, by default temporary addresses
have a valid lifetime of 1 week and a preferred lifetime of 1 day.
That's far too long for privacy-conscious users, some of whom want a new
address once every few seconds. Add connection options that correspond
to /proc/sys/net/ipv6/conf/*/temp_valid_lft and
/proc/sys/net/ipv6/conf/*/temp_prefered_lft to allow configuring the
address rotation time on a per-connection basis.

The new properties are defined as 32-bit signed integers to match the
sysctl parameters which are also signed, although currently only
positive numbers are valid.
2024-03-20 23:46:32 -06:00
Alex Henrie 797f3cafee device: fall back to saved use_tempaddr value instead of rereading /proc
There may be a per-interface default set by the sysctl
net.ipv6.conf.<iface>.use_tempaddr that is different than
net.ipv6.conf.default.use_tempaddr.
2024-03-20 23:42:22 -06:00
Fernando Fernandez Mancera ac4e63ddda ip: support dhcp-send-release in NMSettingIpConfig
Introduce a new option to NMSettingIpConfig. The new option is ternary
type being the default value set to disabled. When enabled,
NetworkManager will instruct the DHCP client to send RELEASE message
when IP addresses are being removed.
2024-03-06 11:14:16 +01:00
Fernando Fernandez Mancera bd38a19832 connection: add support to down-on-poweroff
The new option at NMSettingConnection allow the user to specify if the
connection needs to be down when powering off the system. This is useful
for IP address removal prior powering off. In order to accomplish that,
we listen on "Shutdown" systemd DBus signal.

The option is set to FALSE by default, it can be specified globally on
configuration file or per profile.
2024-03-04 18:16:54 +00:00
Beniamino Galvani d72f26b875 dispatcher: read device-handler's stdout into a dictionary
Device handlers need a way to pass data back to NetworkManager, such
as the ifindex and an error message. Allow them to return a dictionary
on standard output, where each line contains a "$key=$value" pair.
In the daemon, the dictionary is returned via the callback function.
2024-02-21 11:16:04 +01:00
Beniamino Galvani e686ab35b3 libnm: add generic.device-handler property
Add a new "generic.device-handler" property that specifies the name of
a dispatcher script to be invoked to add and delete the interface for
this connection.
2024-02-21 11:16:01 +01:00
Beniamino Galvani d7c311eb85 dispatcher: pass user setting properties in the environment
Properties in the "user" setting are a convenient way to associate any
kind of user-provided metadata to connections.

However, nmcli doesn't support the user setting at the moment and
adding this feature requires a significant effort. Without nmcli
support, dispatcher scripts can only access user properties by either
parsing connection files or by using D-Bus (with or without libnm and
GObject introspection). Since both these solutions are not very
convenient, provide an alternative way: pass the properties as
environment variables.
2024-02-21 11:15:24 +01:00
Beniamino Galvani 010c54dce9 macsec: support the offload property 2024-02-21 10:51:57 +01:00
Beniamino Galvani d920b48a5f initrd: add support for rd.net.dhcp.dscp property
Add a new kernel command line option, so that the DSCP value can by
changed even in early boot.
2024-02-06 14:24:40 +01:00
Beniamino Galvani 3cf6a805ba device: support the DHCP DSCP property 2024-02-06 14:24:39 +01:00
Thomas Haller 1128bceab9
doc: clarify limitation of parsing values in "NetworkManager.conf"
This really should be fixed, because it's a non-obvious limitation.
Anyway, document it for now.
2024-01-29 09:50:37 +01:00
Thomas Haller fa503e402d
doc: clarify default for "connection.mdns" in manual
The default in systemd-resolved is nowadays "yes". In any case, since
the setting is configurable systemd-resolved, don't describe it in the
manual page.

Instead, clarify the behavior and try to improve the documentation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1467
2024-01-29 09:50:29 +01:00
Fernando Fernandez Mancera 6576ddc532 config: drop slaves-order config option
This option was only introduced only to allow keeping the old behavior
in RHEL7, while the default order was changed from 'ifindex' to 'name'
in RHEL8. The usefulness of this option is questionable, as 'name'
together with predictable interface names should give predictable order.
When not using predictable interface names, the name is unpredictable
but so is the ifindex.

https://issues.redhat.com/browse/NMT-926

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1814
2023-12-12 15:28:52 +01:00
Jan Vaclav ffb34d2485 build/meson: fix gtkdoc dependencies
This commit fixes the build process for the documentation that was previously
unable to build separately via meson due to a dependency issue.

Previously, trying to build the API documentation via `ninja NetworkManager-doc`
failed due to missing dependencies (for example, `nm-dbus-types.xml` was not built).
I believe this happens due to some different handling of static paths vs. custom_target
by meson in this case.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1801
Fixes: 03637ad8b5 ('build: add initial support for meson build system')
2023-11-24 07:40:44 +00:00
Íñigo Huguet 5481ba1568 Add more detailed explanations for users, contributors and maintainers
README.md:

As this document is mainly for normal users, and in Gitlab it's
displayed by default, it's the main entry point to get information when
someone get into the repo, either via web or cloned.

Added explanations about how to install and use NM and how to find the
documentation for users. Added brief info about how to report issues
and ask for help, with links to CONTRIBUTING.md to get more details.

Added brief link for potential contributors to read CONTRIBUTING.md.
People not familiar with open source projects might not be aware of it.

Deleted the "moved to freedesktop" message. After 15 years, people might
know yet.

Added brief explanation about the free software license.

CONTRIBUTING.md:

Added a link to the list of all communication channels, only mailing
list and IRC were listed.

Added detailed explanation about how to report issues and attach logs.
It also references the new tool anonymize-logs.py.

Added brief guidelines about how to start contributing choosing issues
from the tracker.

Fixed some small formatting issues and added a reference to nm-in-vm,
fixing the link to nm-in-container too.

MAINTAINERS.md:

Added explanation about how to triage and properly label the issues.
This is basically based on the kind-of-workflow that we already have,
but maybe it's a good time to check that it's correct or to propose
small changes (so, please propose changes in review).
2023-11-24 07:40:08 +00:00
Thomas Haller 86db3df6ac
core: honor ID_NET_MANAGED_BY="org.freedesktop.NetworkManager" to manage device
If ID_NET_MANAGED_BY= attribute is set, we have an indication who is
responsible for the device. If this is set to anything but
"org.freedesktop.NetworkManager", then the device is unmanaged.

The effect is the same as setting NM_UNMANAGED= attribute. NM_UNMANAGED=
takes precedence over this setting.

See-also: https://github.com/systemd/systemd/issues/29768
See-also: https://github.com/systemd/systemd/pull/29782
2023-11-02 10:55:03 +01:00
Thomas Haller 74cb240040
man: document "ID_NET_DHCP_BROADCAST" udev property
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1414
2023-11-02 10:55:02 +01:00
Thomas Haller 36fb335b28
device/ethernet: honor ID_NET_AUTO_LINK_LOCAL_ONLY udev property
We honored "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY" udev property, for when we
generate a "Wired connection 1" (aka the "auto-default connection").

Systemd now also honors and may set ID_NET_AUTO_LINK_LOCAL_ONLY for
a similar purpose. Honore that too.

The NM specific variable still is preferred, also because "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY"
is about something very NetworkManager specific (controlling "Wired connection 1").

Maybe one day, we should drop "data/90-nm-thunderbolt.rules" and only
rely on what systemd provides. But not yet.

See-also: https://github.com/systemd/systemd/pull/29767
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1413
2023-11-02 10:48:19 +01: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 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
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
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 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 984642e33f build: meson: fix some missing dependencies
Some targets related to documentation generation had missing
dependencies, like xsl templates or the python generator. If these files
are changed, their output changes too, but as they were not listed as
dependencies (custom_target's input), meson wasn't aware.

In Makefile.am they already were correctly listed as dependencies.
2023-09-21 15:57:35 +02: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 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
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
Fernando Fernandez Mancera a44f20c985 man: adjust references of nm-settings to nm-settings-nmcli
nm-settings was renamed to nm-settings-nmcli therefore we should rename
all the references to nm-settings-nmcli.
2023-08-01 14:21:23 +02:00
Thomas Haller ad6064e4e8
man: fix typo in "NetworkManager.conf" manual 2023-07-27 21:37:22 +02:00
Thomas Haller bba0d553b1
man: clarify relation of "dns.systemd-resolved" setting with "dns" 2023-07-27 21:10:11 +02:00
Beniamino Galvani 52cca91dd2 build,core: add a "main.migrate-ifcfg-rh" configuration option
The option enables automatic migration of ifcfg-rh connection profiles
to keyfile. The default value can be configured at build time.
2023-07-25 15:39:06 +02:00
Thomas Haller ad4e068bfd
cloud-setup/man: add DEBUGGING section to man nm-cloud-setup 2023-06-29 17:41:13 +02:00
Thomas Haller e9426e6d07
keyfile: add a NetworkManager.conf option "keyfile.rename"
The default behavior is not to rename profiles. I guess, that makes
sense, as renaming a file when changing the "connection.id" could break
users who rely on the name.

My use case is the following. When I connect a Wi-Fi hotspot I use
`nmcli device wifi connect $SSID`, which -- as expected -- persists the
profile to "/etc/NetworkManager/system-connections/$SSID.nmconnection".
Later, I always update the profile's name to "w_$SSID" so I can see on
the name that this is wireless profile. I also want the filename to
reflect that change of name.

Add a configuration option for that. All the infrastructure
("force_rename" parameter) already exists.
2023-06-29 14:05:27 +02:00
Beniamino Galvani e96bb430e2 ifcfg-rh: fail to save connections with the 'link' setting
Fail to save a connection with a 'link' setting instead of just
ignoring it. Now:

  $ nmcli connection add type ethernet ifname foobar
  Connection 'ethernet-foobar' (c3f6f067-e1d5-4bb1-8d67-e09109253a79) successfully added.

  $ nmcli connection modify ethernet-foobar link.tx-queue-length 1234
  Error: Failed to modify connection 'ethernet-foobar': failed to update connection: The ifcfg-rh plugin doesn't support setting 'link'. If you are modifying an existing connection profile saved in ifcfg-rh format, please migrate the connection to keyfile using 'nmcli connection migrate c3f6f067-e1d5-4bb1-8d67-e09109253a79' or via the Update2() D-Bus API and try again.

  $ nmcli connection migrate c3f6f067-e1d5-4bb1-8d67-e09109253a79
  Connection 'ethernet-foobar' (c3f6f067-e1d5-4bb1-8d67-e09109253a79) successfully migrated.

  $ nmcli connection modify ethernet-foobar link.tx-queue-length 1234
  $

Fixes: 39bfcf7aab ('all: add "link" setting')
2023-06-29 10:18:09 +02:00
Beniamino Galvani 8645d34dd1 man: update list of settings not supported by ifcfg-rh 2023-06-29 10:15:48 +02:00
Beniamino Galvani 3ad7e4b7e6 build,man: document ifcfg-rh as deprecated
Document the ifcfg-rh settings plugin as deprecated, as announced in:

https://lists.freedesktop.org/archives/networkmanager/2023-May/000103.html
2023-06-29 10:15:48 +02:00
qyecst 7aebda5631
man: fix description of environment variable NM_CONFIG_ENABLE_TAG
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1670
2023-06-26 09:09:53 +02:00
Thomas Haller 7f9db1a290
man: minor rewording in "NetworkManager.conf" manual
Just a comma actually.
2023-06-05 20:59:39 +02:00
Thomas Haller cba7c0ded5
man: fix XSL for documentation after <description> element change
<description> is now an XML element, no longer an attribute. Fix the
style sheets.

Fixes: 89abede3df ('docs: rework generating property infos to use <description> element')
2023-05-31 11:27:09 +02:00
Thomas Haller b7d0218ee1
docs: rework selecting properties with "generate-docs-nm-settings-docs-merge.py"
"generate-docs-nm-settings-docs-merge.py" merges properties from
multiple XMLs. It supported an argument "--only-from-first", to
only select properties that were in the first of the provided XMLs.

The idea is that the first XML would be "src/nmcli/gen-metadata-nm-settings-nmcli.xml"
which is generated from nmcli meta-data and exactly describes the
supported properties. For example, "connection.read-only", "user.data"
or "wireless.tx-power" exist as properties somewhere, but not supported
by nmcli.

Change that, to not tie the selected property to the first XML.
"gen-metadata-nm-settings-nmcli.xml" is the XML that contains which
properties to select from, but "src/libnm-client-impl/nm-property-infos-nmcli.xml"
contains hand crafted descriptions. The latter descriptions are
preferred. As the order of the XML is already relevant for which
description is preferred, the selection is orthogonal to that.

With this, prefer descriptions from "src/libnm-client-impl/nm-property-infos-nmcli.xml"
but still select properties from "src/nmcli/gen-metadata-nm-settings-nmcli.xml".

Note that the argument is only used to generate "man/nm-settings-docs-nmcli.xml",
and with the current input, there is no actual change in behavior.
2023-05-19 12:52:01 +02:00
Thomas Haller 42aa225185
docs: better handle description tags in generate-docs-nm-settings-docs-merge.py
When we generate the manual page for nm-settings-nmcli, we run:

   "/usr/bin/python" \
        ./tools/generate-docs-nm-settings-docs-merge.py \
        --only-from-first \
        man/nm-settings-docs-nmcli.xml \
        src/nmcli/gen-metadata-nm-settings-nmcli.xml \
        src/libnm-client-impl/nm-property-infos-nmcli.xml \
        src/libnm-client-impl/nm-settings-docs-gir.xml

If "gen-metadata-nm-settings-nmcli.xml" contains either a <description>
or a <description-docbook>, then we must not continue searching the
other XML documents. The user provided an explicit override, and
fallback (search further) is wrong. Previously, we might take
<description> from the first file, and <description-docbook> from the
second file. As "man/nm-settings-nmcli.xsl" prefers
<description-docbook>, it takes the wrong text. Instead, as we search
the files during merge, we must prefer the first one.

Note that the change doesn't really matter anymore, because each XML
now must also contain both <description> and <description-docbook>.
There is an assertion for that.

Also, stop generating <deprecated-docbook>. First, it lacked the
important "since=" attribute and was necessary. Also, it's redundant and
does not contain anything interesting. So far, we don't need special
formatting for the deprecated message, and we likely never will.

Also, stop accepting or generating the "description=" attribute. This
should always be an XML element now.
2023-05-19 12:52:00 +02:00
Thomas Haller d95001beff
docs: fix showing link for secrets-flags in man nm-settings-nmcli
The input always actually has a <description-docbook> field, so the secret-flags
hint was never shown.

Move it. It's indepenent from <description> and <description-docbook> anyway.

With this we see the expected messages

  See the section called “Secret flag types:” for flag values.
2023-05-19 12:52:00 +02:00
Thomas Haller 1c904c7d27
man: qualify properties in man nm-settings-nmcli with setting name
The manual page is large. When you search for a properties, then it's
not immediately clear to which setting it belongs. You would have to
scroll up for the setting name.

This also makes sense for the nmcli manual page, because on the command
line you have to specify the full name.
2023-05-08 11:04:50 +02:00
Beniamino Galvani f57a848da5 man: update documentation about global DNS configuration
Now the settings in the [global-dns] section are used *in addition* to
connection-specific ones. Only the global domains sections, when
valid, override connection settings. Update the man page to clarify
that.

Fixes: 1f0d1d78d2 ('dns-manager: always apply options from [global-dns]')
2023-03-03 14:06:24 +01:00
Thomas Haller 22c7fd33cc
doc: fix documenting "carrier-wait-timeout" in NetworkManager-wait-online manual
Fixes: df94cb2116 ('man: add NetworkManager-wait-online.service.8 manual')
2023-02-24 11:50:40 +01:00
Dylan Van Assche e20eb72fe7
man: NetworkManager-dispatcher: document reapply action
NetworkManager dispatcher will now run dispatcher scripts with 'reapply'
as action as well. Each time the connection is reapplied on a device,
this action is triggered. Document this action in the documentation.

(cherry picked from commit 0e3d2c367c)
2023-02-08 20:51:07 +01:00