Commit Graph

26031 Commits

Author SHA1 Message Date
Thomas Haller
2b52b003f8 lldp/tests: assert for expected GVariant when parsing LLDP neighbor
Currently the LLDP parsing code uses GVariantBuild, which possibly does not
ensure a stable order of elements. Thus the test may not be stable.

However, that will be fixed very soon.
2020-06-11 16:49:27 +02:00
Thomas Haller
2d50370e07 lldp/tests: add test for parsing LLDP frame 2020-06-11 16:49:27 +02:00
Thomas Haller
4aa657086e lldp/tests: assert for variant lookup in tests 2020-06-11 16:49:27 +02:00
Thomas Haller
393bc8c8f6 shared: add nm_utils_buf_utf8safe_escape_cp() helper 2020-06-11 16:49:26 +02:00
Thomas Haller
39127758bd shared: add nm_utils_ether_addr_equal(), nm_utils_ether_addr_cmp() 2020-06-11 12:00:52 +02:00
Thomas Haller
fce73b1c82 shared: add nm_g_variant_builder_add_sv_*() helpers 2020-06-11 12:00:52 +02:00
Thomas Haller
3f19c1fa52 shared/tests: add nmtst_assert_variant_bytestring() helper 2020-06-11 12:00:49 +02:00
Thomas Haller
82faec5875 supplicant: merge branch 'th/supplicant-config-verify'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/468

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/535
2020-06-11 11:06:41 +02:00
Thomas Haller
505aee6598 supplicant: use macros to initialize config options 2020-06-11 11:06:30 +02:00
Thomas Haller
4afd62246b supplicant: use binary search to lookup option in "nm-supplicant-settings-verify" 2020-06-11 11:06:30 +02:00
Thomas Haller
1fc1a40dd5 supplicant: remove unused str_allowed_multiple field from options 2020-06-11 11:06:30 +02:00
Thomas Haller
941277a9d6 supplicant: remove unused, duplicate "pac_file" entry from opt_table 2020-06-11 11:06:29 +02:00
Thomas Haller
97f5c684dc supplicant: rename OptType enum to have "NM" prefix
Names in header files should have a "NM" prefix. Rename.
2020-06-11 11:06:29 +02:00
Thomas Haller
f2f82c13b5 supplicant: move strv lists into option meta data
Have the string list definition closer to the option where it is used.
2020-06-11 11:06:29 +02:00
Thomas Haller
03b3e0bfd6 supplicant: nicer align code in "nm-supplicant-settings-verify.c"
Yes, fewer lines of code is often better, if that means the code itself is
simpler. Code doesn't get simpler by cramping more in the same line.
Have every value on a separate line.

Also, vertically align the table.
2020-06-11 11:06:29 +02:00
Thomas Haller
e7a74721be supplicant: fix verification of key_mgmt config for FT-FILS-SHA{256,384}
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/468

Fixes: d17a0a0905 ('supplicant: allow fast transition for WPA-PSK and WPA-EAP')
2020-06-11 11:06:19 +02:00
Thomas Haller
8a78b15c9b docs: merge branch 'th/nm-settings-manual'
This is a first step to improve our manual pages ([1]).

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/528
2020-06-11 10:54:04 +02:00
Thomas Haller
10020a9466 docs: generate nm-settings-docs-nmcli.xml based on nmcli meta data
We have the correct meta-data of supported properties for nmcli. It is
in clients/common. Use that for generating the manual page instead of
the properties that are part of libnm (some properties may be in libnm
but not supported by nmcli, or some properties may not be GObject
properties, and not detected as by GObject introspection).
2020-06-11 10:53:50 +02:00
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