Commit graph

12310 commits

Author SHA1 Message Date
Lubomir Rintel
e1cda0150c wifi: fix the supplicant config test
Oopsie, forgot to adjust the test for change in roaming signal strength
threshold.

Fixes: 24bbceed9b ('wifi: roam more aggressively'):
2019-09-20 16:24:40 +02:00
Kristian Klausen
24bbceed9b wifi: roam more aggressively
-80dBm is a very weak signal and we should roam sooner.
iwd[1] and iOS[2] default to -70dBm, Android[3] default to -73dBm.
So lets change the roaming threshold to -70dBm.

[1] https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=45a51613c4c24067fe0e35b4c084a50124282b36
[2] https://support.apple.com/en-us/HT203068
[3] 68a4599a37/core/res/res/values/config.xml (609)
    dacacbf69d/service/java/com/android/server/wifi/ScoringParams.java (218)
    dacacbf69d/service/java/com/android/server/wifi/ScoringParams.java (325)
    ee0920fb68/service/java/com/android/server/wifi/WifiNetworkSelector.java (149)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/201
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/278
2019-09-20 12:57:16 +02:00
Beniamino Galvani
9c123cdd3f device: keep client running after activation failure
If DHCPv4 fails but IPv6 succeeds it makes sense to continue trying
DHCP so that we will eventually be able to get an address if the DHCP
server comes back. Always keep the client running; it will be only
terminated when the connection is brought down.

https://bugzilla.redhat.com/show_bug.cgi?id=1688329
2019-09-18 09:29:51 +02:00
Beniamino Galvani
8b5bf6e4d1 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')
2019-09-18 09:29:51 +02:00
Beniamino Galvani
c1c970f1b1 libnm: export reload flags
Flags to the manager Reload() method are stable API but not exposed in
a public header. Export them.
2019-09-17 09:30:18 +02:00
Beniamino Galvani
c177a38e88 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')
2019-09-16 16:21:35 +02:00
Francesco Giudici
07b3ecbb7a dhcp: nettools: drop useless "options" GHashTable checks 2019-09-13 18:44:32 +02:00
Francesco Giudici
86973eae1f dhcp: nettools: add utf8 checking on the wpad option
and assert values exported as dhcp options are utf8 compliant
2019-09-13 18:44:32 +02:00
Francesco Giudici
3a10c47786 dhcp: nettools: drop the 'iface' parameter when no more used
Drop it from the functions for extracting the dhcp options from the
lease: it was just used for the logging, but now we log all the options
once, at the end of the process.
2019-09-13 18:44:32 +02:00
Francesco Giudici
6945ecb804 dhcp: nettools: drop plugin logging of the lease options
as these are already logged in common dhcp-client code. Moreover, now
the log level of the lease options will move from INFO to DEBUG.
2019-09-13 18:44:32 +02:00
Francesco Giudici
fff39e4a88 dhcp: internal: drop plugin logging of the lease options
as these are already logged in common dhcp-client code.
2019-09-13 18:44:32 +02:00
Francesco Giudici
862177f6b6 dhcp: log the dhcp options got in the lease once for all plugin
Each plugin logged the options: just do that on dhcp state change and do
in common code.
Log the options at INFO level for all the plugins. This partially reverts
the effects on the internal plugin of the commit:
97ce488f5f ('dhcp/internal: decrease logging level when
retrieving dhcp options')
2019-09-13 18:44:32 +02:00
Francesco Giudici
dbd9ed1c62 dhcp: nettools: retrieve and expose the private dhcp options 2019-09-13 18:44:32 +02:00
Francesco Giudici
cded6d5184 dhcp: nettools: retrieve and expose the expiry time
also fix the lease time: it should be the time in seconds that the lease
lasts
2019-09-13 18:44:32 +02:00
Beniamino Galvani
8cd8a5fbed 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
2019-09-13 14:26:21 +02:00
Lubomir Rintel
7c53930ceb wwan/modem-broadband: add capability to look up default APN/username/password
This allows the GSM connection to Just Work most of the time, as in:
"nmcli d connect ttyUSB0".
2019-09-11 14:32:05 +02:00
Lubomir Rintel
0d44b640fc wwan/modem-broadband: get rid of g_assert*()
Though there is no known way to reach these, it may well happen that
this is going to prevent some hard crashes.
2019-09-11 14:32:05 +02:00
Lubomir Rintel
6e5385a4eb wwan/tests: test service-providers.xml parser
Just a handful of unit tests.
2019-09-11 14:32:05 +02:00
Lubomir Rintel
6632c77094 wwan: add service-providers.xml parser
This allows up to look up a default APN if the user doesn't pick one.
2019-09-11 14:32:05 +02:00
Lubomir Rintel
5730b0ff46 wwan: remove an accidentally committed file
Fixes: 7a72c705ac ('initrd: add devicetree support')
2019-09-11 14:24:45 +02:00
Lubomir Rintel
24028a2246 all: SPDX header conversion
$ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
2019-09-10 11:19:56 +02:00
Lubomir Rintel
7a72c705ac initrd: add devicetree support
This adds capability to hand over the network configuration from
OpenFirmware (and potentially other boot loaders with openfirmware
support such as U-Boot) to NetworkManager.

It's done analogously to ACPI/iBFT. In fact, the same ip=ibft command
line option is used, adding a more general ip=fw alias. This probably
deserves some documentation, but I'm not adding any at this time.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/257
2019-09-10 11:04:51 +02:00
Lubomir Rintel
f537056589 platforn/linux: don't fall back to WEXT for OLPC Mesh
nl80211 offers the same functionality sans the bugs.
2019-09-07 17:22:00 +02:00
Lubomir Rintel
13bd678dd5 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.
2019-09-07 17:22:00 +02:00
Lubomir Rintel
ad86ee4d48 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.
2019-09-07 17:22:00 +02:00
Lubomir Rintel
cc96771f32 wifi: add OLPC Mesh support via nl80211 2019-09-07 17:22:00 +02:00
Francesco Giudici
9f89516928 dhcp: nettools: read/write lease files
Use the same format of systemd-netword, so that we will be compatible
with the leases created/read by the current "internal" plugin.
Note that actually only the leased address is processed when reading a
lease file, so no need to save more than the ip address when saving the
lease.
2019-09-05 12:13:36 +02:00
Francesco Giudici
f60a60a0d0 dhcp: dhclient: use the shared function to retrieve the lease file path
... but leave in place the custom checks dependant on the dhclient plugin
2019-09-05 12:13:36 +02:00
Francesco Giudici
ee20761ea8 dhcp: prefer nm_assert() to g_assert*() 2019-09-05 12:13:36 +02:00
Francesco Giudici
89814d90aa dhcp: internal: use the shared function to retrieve the lease file path 2019-09-05 12:13:36 +02:00
Francesco Giudici
afb9bb0dac dhcp: add a shared function to retrieve the dhcp lease file
For each plugin we try to come up with a lease file constructed in the
same way, i.e., plugin name + iface + connection duid. If the file isn't
already there, for some plugins (dhclient) we do extra checks in order
to allow to use lease files generated outside of NetworkManager. Let's
allow to generate the common NetworkManager dhcp lease file name in a
shared function, reporting to the caller if the file isn't already there,
so that further plugin specific checks can be performed if needed.
2019-09-05 12:13:36 +02:00
Beniamino Galvani
2ca8b511e6 core: add audit log for the SaveHostname call
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/260
2019-09-05 11:42:01 +02:00
Beniamino Galvani
4bd192a350 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.
2019-09-05 11:41:57 +02:00
Thomas Haller
de6f0bc6db 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).
2019-09-03 18:13:27 +02:00
Beniamino Galvani
f07aa329b2 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
2019-09-03 16:53:04 +02:00
Beniamino Galvani
4bc4156424 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.
2019-09-03 16:53:04 +02:00
Beniamino Galvani
eec6951949 device: fix crash when master connection fails
When the master AC becomes ready, activate_stage1_device_prepare() is
called in a idle handler. If the master AC fails in the meantime, it
will change state to deactivating or deactivated. We must check for
that condition before proceeding with slave activation. Note the the
'master_ready' flag of an AC is never cleared after it is set.

Fixes: 5b677d5a3b ('device: move check for master from nm_device_activate_schedule_stage2_device_config() to end of stage1')

https://bugzilla.redhat.com/show_bug.cgi?id=1747998
2019-09-03 09:00:44 +02:00
Beniamino Galvani
5a534529e2 ipv6: disable kernel handling of RAs (accept_ra)
With accept_ra set to 1, kernel sends its own router solicitation
messages and parses the advertisements. This duplicates what NM
already does in userspace and has unwanted consequences like [1] and
[2].

The only reason why accept_ra was re-enabled in the past was to apply
RA parameters like ReachableTime and RetransTimer [3]; but now NM
supports them and so accept_ra can be turned off again.

Also, note that previously the option was set in
addrconf6_start_with_link_ready(), and so this was done only when the
method was 'auto'. Instead, now we clear it for all methods except
'ignore'.

[1] https://mail.gnome.org/archives/networkmanager-list/2019-June/msg00027.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1734470
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1068673
2019-08-30 09:53:04 +02:00
Beniamino Galvani
5f0c6f8d3b ipv6: set neighbor parameters from RAs
IPv6 router advertisement messages contain the following parameters
(RFC 4861):

 - Reachable time: 32-bit unsigned integer.  The time, in
   milliseconds, that a node assumes a neighbor is reachable after
   having received a reachability confirmation.  Used by the Neighbor
   Unreachability Detection algorithm.  A value of zero means
   unspecified (by this router).

 - Retrans Timer: 32-bit unsigned integer.  The time, in milliseconds,
   between retransmitted Neighbor Solicitation messages.  Used by
   address resolution and the Neighbor Unreachability Detection
   algorithm.   A value of zero means unspecified (by this router).

Currently NM ignores them; however, since it leaves accept_ra=1, the
kernel parses RAs and applies those parameters for us [1].

In the next commit kernel handling of RAs will be disabled, so let NM
set those neighbor-related parameters.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv6/ndisc.c?h=v5.2#n1353
2019-08-30 09:53:04 +02:00
Beniamino Galvani
c0a825bc8e dhcp: fall back to 'internal' client for IPv6 when using 'nettools'
The 'nettools' client doesn't support IPv6, fall back to 'internal'.
2019-08-29 09:39:42 +02:00
Thomas Haller
79952b6296 device: after stage1 call stage2 synchronously
We know we are ready and in a situation where we can handle state changes.
Don't schedule stage2 in an idle handler, just invoke it directly.
2019-08-28 16:27:00 +02:00
Thomas Haller
5b677d5a3b device: move check for master from nm_device_activate_schedule_stage2_device_config() to end of stage1
Note that by now no callers of nm_device_activate_schedule_stage2_device_config()
are left. All previous callers now re-schedule stage1 instead of directly
scheduling stage2.
Note that if stage2 later also gets re-factored to re-enter itself
instead of scheduling stage3 right away, the function will be used
again.

That means, we can move the check for the master where it belongs: as
part (and at the end of) stage1.

Also, slightly simplify the code. The handler master_ready_cb()
no longer directly calls master_ready(). It's enough to always
enter stage1 again.

Also drop master_ready_handled. We don't need to remember that this
condition was satsified. We can just check it always when we reach
the place in activate_stage1_device_prepare().
2019-08-28 16:27:00 +02:00
Thomas Haller
29562a9751 device: let devices call stage1 again after being ready to proceed
I am about to change the when stage1 gets postponed, then the way to
proceed it is to schedule stage1 again (instead of scheduling stage2).

The reason is that stage1 handling should be reentrant and we should
keep entering it until there is no more reason to postpone it. If
a subclass postpones stage1 and then later progresses it by directly
scheduling stage2, then only the subclass is in control over postponing
stage 2.

Instead, anybody should be able to delay stage2 independently. That can
only work if everybody signals readyness to proceed by scheduling stage1
again.
2019-08-28 16:27:00 +02:00
Thomas Haller
86f8f5a71c device/wifi-p2p: inline and drop local function cleanup_p2p_connect_attempt()
It has only one caller. It's clearer to do the cleanup right there.
2019-08-28 16:27:00 +02:00
Thomas Haller
51ddbda5d2 device/team: don't remember connection while killing team
We don't need this. The applied-connection is already remembered
and suitable.
2019-08-28 16:27:00 +02:00
Thomas Haller
efa3b5b443 device/team: various cleanups 2019-08-28 16:27:00 +02:00
Thomas Haller
34895adcc4 device: set failure reason when settings hardware address fails 2019-08-28 16:27:00 +02:00
Thomas Haller
e034cc3264 device: let NMDevice set hardware address instead of act_stage1_prepare() for NMDeviceEthernet
There is a small change in the order of actions. Now we set the MAC address before
calling link_negotiation_set(). That shouldn't make a difference.
2019-08-28 16:27:00 +02:00
Thomas Haller
2d40b7ba61 device: let NMDevice set hardware address instead of act_stage1_prepare() 2019-08-28 16:27:00 +02:00
Thomas Haller
de439148dd device: move redundant act_stage1_prepare() implementations to set hwaddr to NMDevice
This is so common, that NMDevice can handle it for us.
2019-08-28 16:27:00 +02:00