Commit graph

23852 commits

Author SHA1 Message Date
Beniamino Galvani
cf557bf06f settings: fix updating agent-owned VPN secrets
property_to_dbus() returns NULL when called with
NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED and the property is
not an agent-owned secrets. The function doesn't handle VPN secrets
correctly, since they are all stored as a hash in the vpn.secrets
property and the flag for each of them is a matching '*-flags' key in
the vpn.data property. VPN secrets must be handled differently; do it
in the VPN setting to_dbus_fcn() function.

Fixes: 71928a3e5c ('settings: avoid cloning the connection to maintain agent-owned secrets')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/230
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/280
(cherry picked from commit 43b7e66948)
2019-11-05 14:34:05 +01:00
Lubomir Rintel
ee2b37e714 merge: branch 'sharkcz/s390-initrd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/317

(cherry picked from commit 8eb20013ab)
2019-11-04 21:42:09 +01:00
Lubomir Rintel
4c7d12cb29 initrd/tests: test that we generate the s390 interface names correctly
(cherry picked from commit 927ae6d927)
2019-11-04 16:24:42 +01:00
Dan Horák
56026dd3dd initrd: handle rd.znet with legacy interface names
Handle rd.znet with legacy interface names too, the index for eth or ctc
corresponds to the position on the command line.

(cherry picked from commit 22e388d90e)
2019-11-04 16:24:40 +01:00
Dan Horák
72fcf35cb6 initrd: prepare interface in rd.znet only if persistent interface names are enabled
When processing the rd.znet option set the interface name only in case when
the persistent interface names feature isn't disabled via net.ifnames=0

[lkundrak@v3.sk: minor tweaks to the net.ifnames=0 parsing]

(cherry picked from commit c7423dca89)
2019-11-04 16:24:39 +01:00
Dan Horák
31d44a28e1 initrd/tests: use a valid combination of device and interface name for testing
(cherry picked from commit c27f5030e9)
2019-11-04 16:24:39 +01:00
Dan Horák
deff651704 initrd: use proper interface when adding s390 specific details
The current solution for s390 specific details relies on an interface to
exist before adding the s390 details. It means the ip= option must precede
the rd.znet= option. Also only a single interface can be configured. With
this change the s390 details are put to the right interface and properly
named interface is created if it hasn't existed yet.

(cherry picked from commit adcc52c3da)
2019-11-04 16:24:38 +01:00
Lubomir Rintel
9e6706edb7 iwd: unbreak iwd-1.0
The upstream apparently thought it's a great idea to change the agent
manager path. This fixes things for those unfortunate enough to run
IWD.

(cherry picked from commit 186d22a963)
2019-11-03 13:06:04 +01:00
Lubomir Rintel
8a668d0983 iwd: add some missing error handling
g_dbus_object_manager_get_interface() can happily return NULL and we
need to check for that.

(cherry picked from commit 59923ad85d)
2019-11-03 13:06:03 +01:00
worldofpeace
4c11364201 build: add PPPD_PATH to config.h.meson
Without this using -Dpppd= was completely broken.

First observed in NixOS [0]

[0]: https://github.com/NixOS/nixpkgs/issues/72330

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/323
(cherry picked from commit e1ead6fa98)
2019-11-01 07:35:24 +01:00
Lubomir Rintel
cab2e4fc96 libnm/utils: fix build
We don't have NM_WIFI_DEVICE_CAP_IBSS_RSN in 1.20.x series. Don't allow
SAE on ad-hoc networks, we don't allow WPA2 in 1.20.x either.
2019-10-11 10:18:38 +02:00
Beniamino Galvani
58ffded2d0 dhcp: include conditionals from existing dhclient configuration
Since commit 159ff23268 ('dhcp/dhclient-utils: skip over
dhclient.conf blocks') we skip blocks enclosed in lines containing '{'
and '}' because NM should ignore 'lease', 'alias' and other
declarations. However, conditional statements seem useful and should
not be skipped.

https://bugzilla.redhat.com/show_bug.cgi?id=1758550
(cherry picked from commit b58e4d311d)
2019-10-10 14:53:01 +02:00
Beniamino Galvani
299fbc0888 supplicant: allow PMF with SAE
PMF can be used with SAE, allow it. Actually, it is required according
to WPA3 specifications but there are implementations that don't
require it (hostapd can be configured in a such way); so let's not
make it mandatory for WPA3.

Fixes: 6640fb4b36 ('supplicant: add support for SAE key management')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/257
(cherry picked from commit e36c297fd8)
2019-10-09 13:09:42 +02:00
Lubomir Rintel
2c4195bb74 libnm/utils: add SAE security type
https://github.com/NetworkManager/NetworkManager/pull/354
(cherry picked from commit 0ff1cb556c)
2019-10-09 12:48:45 +02:00
Lubomir Rintel
fb874e6cda bluetooth: don't set the ifindex after the device has been activated
The Bluetooth DUN device's NMModem would signal the reset of ifindex to zero
when it's disconnected and the NMDeviceBt would accordingly update the
bluetooth device's ip ifindex. This is not okay since commit ab4578302d
('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()') which,
although claiming to be a refactoring, made such use of
nm_device_set_ip_ifindex() illegal. Resetting the ifindex is anyway not
necessary, since it's taken care of _cleanup_generic_post().

Let's leave the ifindex alone once the device is activated, in a manner
analogous to what NMDeviceModem.

Fixes: ab4578302d ('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()')
Fixes: 78ca2a70c7 ('device: don't set invalid ip-iface'):
(cherry picked from commit a5ca504b5b)
2019-10-09 12:48:29 +02:00
Lubomir Rintel
56036d85ec build: regenerate config-extra.h if configure was re-run with different arguments
(cherry picked from commit 140619854e)
2019-10-09 12:48:22 +02:00
Lubomir Rintel
24d40570a7 contrib/checkpatch: fix the systemd code path
(cherry picked from commit ae6668ae85)
2019-10-08 13:39:53 +02:00
Thomas Haller
af4671cda0 run-nm-test: fix using exec instead of running and exiting
Otherwise, the script tries to run

  dbus-run-session -- exec ...

which fails (because `exec` is a shell command, not a program).
After the failure, the code falls through to run the test under
valgrind.

Fixes: 6a58c55ca4 ('run-nm-test: Just use exec instead of running and exiting')
(cherry picked from commit b9c4d2bb72)
2019-10-08 13:35:26 +02:00
Marco Trevisan (Treviño)
44bb65485f run-nm-test: Just use exec instead of running and exiting
(cherry picked from commit 6a58c55ca4)
2019-10-08 13:35:26 +02:00
Marco Trevisan (Treviño)
963ff8c2ab run-nm-test: Set NM_TEST_UNDER_VALGRIND accordingly
When a test is going to be run under valgrind we set NM_TEST_UNDER_VALGRIND
so that we can properly check whether this is happening.

(cherry picked from commit 073eda68fc)
2019-10-08 13:35:26 +02:00
Thomas Haller
9a37702311 checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master
When opening a merge request from a fork of NetworkManager, then the
pipeline runs with the a checkout of the fork. That means, checkpatch
would compare the branch against "master" (or "nm-x-y" stable branches)
of the fork, instead of upstream.

That doesn't seem too useful. Instead, also add upstream NetworkManager
as git remote, fetch the branches, and use the branches from there as
base for checkpatch.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
(cherry picked from commit 3019648b4b)
2019-10-08 12:48:44 +02:00
Thomas Haller
27c23b0748 gitlab-ci: workaround unit test failure for iproute2 bug in "ubuntu:devel"
"ubuntu:devel" ships iproute2 version "5.2.0-1ubuntu1". This has a well known
bug that prevents it from creating IP tunnels during the unit tests.

We already workaround that on Debian. Add the same workaround to match the
Ubuntu package.

(cherry picked from commit 44193d3def)
2019-10-01 10:04:22 +02:00
Thomas Haller
fe1af3c23b release: bump version to 1.20.5 (development) 2019-09-30 08:36:04 +02:00
Thomas Haller
27dee3b113 release: bump version to 1.20.4 2019-09-30 08:34:38 +02:00
Thomas Haller
9044773b91 release: update NEWS 2019-09-30 08:32:47 +02:00
Thomas Haller
98e4efd917 clients/tests: fix expected client test output
Fixes: 275a7c46a1 ('clients/tests: don't include the source line number with client tests output')
2019-09-27 17:22:00 +02:00
Beniamino Galvani
7b9abe94bf device: fix wrong string compare in _commit_mtu()
Fixes: e6628fa27c ('ipv6: add 'disabled' method')

https://bugzilla.redhat.com/show_bug.cgi?id=1753128
(cherry picked from commit 5f284e1574)
2019-09-27 13:41:05 +02:00
Beniamino Galvani
722cddfad8 device: don't reapply IP config on link up for disconnected devices
Only reapply the IP configuration on link up if the IP state is CONF
or DONE. Previously we also reapplied it when the device was
disconnected (IP state NONE) and this could lead to a situation where
an incomplete config was applied; then we intersected the desired
configuration with the external - incomplete - one, causing the
removal of part of desired configuration (for example the default
route).

Fixes: d0b16b9283 ('device: unconditionally reapply IP configuration on link up')

https://bugzilla.redhat.com/show_bug.cgi?id=1754511
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/291
(cherry picked from commit 64a9dd3804)
2019-09-27 13:28:37 +02:00
Thomas Haller
dc65a63347 release: update NEWS 2019-09-27 11:53:16 +02:00
Thomas Haller
275a7c46a1 clients/tests: don't include the source line number with client tests output
The client tests compare the test output with a .expected file that is
commit to git and that contains the expected output.

The expected output contains data like

    size: 395
    location: clients/tests/test-client.py:842:test_001()/1
    cmd: $NMCLI
    lang: C
    returncode: 0
    stdout: 277 bytes
    >>>
    ...

Note that there is the line number (clients/tests/test-client.py:842) of
the source code where nmcli is called. This is to help correlate the output
with the test code.

However, Python 3.8 changes behavior and for function calls that span multiple
lines, frame.f_lineno will give now the starting line (previously, it gave the last
line) (see [1]).

No longer include the line number, as it is not stable accross Python versions.

If you really care, you can set NM_TEST_WITH_LINENO to get the line numbers back.
Of course, then the expected output won't match anymore, and you'd have to regenerate
it first. This is only useful if you debug tests, and want to have it easier to
correlate output with the tests while developing them.

[1] https://bugs.python.org/issue38283

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/292
(cherry picked from commit ad3ef326aa)
2019-09-27 09:37:31 +02:00
Thomas Haller
460ed8112f clients/tests: skip client tests with python 3.8-beta
It's unclear how to workaround this issue, so that the tests
work with older python versions and 3.8-beta.

Let's wait whether this will really be released as 3.8 and
for now just skip the test.

(cherry picked from commit d7b9906666)
2019-09-27 09:37:22 +02:00
Thomas Haller
6525c0d277 initrd: merge branch 's390-initrd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/281

(cherry picked from commit 204256149c)
2019-09-27 09:36:44 +02:00
Thomas Haller
8730eac81c initrd: make "argv" argument of nmi_cmdline_reader_parse() a const strv
(cherry picked from commit eea783d129)
2019-09-27 09:31:00 +02:00
Thomas Haller
c28597e2ff initrd/tests: check for the parsed values in detail for rd.znet test
(cherry picked from commit eea8ee2321)
2019-09-27 09:29:41 +02:00
Thomas Haller
2fbd309334 initrd: avoid modifying the argv argument in nmi_cmdline_reader_parse()
While nmi_cmdline_reader_parse() only has one caller, which indeed has the
argv parameter at hand and doesn't care it to be modified, I think it
is ugly.

Arguments preferably are strictly either input or output arguments,
with input arguments not being modified by the call.

(cherry picked from commit 19604cb126)
2019-09-27 09:29:41 +02:00
Thomas Haller
83d4fb9f4e libnm: fix variable type for holding g_strv_length() result in "nm-setting-wired.c"'s verify()
(cherry picked from commit 9b3d37721b)
2019-09-27 09:29:41 +02:00
Thomas Haller
7011f4f098 initrd: avoid assertion inparse_rd_znet() and cleanup
- nm_setting_wired_add_s390_option() asserts that a "value" argument
  is given. Check that the string contains a '=' where we can split.

- pass the requested NM_SETTING_WIRED_SETTING_NAME type to get_conn().
  Otherwise, @s_wired might be %NULL, resulting in an assertion.
  I do wonder whether this always retrieves a connection of the
  appropriate type for modification, or whether a profile could
  be returned that was created for a different purpose. But that
  isn't changed.

- avoid "g_strcmp0 (nettype, "ctc") != 0". I find it unexpected, that we add the
  3rd subchannel component, if the nettype is "ctc" (intuitively, I'd expect it
  to be the opposite). The reasons for this are not documented, but I
  presume it is correct.
  Anyway, using streq() makes this slightly more clear to me, as with
  strcmp() I would wonder whether this was just a typo while with
  streq() I'd be more confident that this is indeed intended.

- don't initialize local variables unnecessarily. The compiler would
  warn if we would forget about this. Also, don'\''t use { } for a
  one-line block.

(cherry picked from commit 783fe28465)
2019-09-27 09:29:41 +02:00
Dan Horák
ce0d7c4efe nm-initrd-generator - add test for rd.znet
(cherry picked from commit df07539105)
2019-09-27 09:29:41 +02:00
Dan Horák
68d6d2bd12 process s390 specific device info from rd.znet parameter in nm-initrd-generator
syntax: rd.znet=<nettype>,<subchannels>,<options>

The s390 specific options used to create the network interface in the kernel
are currently not processed by nm-initrd-generator causing incomplete ifcfg file.

fixes https://bugzilla.redhat.com/show_bug.cgi?id=1753975

(cherry picked from commit 11d4412ee1)
2019-09-27 09:29:41 +02:00
Thomas Haller
8caf3e3e9b settings: fix creation of default-wired-connection in device_realized()
Fixes-test: @allow_wired_connections

Fixes: 3e39d2a586 ('settings: shortcut check for whether to create auto-default wired connection')
(cherry picked from commit 7df769600b)
2019-09-27 09:13:51 +02:00
Thomas Haller
f73879899b build,tests: merge branch 'th/fix-python-test'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/287

(cherry picked from commit 18f890d491)
2019-09-25 15:53:01 +02:00
Thomas Haller
6a4129485a gitlab-ci: add building on Fedora 31
And don't build Fedora 28 by default. It's aleady end of life.
But for now keep it, so it can be triggered manually.

(cherry picked from commit b40a3aa727)
2019-09-25 15:52:17 +02:00
Thomas Haller
c162dc00e5 build/meson: use python3 interpreter for "generate-setting-docs.py"
Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't
work anymore. Of course, who needs a way to invoke the interpreter that works
accross different distributions! WTF.

In this case, easy to work around. We run it from meson, so we have access to
the Python 3 binary. Just call python explicitly, like we do with autotools.

(cherry picked from commit 7c7ad97831)
2019-09-25 15:52:17 +02:00
Thomas Haller
35a2a71801 contrib/rpm: drop BuildRequires to deprecated "wireless-tools-devel"
"wireless-tools-devel" is long depreacted and not used by
NetworkManager, not even for WEXT.

Drop it from the build dependencies.

(cherry picked from commit 9fc4490513)
2019-09-25 15:52:17 +02:00
Thomas Haller
2b01ac0932 tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL
(cherry picked from commit 3a1b2b9885)
2019-09-25 15:52:17 +02:00
Thomas Haller
6ff16a48bb tests: don't install unnecessary package in gitlab-ci tests
REQUIRED_PACKAGES has two uses:

 - to setup a system for developing NetworkManager. This installs
   convenience packages like "cscope".

 - to install the packages required for unit testing in gitlab-ci.

For gitlab-ci we should only install the packages that we actually
need.

(cherry picked from commit 1a2a5b37b4)
2019-09-25 15:52:17 +02:00
Thomas Haller
888718d6f4 tests: fix failure installing non-existing packages in REQUIRED_PACKAGES
Previously, dnf/yum used to ignore packages that didn't exist.
In Fedora 32, dnf starts to fail the entire command:

  No match for argument: python-gobject-base
  Error: Unable to find a match: python-gobject-base

Since this script is supposed to work with different RHEL/Fedora
versions, it's expected that not all packages are available everywhere.

Fix that, by installing packages that we know that they might be missing
one by one (and ignore the error).

(cherry picked from commit 185567559c)
2019-09-25 15:52:17 +02:00
Thomas Haller
ae2d6c0bc9 tests: fix "clients/tests/test-client.py" concatenating binary for Python 3
Python 3 doesn't like this:

    ======================================================================
    ERROR: test_001 (__main__.TestNmcli)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "./clients/tests/test-client.py", line 785, in f
        self._nm_test_post()
      File "./clients/tests/test-client.py", line 767, in _nm_test_post
        content_new = ''.join([r['content'] for r in results])
    TypeError: sequence item 0: expected str instance, bytes found

(cherry picked from commit 97646d81ce)
2019-09-25 15:52:17 +02:00
Thomas Haller
992c5abb53 tests: don't compare string literal with "is" in "clients/tests/test-client.py"
Recent Python versions warn about this:

  ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is de:
  ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is pl:

And rightly so: https://bugs.python.org/issue34850

(cherry picked from commit 989b26a843)
2019-09-25 15:52:17 +02:00
Thomas Haller
a2af6cc298 tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py"
test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead
  id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP,

(cherry picked from commit ceae05cc4b)
2019-09-25 15:52:17 +02:00