Commit graph

23820 commits

Author SHA1 Message Date
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
Francesco Giudici
bf28a9e92f dhcp: nettools: retrieve and expose the expiry time
also fix the lease time: it should be the time in seconds that the lease
lasts

(cherry picked from commit cded6d5184)
2019-09-18 09:38:38 +02:00
Beniamino Galvani
7f8fdd28f2 supplicant: add FT-SAE key-mgmt to verification list
FT-SAE is missing in the supplicant configuration verification list,
causing an activation failure when using SAE and the supplicant
supports FT.

Fixes: d17a0a0905 ('supplicant: allow fast transition for WPA-PSK and WPA-EAP')
(cherry picked from commit c177a38e88)
2019-09-16 17:08:29 +02:00
Beniamino Galvani
81cc4ddb1a wifi: allow reapply when the seen-bssids property changed
wifi.seen-bssid is a synthetic read-only property that lists all the
bssids seen for that connection; it should be ignored during a
reapply.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/243
(cherry picked from commit 8cd8a5fbed)
2019-09-13 14:30:19 +02:00
Lubomir Rintel
1c950c180f platforn/linux: don't fall back to WEXT for OLPC Mesh
nl80211 offers the same functionality sans the bugs.

(cherry picked from commit f537056589)
2019-09-07 17:26:16 +02:00
Lubomir Rintel
60bff25333 wifi/olpc-mesh: fix the stage2
There's multiple things wrong there, but unnoticed because the error handling
was entirely missing or nobody is using thie anymore.

The Mesh ID needs to be set while the device is down. Also, the channel
needs to be set last, because that's what triggers the connection
attempt. For that the device needs to be up.

Also, fix the error handling.

(cherry picked from commit 13bd678dd5)
2019-09-07 17:26:16 +02:00
Lubomir Rintel
b6d7e44bd8 wifi/olpc-mesh: drop assert(companion) from get_autoconnect_allowed()
The comment is wrong. Since 6eaded9071 ('device: add
get_autoconnect_allowed() virtual function'), get_autoconnect_allowed()
is called before the device state is consulted.

(cherry picked from commit ad86ee4d48)
2019-09-07 17:26:16 +02:00
Lubomir Rintel
15e813deff wifi: add OLPC Mesh support via nl80211
(cherry picked from commit cc96771f32)
2019-09-07 17:26:16 +02:00
Beniamino Galvani
a369e61d2a build: use regexp in gtkdoc --ignore-decorators option
gtkdoc-scan supports regular expressions in the --ignore-decorators
command-line option. Since it is easier to use a regexp than grepping
macros from a source file, revert the ugly solution from commit
2d941dc95a ('build: fix errors when building with gtk-doc 1.32').

(cherry picked from commit 11cf082a62)
2019-09-06 14:22:18 +02:00
Lubomir Rintel
b2447b4169 release: bump version to 1.20.3 (development) 2019-09-05 14:44:17 +02:00
Lubomir Rintel
4ef27f896e release: bump version to 1.20.2 2019-09-05 14:33:41 +02:00
Lubomir Rintel
ee8947f11c release: update NEWS 2019-09-05 13:59:57 +02:00
Beniamino Galvani
2c0de62a47 core: add audit log for the SaveHostname call
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/260
(cherry picked from commit 2ca8b511e6)
2019-09-05 11:43:13 +02:00
Beniamino Galvani
45c903dc88 core: add defines for common authentication-related error messages
All D-Bus method call implementations use similar error messages when
authenticating requests; add defines for them to ensure the same exact
message is reused.

(cherry picked from commit 4bd192a350)
2019-09-05 11:43:11 +02:00
Beniamino Galvani
d5ed990caf build: fix errors when building with gtk-doc 1.32
gtkdoc-scan 1.32 performs stricter checks on structures definitions
and so it complains on:

 /build/networkmanager/src/NetworkManager/libnm/./nm-vpn-plugin-old.h:0: warning: partial declaration (struct) : typedef struct {
 	NM_DEPRECATED_IN_1_2
 	GObject parent;
 } NMVpnPluginOld NM_DEPRECATED_IN_1_2;

because of the unrecognized token 'NM_DEPRECATED_IN_1_2'.

Pass all allowed macros to gtkdoc-scan through the --ignore-decorators
argument.

https://gitlab.gnome.org/GNOME/gtk-doc/issues/98
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/238
(cherry picked from commit 2d941dc95a)
2019-09-05 11:25:36 +02:00
Thomas Haller
9e209138dc core/tests: avoid deprecated g_main_run()/g_main_loop_unref() in test
These are deprecated. Also, they are nowadays implemented as macros
that expand to

  #define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run)

This can cause compilation failure (in some environments).

(cherry picked from commit de6f0bc6db)
2019-09-03 18:18:48 +02:00
Beniamino Galvani
0e4d0f8d3f core: merge branch 'bg/device-realize-failed-rh1686634'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/252
https://bugzilla.redhat.com/show_bug.cgi?id=1686634
(cherry picked from commit dbfbbed53c)
2019-09-03 16:57:04 +02:00
Beniamino Galvani
5d45ac0650 manager: keep device if realize() fails
system_create_virtual_device() first creates the device (unrealized)
and then, if there a connection for the device with autoconnect=yes,
creates the backing resources. If this last step fails the device
should continue to exist, even if in an unrealized state.

https://bugzilla.redhat.com/show_bug.cgi?id=1686634
(cherry picked from commit f07aa329b2)
2019-09-03 16:56:47 +02:00
Beniamino Galvani
9d0e8e851f device: don't set nm-owned flag if realize() fails
The nm-owned flag indicates whether the device was created by NM. If
the realization step fails, the device was not created and so nm-owned
should not be updated.

(cherry picked from commit 4bc4156424)
2019-09-03 16:56:45 +02:00
Davide Palma
36ef996a5f po: fixed typo in it.po
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/259
(cherry picked from commit 6a7c2d44ae)
2019-09-03 16:07:02 +02:00
Lubomir Rintel
3c4a7cd4a9 core: fix a typo
s/grater/greater/

(cherry picked from commit 4534c6c366)
2019-09-03 16:04:48 +02:00
Thomas Haller
18dfbeefd4 keyfile: reorder printing empty [wireguard] section with peers and fix test failure
We want to print the [wireguard] section before printing sections of the
peers. It just looks nicer.

This also fixes a test failure:

  /libnm/settings/roundtrip-conversion/wireguard/2: **
  test:ERROR:./shared/nm-utils/nm-test-utils.h:2254:nmtst_keyfile_assert_data: assertion failed (d1 == data): ("[connection]\nid=roundtrip-conversion-2\nuuid=63376701-b61e-4318-bf7e-664a1c1eeaab\ntype=wireguard\ninterface-name=ifname2\npermissions=\n\n[wireguard-peer.uoGoXWWRxJvu4jDva8pPGA4nxau8B33S+YR+MfPFjxc=]\nendpoint=192.168.255.180:30429\npreshared-key-flags=2\n\n[wireguard-peer.BED73rH9j3OCHYAeXNrW5y5oia/Ngj+M04e9sG7DQOo=]\nendpoint=192.168.188.253:30407\npreshared-key-flags=1\npersistent-keepalive=5070\nallowed-ips=192.168.215.179/32;192.168.120.249/32;a🅱️c::e4:13/128;192.168.157.84/32;a🅱️c::1b:df/128;a🅱️c::b0:84/128;192.168.168.17/32;\n\n[wireguard]\n\n[ipv4]\ndns-search=\nmethod=disabled\n\n[ipv6]\naddr-gen-mode=stable-privacy\ndns-search=\nmethod=ignore\n\n[proxy]\n" == "[connection]\nid=roundtrip-conversion-2\nuuid=63376701-b61e-4318-bf7e-664a1c1eeaab\ntype=wireguard\ninterface-name=ifname2\npermissions=\n\n[wireguard]\n\n[wireguard-peer.uoGoXWWRxJvu4jDva8pPGA4nxau8B33S+YR+MfPFjxc=]\nendpoint=192.168.255.180:30429\npreshared-key-flags=2\n\n[wireguard-peer.BED73rH9j3OCHYAeXNrW5y5oia/Ngj+M04e9sG7DQOo=]\nendpoint=192.168.188.253:30407\npreshared-key-flags=1\npersistent-keepalive=5070\nallowed-ips=192.168.215.179/32;192.168.120.249/32;a🅱️c::e4:13/128;192.168.157.84/32;a🅱️c::1b:df/128;a🅱️c::b0:84/128;192.168.168.17/32;\n\n[ipv4]\ndns-search=\nmethod=disabled\n\n[ipv6]\naddr-gen-mode=stable-privacy\ndns-search=\nmethod=ignore\n\n[proxy]\n")

Fixes: ddd148e02b ('keyfile: let keyfile writer serialize setting with all default values')
(cherry picked from commit 576a128954)
2019-09-02 13:21:01 +02:00
Beniamino Galvani
30d2f6cacc dhcp: fall back to 'internal' client for IPv6 when using 'nettools'
The 'nettools' client doesn't support IPv6, fall back to 'internal'.

(cherry picked from commit c0a825bc8e)
2019-08-29 09:55:32 +02:00