Commit graph

26013 commits

Author SHA1 Message Date
Thomas Haller 87edf2f298
docs: move generate-docs scripts from "libnm/" to "tools/"
They are not only used in "libnm/" directory. Move to "tools/".
2020-06-11 10:53:50 +02:00
Thomas Haller d2f8d5a4fa
docs: move "nm-settings-docs-{dbus,nmcli}.xml" from "libnm/" to "man/"
"nm-settings-docs-nmcli.xml" will be generated by a tool that depends on
"clients/common/". The file should thus not be in libnm directory, otherwise
there is a circular dependency.

Move the file to "man/" directory.

For consistency, also move "nm-settings-docs-dbus.xml". Note that we
cannot move "nm-settings-docs-gir.xml" to "man/", because that one is
needed for building clients.
2020-06-11 10:53:50 +02:00
Thomas Haller caa70a50d7
all: move "shared/nm-libnm-aux" to "libnm/nm-libnm-aux"
Like the previous commit. Move code that depends on libnm out
of shared to avoid circular dependency.

Also add a readme file explaining the reason for existence of
the helper library.
2020-06-11 10:53:50 +02:00
Thomas Haller a9408e3497
all: move "shared/nm-libnm-core-aux" to "libnm-core/nm-libnm-core-aux"
Like the previous commit. Move code that depends on libnm-core out
of shared to avoid circular dependency.

Also add a readme file explaining the reason for existence of
the helper libraries nm-libnm-core-intern and nm-libnm-core-aux.
2020-06-11 10:53:50 +02:00
Thomas Haller e17a067e68
all: move "shared/nm-libnm-core-intern" to "libnm-core/nm-libnm-core-intern"
The "shared" directory is used by libnm-core, it should thus only depend on
code that is in the "shared" directory. Otherwise there is a circular
dependency, and meson's subdir() does not work nicely.

Also, libnm-core is really part of (and also an extension of) libnm-core,
so it belongs there.

I guess, the original idea was that this is also an extension for libnm,
so another project could take these utility functions (by copying them
into their source tree) and use them. That is still possible, it's
just that the sources are no longer under the shared directory.

Also add a readme to explain the non-obvious meaning of these files.
2020-06-11 10:53:50 +02:00
Thomas Haller b760dee8c8
all: move "shared/nm-keyfile" to "libnm-core/nm-keyfile"
Originally, these files were part of libnm-core and linked together.
However, that is a licensing violation, because the code is GPL-2.0+
licensed, while libnm-core also gets linked with libnm (it must thus
be LGPL-2.1+). The original intent behind moving the code to "shared/"
was to avoid the licensing issue, but also to prepare when we would add
a separate, GPL licensed libnm-keyfile. However, currently we hope to
be able to relicense the code, so that it actually could be exposed as
part of libnm. This is work in progress at ([1]).

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/ ## 517

Anyway, the current directory layout is problematic. libnm-keyfile
depends on libnm-core, while libnm-core depends on code under shared.
That means, there is a circular dependency and meson's subdir() does
not work well.

Move the code.
2020-06-11 10:53:50 +02:00
Thomas Haller 98f3d68cbe
docs: unify "nm-property-infos-*.xml" and "nm-settings-docs-*.xml" (root element)
There is no need that two XML files that essentially hold similar
information are fundamentally different. Make them more alike.
This way, we can use the same tools that operate on either of
these input files.
2020-06-11 10:53:50 +02:00
Thomas Haller 09f484ae9f
docs: update documentation for nm-settings-nmcli manual 2020-06-11 10:53:49 +02:00
Thomas Haller 47d39a7fb7
docs: add more nm-settings manpages (dbus,nmcli,keyfile,ifcfg-rh)
A significant part of NetworkManager's API are the connection profiles, documented
in `man nm-settings*`. But there are different aspects about profiles, depending
on what you are interested. There is the D-Bus API, nmcli options, keyfile format,
and ifcfg-rh format. Additionally, there is also libnm API.

Add distinct manual pages for the four aspects. Currently the two new manual
pages "nm-settings-dbus" and "nm-settings-nmcli" are still identical to the
former "nm-settings.5" manual. In the future, they will diverge to
account for the differences.

There are the following aspects:

 - "dbus"
 - "keyfile"
 - "ifcfg-rh"
 - "nmcli"

For "libnm" we don't generate a separate "nm-settings-libnm" manual
page. That is instead documented via gtk-doc.

Currently the keyfile and ifcfg-rh manual pages only detail settings
which differ. But later I think also these manual pages should contain
all settings that apply.
2020-06-11 10:53:49 +02:00
Thomas Haller d8992ce931
docs: rename "nm-settings-docs.xml" to "nm-settings-docs-dbus.xml"
"nm-settings-docs-dbus.xml" is "nm-settings-docs-gir.xml" merged with
"nm-property-infos-dbus.xml". The name should reflect that, also because
we will get more files with this naming scheme.
2020-06-11 10:53:49 +02:00
Thomas Haller 960ab39739
docs: rename "nm-property-docs.xml" to "nm-settings-docs-gir.xml"
The name is bad. For one, we will have more files of the same format
("nm-settings-docs-nmcli.xml").

Also, "libnm/nm-settings-docs.xml" and "libnm/nm-property-docs.xml" had
basically the same file format. Their name should be similar.

Also the tool to generate the file should have a name that reminds to
the file that it creates.
2020-06-11 10:53:49 +02:00
Thomas Haller a9001261fb
docs: rename "nm-property-infos" doc files
The naming was inconsistent. Rename.

- all the property infos of this kind a now consistently called
  "libnm/nm-property-infos-$TAG.xml".

- the script to generate files "libnm/nm-property-infos-$TAG.xml" is
  now called "libnm/generate-docs-nm-property-infos.pl".
2020-06-11 10:53:49 +02:00
Thomas Haller 7682e76de5
docs: fix dependency of "nm-settings*xml" to "common.ent"
"man/nm-settings%.xml" really should depend on "common.ent".
The reason is that XSL files like "man/nm-settings.xsl" include
"common.ent".
The previous code already tried to express that, but for some
reasons this dependency was not honored. Fix that.

However, that uncovers another problem with gtk-doc.make. If we do
that without the workaround for "docs/api/Makefile.am", then

  $ ./autogen.sh && make V=1 SHELL='sh -x' distcheck

breaks.

The reason is not clear to me. The new dependency leads to rebuild
"man/nm-settings-keyfile.xml". But that is worse, somehow the file
"$(top_srcdir)/man/nm-settings-keyfile.xml" ends up being read-only.
Afterwards, gtk-doc.make does

    setup-build.stamp:
        -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ;
        then \
          files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
          if test "x$$files" != "x" ; then \
            for file in $$files ; do \
              destdir=`dirname $(abs_builddir)/$$file`; \
              test -d "$$destdir" || mkdir -p "$$destdir"; \
              test -f $(abs_srcdir)/$$file && \
                cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true;
                \
            done; \
          fi; \
        fi
        $(AM_V_at)touch setup-build.stamp

so that the files in build dir are also read-only. Then, make distcheck
goes ahead and builds the files once again, which fails.

You are welcome to understand why this workaround is necessary. Please
then create a better fix.
2020-06-11 10:53:49 +02:00
Thomas Haller 2f78a824d8
docs: merge settings docs in a separate step
The script "libnm/generate-setting-docs.py" generates property info based
on GObject introspection data.

Optionally, when creating the manual for D-Bus documentation, it would accept
an argument "--override" to merge the generated information with the information
from an XML generated by "libnm/generate-plugin-docs.xml". Change this.
Instead, let "libnm/generate-setting-docs.py" just do one thing: generate
the XML based on GObject introspection data. Then, a second script
"libnm/generate-docs-nm-settings-docs-merge.py" can merge the XMLs.

Note that currently the manual for "nm-settings-keyfile" only contains
information about properties that are explicitly mentioned for keyfile.
It think that is not right. In NetworkManager there are multiple "aspects"
about connection profiles: D-Bus, libnm, nmcli, keyfile and ifcfg-rh.
When we generate a manual page for any of these aspects, we should always
detail all properties. At least for nmcli and D-Bus. That means, we will
do the merging multiple times. Hence, keep the steps for parsing GObject
introspection data and the merging separate.

Also, "generate-setting-docs.py" and "generate-plugin-docs.pl" should
generate the same XML scheme, so that merge doesn't need special hacks.
That is currently not the case, for example, the override XML contains a
"format" attribute, while the other one contains a "type". Merging these
is a special hack. This should be unified.
2020-06-11 10:53:49 +02:00
Thomas Haller 08f15d49a2
build/meson: bump minimal required meson version
The build for 0.46.0 probably isn't working anymore. Also, I'd like to
use dictionaries, which might not be available in such old meson
versions.

Anyway, it's not a problem. We in general aim to build on ancient
distros, like CentOS-7.5 and Ubuntu-16.04. But on those systems we
install meson using `pip3 install` anyway, where we get a recent meson
version.

Note that on Ubuntu 16.04, `pip3 install meson` would currently give us
meson 0.54.2. However, that meson requires a newer Python 3 version than
we have available. Hence, on Ubuntu 16.04 we actually want to install
`pip3 install meson==0.53.2`. See commit 5feba97cd1 ('gitlab-ci: use
old meson version on Ubuntu 16.04 to work with ninja-1.5.1').

We also still build on Fedora 28, which installs meson 0.47.2 from
packaging system. So, let's stick to 0.47.2 for now.
2020-06-11 10:53:46 +02:00
Beniamino Galvani 024e983c8e manager: change autoconnect-slaves logic for already active slaves
Autoconnect-slaves currently forces an activation of all slaves, even
if there is already an active connection for them. This is bad because
at boot slaves first try to autoconnect, then the autoconnect-slaves
of the master kicks in and disconnects/reactivates them.

The only reason why the forceful reactivation was added was to fix
[1]; in that scenario, a slave connection is already active as
non-slave; then it is updated to be a slave; later, the master with
autoconnect-slaves is manually activated. NetworkManager should detect
that the slave connection must now be activated by autoconnect-slaves.

Add a specific check for such situation, instead of always
reactivating all slaves.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1845018

Fixes: 4985ca5ada ('manager: allow autoconnect-slaves to reconnect the same connection')
2020-06-11 10:25:48 +02:00
Thomas Haller c6e61c186b
core,nmcli: merge branch 'th/mark-external-connection'
https://bugzilla.redhat.com/show_bug.cgi?id=1816202

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/533
2020-06-10 19:46:16 +02:00
Thomas Haller ec332e3a25
cli: show differnt text for state of externally connected devices 2020-06-10 19:45:47 +02:00
Thomas Haller a3528b1fe8
cli: show external connection in different color 2020-06-10 19:45:46 +02:00
Thomas Haller 16cff1149a
core: fix taking over external connection after restart
When we restart the daemon, it would find the previously present external
connection and assume it. We need to keep it as external.
2020-06-10 19:45:46 +02:00
Thomas Haller 8d6dbd1746
core: add "external" flag for active connections of external devices 2020-06-10 19:45:46 +02:00
Thomas Haller 96c9703b50
core: add "external" flag for connections of external devices
When a device is not marked as unmanaged, but also not actively managed
by NetworkManager, then NetworkManager will generate an in-memory
profile to represent the active state, if the device is up and
configured (with an IP address).

Such profiles are commonly named like "eth0", and they are utterly
confusing to users, because they look as if NetworkManager actually
manages the device, when it really just shows that somebody else configures
the device.

We should express this better in the UI, hence add flags to indicate
that.

In practice, such profiles are UNSAVED, NM_GENERATED, and VOLATILE. But
add an explicit flag to represent that.

https://bugzilla.redhat.com/show_bug.cgi?id=1816202
2020-06-10 19:45:46 +02:00
Beniamino Galvani 0d1df36e58 ovs: merge branch 'bg/ovs-patch-peer-rh1845216'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/534
https://bugzilla.redhat.com/show_bug.cgi?id=1845216
2020-06-10 17:48:51 +02:00
Beniamino Galvani ffeac35f04 ovs: ignore failures of patch interfaces
When there are two patch ports connected, each of them must reference
the other; however they can't be created in a single transaction
because they are part of different bridges (so, different
connections). Therefore, the first patch that gets activated will
always fail with "No usable peer $x exists in 'system' datapath" until
the second patch exists.

In theory we could also match the error message, however this doesn't
seem very robust as the message may slightly change in the future.
2020-06-10 09:58:25 +02:00
Beniamino Galvani beb1dba8c1 libnm-core: interpret ovs-patch.peer as an interface name
The 'peer' property of ovs-patch is inserted into the 'options' column
of the ovsdb 'Interface' table. The ovs-vswitchd.conf.db man page says
about it:

  options : peer: optional string
    The name of the Interface for the other side of the patch. The
    named Interface’s own peer option must specify this Interface’s
    name. That is, the two patch interfaces must have reversed name
    and peer values.

Therefore, it is wrong to validate the peer property as an IP address
and document it as such.

Fixes: d4a7fe4679 ('libnm-core: add ovs-patch setting')
2020-06-10 09:28:39 +02:00
Beniamino Galvani 040033a006 wifi: merge branch 'blocktrron/NetworkManager-tm-fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/500
2020-06-09 16:07:23 +02:00
David Bauer 5490011782 nm-supplicant-interface: parse 802.11 IEs after security
Psrse the 802.11 IEs after parsing the security information.

Previously the OWE transition mode flag was potentially removed
in case the security properties changed.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-06-09 16:07:04 +02:00
David Bauer 45ab623c12 nm-supplicant-interface: fix removal of OWE flag from non-transition mode BSSIDs
Commit 37e7fa38c2 ("nm-supplicant-interface: enable OWE security
when transition mode is available") adds the OWE security flag in
case a valid OWE transtition mode IE is present on the beacon.

It also removes the OWE security flag in case the Iinformation elements
of a beacon are updated and a OWE transition mode IE can't be found.

When a pure OWE AP updates it's Information Elements (e.g. BSS Load
Element), the OWE security flag is falsely removed.

Introduce a new NM_802_11_AP_SEC_KEY_MGMT_OWE_TM security flag and use
it exclusively for OWE transition mode. Don't use the
M_802_11_AP_SEC_KEY_MGMT_OWE security flag on transition-mode APs.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-06-09 16:07:04 +02:00
Beniamino Galvani d1e8eb791c tc: merge branch 'bg/tc'
Support more qdiscs.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/525
2020-06-08 15:32:10 +02:00
Beniamino Galvani 934777120b tc: add support for tbf qdisc
Add support for Token Bucket Filter queueing discipline.
2020-06-08 15:31:42 +02:00
Beniamino Galvani b22b4f9101 tc: add support for sfq qdisc
Add support for Stochastic Fairness Queueing queueing discipline.
2020-06-08 15:31:42 +02:00
Beniamino Galvani f695dd8de3 libnm-core: support variant attributes of type int32 and uint64 2020-06-08 15:31:41 +02:00
Beniamino Galvani 0ca1c7d182 libnm-core: fix parsing of mirred dev attribute
The attribute has a value.
2020-06-08 15:31:41 +02:00
Beniamino Galvani 283f7d0b30 move tc parsing out of nm-device.c
The logic to create platform qdiscs from a setting does not belong to
NMDevice. Move it to NetworkManagerUtils.h.
2020-06-08 15:31:41 +02:00
Beniamino Galvani d303c65ddf libnm-core: remove unused str_type from tc attribute specifiers 2020-06-08 15:31:41 +02:00
Beniamino Galvani f768bd8091 shared: add FIXME about interpretation of variant-attribute bytestrings 2020-06-08 15:31:41 +02:00
Thomas Haller d507563a80
tests: suppress valgrind warning about unsupported syscall for "test-config" 2020-06-07 15:26:07 +02:00
Thomas Haller 49886cedd9
gitlab-ci: avoid signing release build in gitlab-ci
The environment has no GPG key configured, so trying to sign fails.
2020-06-07 15:26:03 +02:00
Thomas Haller 46da6e2905
systemd: fix wrong assertion in sd_lldp_get_neighbors() 2020-06-05 18:20:28 +02:00
Thomas Haller ab2395c966
device/lldp: drop our own rate limiting for maximum number of LLDP neighbours
Systemd's LLDP client also internally tracks all neighbours, and it thus
already needs a maximum already. For systemd, that is currently 128.
We don't need to implement our own rate limiting on top of that,
because if we wouldn't trust the LLDP client to get this right,
it would be DoS-able already.

Also decrease the number of maximum neighbours from 4k to 128.
Note that already previously we wouldn't ever get more than 128
entries.
2020-06-05 17:05:24 +02:00
Thomas Haller 7d9ba20893
device/lldp: minor cleanups in "nm-lldp-listener.c" 2020-06-05 16:47:09 +02:00
Thomas Haller 7ecc1cfaaf
platform: assert struct alignment of NMPlatformIPRoute/NMPlatformIPAddress type 2020-06-05 15:14:30 +02:00
Thomas Haller 21c96342e9
keyfile: merge branch 'th/keyfile-public-api' (part 1)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/517
2020-06-05 09:18:00 +02:00
Thomas Haller e2f83d4e92
keyfile: add NMKeyfileHandlerFlags
nm_keyfile_read() and nm_keyfile_write() will be public API.
As such, it must be flexible and extendible for future needs.
There is already the handler callback that fully solves this
(e.g. a future handler event could request whether a certain
behavior is enabled or not).

As additional possibility for future extension, add a flags
argument. Currently no flags are implemented.
2020-06-05 09:17:21 +02:00
Thomas Haller 00b3a3505a
keyfile: add nm_keyfile_handler_data_warn_get() and construct message lazy
Add an accessor for the warning event.

Also, as we now have an accessor, we can construct the warning
message only if it actually needed.
2020-06-05 09:17:20 +02:00
Thomas Haller 4230a1d4fb
keyfile: add accessors for NMKeyfileHandlerData
For introspection/bindings it is cumbersome to access the
fields of the NMKeyfileHandlerData struct. Instead add accessor
functions.

Also, we wouldn't want to expose the struct in public API directly,
because it makes it harder to extend it without breaking ABI.
2020-06-05 09:17:20 +02:00
Thomas Haller 7d47a8fdbf
keyfile: add handler context for all parser callbacks
From inside a callback 4 properties are potentially interesting
to all callbacks: the currenty group, key, setting and property-name.

Refactor the code to track these properties in NMKeyfileHandlerData
and distinguish between the property name and the keyfile key.
2020-06-05 09:17:19 +02:00
Thomas Haller 5c67b72bb7
keyfile: use cleanup attribute for GBytes and GByteArray 2020-06-05 09:17:19 +02:00
Thomas Haller 021726e54e
keyfile: don't check for info->error before calling handle_warn()
When an error gets set, we should abort right away. We should
not come into a situation where we would try to emit another warning.

Don't check for a condition that should never happen and assert
against it.
2020-06-05 09:17:19 +02:00
Thomas Haller 8afb8ba819
keyfile: style cleanup calling handle_warn() 2020-06-05 09:17:18 +02:00