Commit graph

23842 commits

Author SHA1 Message Date
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
Thomas Haller
c44c796a90 contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package
"NetworkManager-wifi" package requires either wpa_supplicant or iwd.
When installing the package without explicitly installing supplicant
or iwd (and not having it installed yet), then we want to drag in
wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant
package.

Otherwise, the user installing NetworkManager-wifi might get iwd,
which is only functioning if the user explicitly enables the backend
in "NetworkManager.conf".

https://bugzilla.redhat.com/show_bug.cgi?id=1743585
(cherry picked from commit 4b1cb404fd)
2019-09-23 13:30:17 +02:00
Thomas Haller
2d7195fc9d wifi/p2p: fix crash due to invalid signal handler supplicant_group_iface_group_finished_cb()
Fixes: 00e64d1332 ('core/devices: Add P2P Wifi device and peer tracking')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/249

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/284
(cherry picked from commit 9aa6c676ef)
2019-09-23 13:24:06 +02:00
Thomas Haller
d49e96649f core: merge branch 'th/check-have-connection-for-auto-default'
https://bugzilla.redhat.com/show_bug.cgi?id=1727909

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/232

(cherry picked from commit c03defa3a8)
2019-09-23 13:21:07 +02:00
Thomas Haller
cdb719c756 settings: drop redundant check from have_connection_for_device()
have_connection_for_device() really should just call nm_device_check_connection_compatible().
Note that nm_device_check_connection_compatible() of course checks the
connection type already, so this is redundant.

(cherry picked from commit 2a506d8a09)
2019-09-23 13:20:45 +02:00
Thomas Haller
bad64d1cf6 settings: shortcut check for whether to create auto-default wired connection
This check is only useful for devices that implement new_default_connection.
We can shortcut the possibly expensive checks like have_connection_for_device(),
which need to iterate all profiles.

(cherry picked from commit 3e39d2a586)
2019-09-23 13:20:45 +02:00
Thomas Haller
04c5cc5a5c core: fix wrongly generating "Wired connection 1" (auto-default) for ethernet with MAC
If a profile has only "ethernet.mac-address" set, but
"connection.interface-name" not, then the previous check

    iface = nm_setting_connection_get_interface_name (s_con);
    if (!nm_streq0 (iface, nm_device_get_iface (device)))
         continue;

would wrongly consider the profile not matching for the device.
As a result, we would wrongly create a auto-default connection.

Fix that. We already call nm_device_check_connection_compatible()
above. That is fully suitable to compare the interface name and
the MAC address. We don't need to duplicate this check (wrongly).

See also commit 77d01c9094 ('settings: ignore incompatible connections
when looking for existing ones') for how this code changed.

https://bugzilla.redhat.com/show_bug.cgi?id=1727909
(cherry picked from commit 5aa50d7c87)
2019-09-23 13:20:45 +02:00
Beniamino Galvani
900eb63cf3 tui: wifi: support WPA3-Personal (SAE)
(cherry picked from commit b57f8d93e2)
2019-09-20 13:23:47 +02:00
Beniamino Galvani
7686415ad2 libnm-core: support SAE when determining AP compatibility
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/172
(cherry picked from commit 84a86ce55f)
2019-09-20 13:23:46 +02:00
Beniamino Galvani
9a5935f716 device: accept lease only after addresses are configured
In the accept() callback, the nettools client creates a UDP socket
with the received address as source, so the address must be already
configured on the interface.

Also, handle errors returned by nm_dhcp_client_accept().

Fixes: 401fee7c20 ('dhcp: support notifying the client of the result of DAD')
(cherry picked from commit 8b5bf6e4d1)
2019-09-18 09:38:54 +02:00
Beniamino Galvani
06e4c877dd n-dhcp4: arm timers in bound state
Arm timers when the bound state is reached, otherwise the lease is
never renewed.

https://github.com/nettools/n-dhcp4/pull/4
(cherry picked from commit 687d0dd95e)
2019-09-18 09:38:52 +02:00