Commit Graph

648 Commits

Author SHA1 Message Date
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
Wen Liang
e8618f03d7 support loopback interface
Support managing the loopback interface through NM as the users want to
set the proper mtu for loopback interface when forwarding the packets.
Additionally, the IP addresses, DNS, route and routing rules are also
allowed to configure for the loopback connection profiles.

https://bugzilla.redhat.com/show_bug.cgi?id=2060905
2022-11-23 20:51:22 +01:00
Thomas Haller
1bfe908c2e nmcli: rename "generate-docs-nm-settings-nmcli" to "gen-metadata-nm-settings-nmcli"
This is the better name, becuse this is not in particular about "docs".
It's about generating an XML with the information from the settings
meta data for nmcli.

We will do something similar with the libnm-core meta data.
2022-10-31 09:11:30 +01:00
Lubomir Rintel
77508aea59 man/nmcli: document variables affecting fancy output
Notably, PAGER, TERM and NO_COLORS.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1419
2022-10-11 16:34:49 +02:00
Marc Muehlfeld
531cc96737 man/NetworkManager-wait-online.service: clean up
I rewrote the man page to make it clearer and easier to understand.
Additionally, I fixed some typos and grammar issues.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1390
2022-10-03 16:28:44 +02:00
Thomas Haller
3a6a07e11e man: update "--print-config" text in man NetworkManager 2022-09-08 16:19:11 +02:00
Lubomir Rintel
0f0c4e384d man/nm-settings-nmcli: include deprecation description, if present 2022-09-07 10:55:31 +02:00
Lubomir Rintel
bc09568eb1 man/nm-settings-dbus: include deprecation description, if present 2022-09-07 10:55:31 +02:00
Thomas Haller
56d0d35516 mptcp: rework "connection.mptcp-flags" for enabling MPTCP
1) The "enabled-on-global-iface" flag was odd. Instead, have only
and "enabled" flag and skip (by default) endpoints on interface
that have no default route. With the new flag "also-without-default-route",
this can be overruled. So previous "enabled-on-global-default" now is
the same as "enabled", and "enabled" from before behaves now like
"enabled,also-without-default-route".

2) What was also odd, as that the fallback default value for the flags
depends on "/proc/sys/net/mptcp/enabled". There was not one fixed
fallback default, instead the used fallback value was either
"enabled-on-global-iface,subflow" or "disabled".
Usually that is not a problem (e.g. the default value for
"ipv6.ip6-privacy" also depends on use_tempaddr sysctl). In this case
it is a problem, because the mptcp-flags (for better or worse) encode
different things at the same time.
Consider that the mptcp-flags can also have their default configured in
"NetworkManager.conf", a user who wants to switch the address flags
could previously do:

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled-on-global-iface,signal,subflow

but then the global toggle "/proc/sys/net/mptcp/enabled" was no longer
honored. That means, MPTCP handling was always on, even if the sysctl was
disabled. Now, "enabled" means that it's only enabled if the sysctl
is enabled too. Now the user could write to "NetworkManager.conf"

  [connection.mptcp]
  connection.mptcp-flags=0x32   # enabled,signal,subflow

and MPTCP handling would still be disabled unless the sysctl
is enabled.

There is now also a new flag "also-without-sysctl", so if you want
to really enable MPTCP handling regardless of the sysctl, you can.
The point of that might be, that we still can configure endpoints,
even if kernel won't do anything with them. Then you could just flip
the sysctl, and it would start working (as NetworkManager configured
the endpoints already).

Fixes: eb083eece5 ('all: add NMMptcpFlags and connection.mptcp-flags property')
(cherry picked from commit c00873e08f)
2022-08-25 23:12:53 +02:00
Thomas Haller
55421209e2 man: show example how to enable logging in NetworkManager 2022-08-09 10:20:58 +02:00
Thomas Haller
eb083eece5 all: add NMMptcpFlags and connection.mptcp-flags property 2022-08-09 08:02:54 +02:00
Thomas Haller
3876c99da8 man: fix letter case of values for CONNECTIVITY_STATE in NetworkManager-dispatcher
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1047
2022-07-22 11:51:20 +02:00
Thomas Haller
5c84fe0db5 core: support "nm.debug" kernel command line to enable verbose logging
When NetworkManager runs in initrd, it can be cumbersome to enable debug logging.
Granted, when using dracut, the NetworkManager dracut module will honor "rd.debug".
However, a user may use NetworkManager in initrd without dracut. Then,
the only way to enable debug logging would be by changing
"NetworkManager.conf" and rebuild the initrd (or having some script in
place, that allows to more conveniently enable debug logging for
NetworkManager).

To make it easier for debugging, honor "nm.debug" on the kernel command
line.

Note that if "nm.debug" is set on the kernel command line, it always overrides
both the command line arguments and the configuration from NetworkManager.conf.
That is intentional. The only way to override that is by overriding the
kernel command line with a file "/run/NetworkManager/proc-cmdline".

https://bugzilla.redhat.com/show_bug.cgi?id=2102313
2022-07-18 15:00:04 +02:00
Vojtech Bubela
5e4632f021 doc: preserve paraghraphs in nmcli man pages
Improve documentation by preserving paragraphs in the
nm-settings-nmcli man pages.

To do that structure of src/libnm-client-impl/nm-settings-docs-gir.xml
was changed to have "description" as subnode to property node instead
of attribute of property node. Another subnode "description-docbook"
was added - this node is then used when generating man pages.

tools/generate-docs-nm-settings-docs-gir.py and man/nm-settings-dbus.xsl
were also changed to accomodate for changes mentioned above.

Replace xsltproc tool with python script when generating
./src/libnmc-setting/settings-docs.h.

Deleted settings-docs.xsl since it was replaced by python script.

Change src/libnmc-setting/settings-docs.h.in accodring to newly
generated src/libnmc-setting/settings-docs.h

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/661

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1260
2022-07-15 17:25:15 +02:00