Commit Graph

21076 Commits

Author SHA1 Message Date
Lubomir Rintel
c630a6a2c9 platform/linux: recognize 6LoWPAN links 2018-06-26 16:21:54 +02:00
Lubomir Rintel
4e3d2f5a85 platform/linux: recognize WPAN links 2018-06-26 16:21:54 +02:00
Lubomir Rintel
dbb205d8d2 platform: import nl82154.h
This is public Linux API, yet the header is not in uapi.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
dfa8d35e57 netlink: add signed 8-bit and 32-bit accessors 2018-06-26 16:21:54 +02:00
Lubomir Rintel
732b63ffb7 paltform: add type argument to nm_platform_link_get_by_address()
Devices of different link types can actually have the same MAC address.
We'll want to use this to find a device of a particular type by its
hardware address.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
6371f399ae platform: move the management of the genl socket to linux-platform
We're fine with a single genl socket instead of opening a new one for each
WifiData instance.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
123b79518c platform: attach WifiData to NMPObject
This fixes leakage of the WifiData structures.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
0b4010d740 platform: don't initialize pllink when not needed 2018-06-26 16:21:54 +02:00
Lubomir Rintel
787dc484b3 platform/wifi: turn NMWifiUtils into a GObject 2018-06-26 16:21:54 +02:00
Lubomir Rintel
91c82cc465 platform/wifi: rename wifi-utils to nm-wifi-utils 2018-06-26 16:21:54 +02:00
Lubomir Rintel
d18d532c15 platform/wifi: drop wifi_utils_get_ifindex()
It's not used.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
fc53f54512 device: don't bother passing no_firmware uselessly
It's actually confusing in cases it's not handled. Besides,
nm_device_bring_up() is just happy about NULL argument.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
ff10d08079 setting-serial: drop verify()
We don't need to override this if it always succeeds.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
2c3a14fed3 platform/wifi: drop *_get_wowlan()
It's redundant and was probably just left in a an oversight.
*_get_wake_on_wlan() now does the same thing.
2018-06-26 16:21:54 +02:00
Thomas Haller
cee8b56d3f clients: merge branch 'th/clients-tests-colored'
https://github.com/NetworkManager/NetworkManager/pull/146
2018-06-26 11:38:16 +02:00
Thomas Haller
3ec62e41de clients/tests: add tests for coloring 2018-06-26 11:32:39 +02:00
Thomas Haller
94ecdc0cb9 cli: rework check-colors to first evaluate enabled/disabled
With --color=auto, coloring is enabled based on the .enable/.disable
termcolors files.

Likewise, when we enable coloring, we parse the color palette from the
.schem termcolors files.

The termcolors files are searched by finding the best match depending
on the terminal and application name. Note, that if we find a matching
file like "nmcli@xterm.enable" we still allow loading the palette from
a less specific file like "nmcli.schem" and vice versa. That was already
done before.

Previously, the search was done by calling several layers of functions, and having
in/out arguments "color_option" and "p_palette_buffer". in/out paramters
here seems confusing to me, as they are state that gets modified and carried
along.

Instead, rework the functions to clearly separate between input
and output arguments.

Also, in the auto-case, check_colors() now first determines whether
coloring is enabled, before even starting loading the palette.
This avoids loading the palette until we are sure that we need it.
2018-06-26 11:32:39 +02:00
Thomas Haller
0a82ace5b0 cli: only modify color platte when parsing is successful in parse_color_scheme()
If the palette cannot be parsed successfully, it should not partially
be modifid.
2018-06-26 11:32:39 +02:00
Thomas Haller
dbc5eefedb cli: drop unused color_option argument from check_colors_file() 2018-06-26 11:32:39 +02:00
Thomas Haller
0be07d0815 cli: avoid passing NmCli to set_color() functions
The NmCli variables is essentially a global variable of *everything*.
The set_color() function and its helpers only need a particular
part of it. Instead, of passing the entire global state to them,
only pass what they need.

It makes it clearer which parts are actually relevant. Turns out,
it only actually touches a resonable small part of the global state.
2018-06-26 11:32:39 +02:00
Thomas Haller
141696b4e3 libnm-glib/tests: retry nm-client tests for libnm-glib
They are known to be racy and occasionally break. Especially in
cases where the system's CPU is busy, like during parallel
`make check -j`.

It's likely a bug in libnm-glib. libnm-glib is deprecated, and the
library didn't significantly change now for several releases.
Let's not invest effort into finding bugs in the deprecated library,
bugs that are known to exist. Also, at this point, larger rework
of libnm-glib is not going to happen anymore.

Retry the test up to 5 times, trying to workaround the test failures.

(cherry picked from commit 372c0eb3ed)
2018-06-25 12:33:39 +02:00
Thomas Haller
372c0eb3ed libnm-glib/tests: retry nm-client tests for libnm-glib
They are known to be racy and occasionally break. Especially in
cases where the system's CPU is busy, like during parallel
`make check -j`.

It's likely a bug in libnm-glib. libnm-glib is deprecated, and the
library didn't significantly change now for several releases.
Let's not invest effort into finding bugs in the deprecated library,
bugs that are known to exist. Also, at this point, larger rework
of libnm-glib is not going to happen anymore.

Retry the test up to 5 times, trying to workaround the test failures.
2018-06-25 12:31:31 +02:00
Thomas Haller
e2ef7cad57 tests: add nmtstc_auto_service_cleanup macro 2018-06-25 12:13:28 +02:00
Beniamino Galvani
4c2e7b6d4d bond: fix setting num_grat_arp option
'num_grat_arp' and 'num_unsol_na' are actually the same attribute on
kernel side, so if only 'num_grat_arp' is set in configuration, we
first write its value and then overwrite it with the 'num_unsol_na'
default value (1). Instead, just write one of the two option.

https://bugzilla.redhat.com/show_bug.cgi?id=1591734
(cherry picked from commit 42b0bef33c)
2018-06-25 10:53:42 +02:00
Beniamino Galvani
42b0bef33c bond: fix setting num_grat_arp option
'num_grat_arp' and 'num_unsol_na' are actually the same attribute on
kernel side, so if only 'num_grat_arp' is set in configuration, we
first write its value and then overwrite it with the 'num_unsol_na'
default value (1). Instead, just write one of the two option.

https://bugzilla.redhat.com/show_bug.cgi?id=1591734
2018-06-25 10:52:02 +02:00
Thomas Haller
b32c03c879 clients: fix using hints for 802-1x secret request
https://github.com/NetworkManager/NetworkManager/pull/139

Fixes: 1a6e53808d
(cherry picked from commit 55598d8104)
2018-06-24 14:16:13 +02:00
Thomas Haller
55598d8104 clients: fix using hints for 802-1x secret request
https://github.com/NetworkManager/NetworkManager/pull/139

Fixes: 1a6e53808d
2018-06-24 14:15:42 +02:00
Beniamino Galvani
f532ceb883 device: merge branch 'bg/mtu-rh1586191'
https://bugzilla.redhat.com/show_bug.cgi?id=1586191

(cherry picked from commit cbfe9a6e16)
2018-06-23 12:04:59 +02:00
Beniamino Galvani
b445c59f2e device: rework mtu priority handling
If commit_mtu() is called multiple times and dev->get_configured_mtu()
returns @is_user_config=FALSE, only the first call changes the
MTU. So, for example, when the parent MTU of a VLAN changes, we apply
the new MTU only the first time.

Rework the handling of MTU in NMDevice, and store the source of the
configured MTU. When commit_mtu() is called again, we ask the subclass
a MTU to configure and apply it only if the source has higher
priority, or when the parent MTU changed.

(cherry picked from commit 2f8917237f)
2018-06-23 12:03:43 +02:00
Beniamino Galvani
ccecc6db59 device: introduce mtu source
Instead of returning a boolean @is_user_config value from
get_configured_mtu(), return an mtu-source enum with possible values
NONE,CONNECTION. This enum will be expanded later; for now there is no
change in behavior.

(cherry picked from commit 9f8b0697de)
2018-06-23 12:03:40 +02:00
Beniamino Galvani
ef0b76a0ec device: introduce nm_device_get_configured_mtu_from_connection()
Deduplicate similar code from devices.

(cherry picked from commit d9df1f1d05)
2018-06-23 12:03:37 +02:00
Beniamino Galvani
52e7d6ef46 libnm-core: reject tc configurations with duplicate elements
A configuration with duplicate tc qdiscs and tfilters is not valid;
reject it in verify(). Note that nm_setting_tc_config_add_qdisc() and
nm_setting_tc_config_add_tfilter() can't add duplicate entries and so
the only way to achieve an invalid configuration is setting the
properties directly.

https://github.com/NetworkManager/NetworkManager/pull/95
(cherry picked from commit 2576e3a8e8)
2018-06-23 11:52:24 +02:00
Beniamino Galvani
2576e3a8e8 libnm-core: reject tc configurations with duplicate elements
A configuration with duplicate tc qdiscs and tfilters is not valid;
reject it in verify(). Note that nm_setting_tc_config_add_qdisc() and
nm_setting_tc_config_add_tfilter() can't add duplicate entries and so
the only way to achieve an invalid configuration is setting the
properties directly.

https://github.com/NetworkManager/NetworkManager/pull/95
2018-06-23 11:47:40 +02:00
Thomas Haller
ae393ed9ba wifi: merge branch 'balrog-kun:iwd-agent'
https://github.com/NetworkManager/NetworkManager/pull/139

(cherry picked from commit 5e8773ee63)
2018-06-22 16:46:11 +02:00
Thomas Haller
df4c62a9c2 manager: return NULL for invalid ifindex in nm_manager_get_device_by_ifindex()
Internally, the device migth have negative or zero ifindex.
When calling nm_manager_get_device_by_ifindex(), the caller
wants to find a device with a valid ifindex, hence filter
out non-positive values.

(cherry picked from commit 31245cdd62)
2018-06-22 16:46:05 +02:00
Thomas Haller
97de856036 wifi/iwd: downgrade error levels for agent-request failures
<error> level is for something really bad happening. When another party
(iwd in this case) sends a D-Bus request that we cannot meaningfully handle,
that is hardly reason to warn about. <debug> level is enough in this case.

Also, give all messages a common prefix "agent-request" so that we have
something to grep for.

(cherry picked from commit aef5110fa6)
2018-06-22 16:46:05 +02:00
Thomas Haller
759fbf08de wifi/iwd: fix leaking name-owner in agent_dbus_method_cb()
(cherry picked from commit 412a1fb46d)
2018-06-22 16:46:05 +02:00
Thomas Haller
991ae93862 wifi/iwd: don't check return value for nm_utils_random_bytes()
nm_utils_random_bytes() will always try its best to give some
random numbers. A failure only means, that the kernel interfaces
get_random() or /dev/urandom failed to provide good randomness. We
don't really need good random numbers here, so no need to handle
a failure.

(cherry picked from commit 44cd60e820)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
bf7705a4b8 settings-connection: don't expect system_secrets always present
priv->system_secrets may be updated by e.g.
nm_settings_connection_new_secrets and nm_settings_connection_update,
but if the plugin creates the object with g_object_new, then adds some
settings but never adds any secrets there's no reason to call either of
those two methods.  A call to nm_settings_connection_get_secrets should
still be able to request new secrets (and may then update
priv->system_secrets as a result).

(cherry picked from commit f11246154e)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
d1163e9499 cli: use the hints from 802.1x secrets requests if given
If the hints parameter to the agent request wasn't empty, ask
specifically for the 802-1x keys listed in the hints and skip the
guessing.  I didn't add human readable names for all of the 802-1x
settings, it could be useful to do for at least the three 802-1x
properties that add_8021x_secrets already knows about because
those may have translations.

(cherry picked from commit 1a6e53808d)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
74bff39e0d iwd: don't set REQUEST_NEW secret request flag on first connection
Allow the IWD backend to use secrets provided in the connection settings
on initial connection attempt, only require new secrets on subsequent
connections when IWD asks for them -- it only asks if fresh secrets are
required.

(cherry picked from commit 24f5cf23e5)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
1e5e143679 iwd: handle new secret request types from IWD agent
The IWD DBus interface currently
(https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/doc/agent-api.txt?id=38952813dddd776f66d2ed5e88eca9a892964c06)
knows about 3 secret types related to 802.1x authentication in addition
to the PSK secret request.  Add support for the new methods and the new
secret types in NM's implementation of the IWD secret agent.  Note that
the secret types are mapped to NMSetting8021x property keys and they are
then sent to the NM Secret Agent in the hints parameter to GetSecrets,
this will need support in the NM clients as the exact usage of the
hints parameter is specified a little ambiguously, but this seems to be
one of the permitted usages.

Rework the IWD agent interface info initialization to use NM convenience
macros.

(cherry picked from commit 74d9e04a66)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
5c747f729c iwd: save secrets request invocation in request user_data
To improve the code logic and reduce space for bugs, don't save the
dbus invocation object as priv->secrets_request, instead move it to
the nm_act_request_get_secrets()'s user_data as we only need the
invocation object for exactly the life time of the request.  See
https://github.com/NetworkManager/NetworkManager/pull/139 for
discussion.

(cherry picked from commit ffd96edf76)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
b733bd66af iwd: in prepare stage check that matching AP exists
Check the return value of nm_wifi_aps_find_first_compatible in
act_stage1_prepare.  Also a small formatting fix.

(cherry picked from commit 0876332bae)
2018-06-22 16:46:05 +02:00
Andrew Zaborowski
78b14312ce iwd: handle empty wireless mode as Infrastructure
Blank mode property in the wireless settings is documented in
libnm-core/nm-setting-wireless.c to mean infrastructure mode.

(cherry picked from commit d01ba607a6)
2018-06-22 16:46:04 +02:00
Thomas Haller
5e8773ee63 wifi: merge branch 'balrog-kun:iwd-agent'
https://github.com/NetworkManager/NetworkManager/pull/139
2018-06-22 16:39:26 +02:00
Thomas Haller
31245cdd62 manager: return NULL for invalid ifindex in nm_manager_get_device_by_ifindex()
Internally, the device migth have negative or zero ifindex.
When calling nm_manager_get_device_by_ifindex(), the caller
wants to find a device with a valid ifindex, hence filter
out non-positive values.
2018-06-22 16:39:01 +02:00
Thomas Haller
aef5110fa6 wifi/iwd: downgrade error levels for agent-request failures
<error> level is for something really bad happening. When another party
(iwd in this case) sends a D-Bus request that we cannot meaningfully handle,
that is hardly reason to warn about. <debug> level is enough in this case.

Also, give all messages a common prefix "agent-request" so that we have
something to grep for.
2018-06-22 16:39:01 +02:00
Thomas Haller
412a1fb46d wifi/iwd: fix leaking name-owner in agent_dbus_method_cb() 2018-06-22 16:39:01 +02:00
Thomas Haller
44cd60e820 wifi/iwd: don't check return value for nm_utils_random_bytes()
nm_utils_random_bytes() will always try its best to give some
random numbers. A failure only means, that the kernel interfaces
get_random() or /dev/urandom failed to provide good randomness. We
don't really need good random numbers here, so no need to handle
a failure.
2018-06-22 16:39:01 +02:00