Commit Graph

917 Commits

Author SHA1 Message Date
Jan Vaclav
187ff4c73b nmtui: add veth page
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943
2024-06-28 11:01:51 +00:00
Jan Vaclav
c3a050bad1 build: break autotools configuration to warn about deprecation
We are planning on completely dropping Autotools in the future.
This breaks the build process with an argument to ignore the deprecation,
so that anyone building NM is warned of this change.

(cherry picked from commit d115dcec50)
2024-05-09 12:00:04 +02:00
Fernando Fernandez Mancera
32b20fbc8c merge: branch 'ff/fix_systemd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1877
2024-03-06 11:03:38 +01:00
Fernando Fernandez Mancera
5ab87886f3 power: rename NMSleepMonitor to NMPowerMonitor
In order to provide the NMSleepMonitor a more generic usage, let's
rename the whole module to NMPowerMonitor. Nothing is exposed to the API
so it is a trivial renaming.
2024-03-04 18:29:07 +01:00
Fernando Fernandez Mancera
e7ad3d93ab merge: branch 'systemd' into ff/fix_systemd
Disabled unused code and adapted Makefile and meson files.
2024-03-04 18:19:25 +01:00
Íñigo Huguet
f31d29bbb7 platform: netlink: add devlink support
Add support for Devlink, which is just another family of Generic Netlink
like nl80211. Implement get_eswitch_mode and set_eswitch_mode to allow
changing between legacy SRIOV and switchdev modes.

Devlink's purpose is to allow querying and configuring stuff related to
a piece of hardware but not to any of the usual Linux device classes.

For example, nowadays the Smart NICs normally allow to change the
eswitch mode per PF, because their hardware implements one eswitch per
PF, but future models might have a single eswitch for all the physical
and virtual ports of the NIC allowing more advanced bridge offloads.

Regarding the above example, for the moment we only support PCI network
devices with the "one eswitch per PF" model. The reason is that currently
NM only knows about netdevs so dealing with "devlink devices" that
doesn't map 1-1 with a netdev would require new mechanisms to understand
what they are and their relation with the netdevs that NM manage. We
will deal with that use cases when they arise and we have more
information about the right way to support them.
2024-02-20 16:01:25 +01:00
Fernando Fernandez Mancera
a1c503d558 merge: branch 'systemd'
The main change is that lease address and pd getters changed and the new
functions are now used.

In addition, solved several conflicts due to disabled code and added
adapt header to new files.
2024-02-19 13:02:22 +01:00
Jan Vaclav
7502787959 build: include meson-dist-data script in dist generated by autotools
The script had not been previously included in the distribution tarball
due to an oversight.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1849

Fixes: 1c41066a40 ('build: include documentation in meson dist')
2024-01-29 13:16:19 +00:00
Thomas Haller
03b9a255d2
libnm: remove unused "nm-property-compare.c"
"nm-property-compare.c" only contains nm_property_compare(), which is
broken.

It tries to compare string dictionaries as equal regardless of the
order of elements. It gets it wrong, for dictionaries with duplicate
keys. Which means, it can only be used with trusted variants that are
known to not contain duplicates. Which is quite a non-starter.

Also, the idea of a compare function for GVariant that ignores the order
of dictionary elements seems wrong. Even if for a certain application
the order does not matter, it still depends what the upper layer makes
of duplicate keys (will they bail out, or take the first/last occurrence
of a duplicate key?). nm_property_compare() doesn't have the knowledge
how upper layer handles it, and it's not obvious what's the right
choice. For example, if you use g_variant_lookup(), the first occurrence
is preferred. If you iterate over the children, possibly later
occurrences overwrite earlier ones.

It's ill defined, and maybe shouldn't be done. What should instead
happen, is that upper layers normalize (sort, uniquify) the keys, so
that we can do a full comparison. For that we have nm_g_variant_cmp().

Drop the now unused code. The core of the function still exists as
nm_g_variant_cmp().
2024-01-04 10:03:00 +01:00
Fernando Fernandez Mancera
5426bdf4a1 HSR: add support to HSR/PRP interface
This patch add support to HSR/PRP interface. Please notice that PRP
driver is represented as HSR too. They are different drivers but on
kernel they are integrated together.

HSR/PRP is a network protocol standard for Ethernet that provides
seamless failover against failure of any network component. It intends
to be transparent to the application. These protocols are useful for
applications that request high availability and short switchover time
e.g electrical substation or high power inverters.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1791
2023-12-05 08:05:56 +01:00
Íñigo Huguet
3842418512 Remove reference to deleted file in Makefile.am
The file NetworkManager-wait-online-systemd-pre200.service.in has been
removed but was still referenced in Makefile.am. Remove it from there.

Fixes: 886cd58658 ('build: assume we have at least systemd v200')
2023-11-03 08:37:44 +01:00
Michael Biebl
886cd58658 build: assume we have at least systemd v200
systemd v200 was released over 10 years ago.
It is thus reasonable to no longer support versions older than that and
simplify the build system a bit.
2023-11-03 07:19:08 +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
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
Íñ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
c9ced304d2 man nm-setting-*: add "expand enumvals" capability to property-infos
In some cases, properties documentation might require to provide an
explanation of each of the possible values that the property accepts.
If the possible values are the variants of an enum, we can use the
introspection data to get all the possible values for that enum and
their descriptions. With that info, we can automatically generate the
documentation with an always up to date list of accepted values.

Add a new "expand enumvals" feature: it will convert a token with the
format `#EnumName:*` to a list of all the possible values. For the
docbook (description-docbook field in the XML), it is expanded to a
bulleted list of all the values and their respective documentations.

This feature is limited to the "property-infos" comments (those like
---nmcli---, ---dbus---, etc). This comments are used only to generate
the nm-settings-* manual pages. For the documentation under the doc/
folder this is not needed: it's not supported by gtkdoc and, anyway,
it's better to use just `#EnumName` that will generate an HTML link.

Additionally, expansion of `%ENUM_VALUE` is now supported in the
property-infos comments. Instead of expanding them in the same style
than gtkdoc "ENUM_VALUE (num)", it is expanded in a format more suitable
for the nm-setting-* manual pages:
- for nmcli: value_nick (num)
- others: num (value_nick)

Also, fix typo in meson build file propery -> property.
2023-09-21 15:57:35 +02:00
Íñigo Huguet
28e53fed89 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
(cherry picked from commit fb851f3294)
2023-08-09 16:40:54 +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
Jan Vaclav
bf4d0eba6e nmtui: replace occurrences of master/slave with controller/port in internal code
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1335
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1698
2023-07-25 14:22:25 +02:00
Wen Liang
a705975a9e systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1666
2023-06-27 09:01:36 -04:00
Thomas Haller
0a7145a061
ppp/autotools: add missing check for symbols of libnm-ppp-plugin 2023-06-14 14:53:31 +02:00
Javier Sánchez Parra
b3b8323499 tui: Enable/disable Wi-Fi and WWAN radios
This commit adds functionality to nmtui to enable or disable the Wi-Fi
and WWAN radios. Additionally, it provides a display of the hardware
status.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1655
2023-06-14 09:58:11 +02:00
Wen Liang
f04a9eb098 cloud-setup: add pre-up event to prevent reaching network-online.target
network-online.target should not be reached before nm-cloud-setup
completes configuring the network, which may make user service get
started before the network is fully configured.

Setting nm-cloud-setup.service as "Before=network-online.target" would
maybe have already achieved that. However, also use a pre-up dispatcher
script, so that the device activation in NetworkManager is also waiting
for nm-cloud-setup to complete.

https://bugzilla.redhat.com/show_bug.cgi?id=2151040
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1653
2023-06-09 09:18:20 -04:00
Thomas Haller
0d0704eaa0
ifcfg-rh/tests: add test for infiniband profile with PKEY_ID in ifcfg format
https://bugzilla.redhat.com/show_bug.cgi?id=2209164
2023-06-05 09:06:51 +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
afe80171b2
ppp: move ppp code to "nm-pppd-compat.c"
Using the ppp code is rather ugly.

Historically, the pppd headers don't follow a good naming convention,
and define things that cause conflicts with our headers:

  /usr/include/pppd/patchlevel.h:#define VERSION          "2.4.9"
  /usr/include/pppd/pppd.h:typedef unsigned char  bool;

Hence we had to include the pppd headers in certain order, and be
careful.

ppp 2.5 changes API and cleans that up. But since we need to support
also old versions, it does not immediately simplify anything.

Only include "pppd" headers in "nm-pppd-compat.c" and expose a wrapper
API from "nm-pppd-compat.h". The purpose is that "nm-pppd-compat.h"
exposes clean names, while all the handling of ppp is in the source
file.
2023-04-17 18:27:50 +02:00
Eivind Næss
8469c09a50
ppp, adding support for compiling against pppd-2.5.0
This change does the following
* Adding in nm-pppd-compat.h to mask details regarding different
  versions of pppd.
* Fix the nm-pppd-plugin.c regarding differences in API between
  2.4.9 (current) and latet pppd 2.5.0 in master branch
* Additional fixes to the configure.ac to appropriately set defines used
  for compilation
2023-04-16 21:05:07 +02:00
Lubomir Rintel
d89d42bf23 tests/client: test nm-cloud-setup
Some fairly rudimentary testing of nm-cloud-setup.
2023-03-21 23:35:42 +01:00
Lubomir Rintel
ad6878d50a tests/client: split out nmcli specific bits into a separate cass
The mock service is more widely useful -- in particular for testing
nm-cloud-setup in a following commit.

Split the commonly useful parts into TestNmClient class.
2023-03-21 23:35:42 +01:00
Lubomir Rintel
1e114c804b tools/test-cloud-meta-mock: add a mock metadata server for cloud-setup
Useful for testing/development.
2023-03-21 23:35:42 +01:00
Beniamino Galvani
39bfcf7aab all: add "link" setting
Introduce a new "link" setting that holds properties that are related
to the kernel link.
2023-03-02 16:51:16 +01:00
Thomas Haller
dd5e769f24
build: add test for checking consistency of "nm-autoptr.h" 2023-02-28 16:33:07 +01:00
Thomas Haller
fdec6a97e8
vapi: add test for consistency of "vapi/NM-1.0.metadata" 2023-02-28 13:05:47 +01:00
Corentin Noël
169f8748ba
libnm: Specify the main header in the .gir file
Bindings compiling to C need to know which main header to include.
2023-02-28 13:05:47 +01:00
Thomas Haller
5973e83160
systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1529
2023-02-13 15:33:02 +01:00
Thomas Haller
ba5cbedd2c
test-client: add valgrind support for call_nmcli_pexpect() tests
This will allow to find some memory leaks and memory corruptions.

The bulk of the nmcli calls are still not hooked up with valgrind.
Since we call nmcli a thousand time, we could not just run valgrind with
all of them. We would have instead to enable it randomly. This is
more work.

(cherry picked from commit debf78dbed)
2023-02-08 10:53:05 +01:00
Thomas Haller
ec454f924c
test-client: pass extra argument in "test-client.sh" to python test
For example:

  $ src/tests/client/test-client.sh -- TestNmcli.test_004
  $ src/tests/client/test-client.sh -- -k monitor

(cherry picked from commit b76bb7333e)
2023-02-08 10:53:05 +01:00
Lubomir Rintel
4d75c43f1a dns-manager: always apply options from [global-dns]
Currently, the use of [global-dns] section for setting DNS options is
conditioned on presence of a nameserver in a [global-dns-domain-*] section.
Attempt to use the section for options alone results in an error:

  [global-dns]
  options=timeout:1

Or via D-Bus API:

  # busctl set-property org.freedesktop.NetworkManager \
      /org/freedesktop/NetworkManager org.freedesktop.NetworkManager \
      GlobalDnsConfiguration 'a{sv}' 2 \
          "options" as 1 "timeout:1" \
          "domains" a{sv} 0
  ...
  Nov 24 13:15:21 zmok.local NetworkManager[501184]: <debug> [1669292121.3904]
      manager: set global DNS failed with error: Global
      DNS configuration is missing the default domain

The insistence on existence of [global-dns-domain-*] would make sense if
other [global-dns-domain-...] sections were present.

However, the user might only want to set the options in resolv.conf and
still use connection-provide nameservers for the actual resolving.

Lift the limitation by allowing the [global-dns] to be used alone, while
still insist on [global-dns-domain-*] being there in presence of other
domain-specific options.

https://bugzilla.redhat.com/show_bug.cgi?id=2019306
(cherry picked from commit 1f0d1d78d2)
2023-01-26 10:11:45 +01:00
Thomas Haller
8f13cb490b
build: fix make cscope step for removed directories 2023-01-17 16:29:05 +01:00
Thomas Haller
a259303e1d
ovs: add support for "other_config" settings
See `man ovs-vswitchd.conf.db` for documentation of "other_config" keys.

https://bugzilla.redhat.com/show_bug.cgi?id=2151455
2023-01-11 21:49:36 +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
e292c80da4
c-stdaux: re-import git-subtree for 'src/c-stdaux'
git subtree pull --prefix src/c-stdaux git@github.com:c-util/c-stdaux.git main --squash
2022-11-23 18:01:57 +01:00
Thomas Haller
b2931c9621
build: fix dist-ing "src/libnm-lldp/meson.build" in release tarball
Fixes: 630de288d2 ('lldp: add libnm-lldp as fork of systemd's sd_lldp_rx')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1142
2022-11-18 16:16:40 +01:00
Thomas Haller
a7fea45adf
libnm: move "nm-dbus-utils.c" from libnm-core to libnm-glib-aux
These are just general purpose D-Bus utils, based on glib and GDBus.
They fit perfectly to libnm-glib-aux. Move the code.

Also, there is already the file "src/core/nm-dbus-utils.c", having two
files with the same name on our source tree is just confusing.
2022-11-14 08:04:06 +01:00
Lubomir Rintel
777f31436c merge: branch 'lr/unbreak-gir'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1451
2022-11-11 16:08:17 +01:00
Thomas Haller
3755e6b175
ifcfg-rh/tests: add test checking persisting ethtool settings to ifcfg-rh
There are still various failures. That will be fixed next.
2022-11-10 13:44:58 +01:00
Lubomir Rintel
133540763c libnm: test that Gir data matches actual exports
This verifies that what's in our public headers has version nodes, and
that they match Since: tags.

Not pretty (because python) but discovered a *lot* of issues.
2022-11-08 13:14:56 +01:00
Lubomir Rintel
e13eb9010c Makefile.am: tidy up the introspection conditional part
Use of conditionals in makefiles needs to be kept to a necessary minimum
otherwise they get out of hand quickly. There's no indentation to aid
reading and conditional chunks longer than a screen and nested ones are
almost impossible to comprehend.

The "if HAVE_INTROSPECTION" part does both.

Let's make it a little less horrible. There's generally no point in
making unused targets or variable assignment unless they collide with
pre-built stuff or have multiple variants.
2022-11-08 11:43:06 +01:00
Thomas Haller
d699f76855
libnm: generate "gen-metadata-nm-settings-libnm-core.xml" with meta data
libnm-core-impl has lots of internal meta data about the properties.
In particular, which properties exist (their names), and their D-Bus
type.

We should use this information for our manual pages. For example,
currently `man nm-settings-dbus` has nonsense like: "Value Type: array
of string", when it should be reall "as".

In a first step, generate an XML with that meta data for later use.
2022-10-31 09:11:30 +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