Commit graph

10851 commits

Author SHA1 Message Date
Francesco Giudici
7443e75d22 manager/trivial: fix typo in comment 2018-06-27 14:44:24 +02:00
Thomas Haller
2ccf6168dc logging: warn about invalid logging backends and drop "debug" backend
"debug" was documentation in `man NetworkManager.conf` as a valid
logging backend. However, it was completely ignored by
nm_logging_syslog_openlog().
In fact, it makes not sense. Passing debug = TRUE to
nm_logging_syslog_openlog(), means that all messages will be
printed to stderr in addition to syslog/journal. However, when
NetworkManager is daemonizing, stderr is closed.
Whether NetworkManager is daemonizing depends entirely on command
line options --no-daemon and --debug. Hence, the logging backend "debug"
from the configuration file either conflicts or is redundant.

Also, adjust logging backend description in `man NetworkManager.conf`.

Also, log a warning about invalid/unsupported logging backend.
2018-06-27 09:16:04 +02:00
Thomas Haller
504ad2aeed logging/trivial: add code comment about logging-backend 2018-06-27 09:14:36 +02:00
Thomas Haller
2912155584 logging: move fetching monotonic timestamp to end of nm_logging_syslog_openlog()
It just makes more sense to first fully setup logging, and then fetching
the timestamp. In practice, the effect previously was very similar.
2018-06-27 09:14:36 +02:00
Thomas Haller
4439b6a35d main: warn about invalid logging domains configuration using nm-log
Delay warning about invalid domains until we setup syslog and nm-logging.
Preferably, we don't log anything by directly printing to stdout/stderr.
2018-06-27 09:14:36 +02:00
Thomas Haller
11303fd2d1 main: accept invalid logging configuration in NetworkManager.conf gracefully
https://bugzilla.redhat.com/show_bug.cgi?id=1593519
2018-06-27 09:14:36 +02:00
Thomas Haller
9e20ba6646 main: free error variable in main() at exit
Just try to free everything that was allocated. Don't leak
error in case of failure.
2018-06-27 09:14:36 +02:00
Lubomir Rintel
b7173ad7a7 devices: add NMDevice6Lowpan 2018-06-26 16:21:55 +02:00
Lubomir Rintel
2af11440f9 platform/linux: add support for 6LoWPAN links 2018-06-26 16:21:55 +02:00
Lubomir Rintel
47c51b3f26 platform: add support for 6LoWPAN links
The 6LoWPAN devices tunnel IPv6 over IEEE 802.14.5 WPAN links.
They are software devices without any interesting properties but the
parent linke.
2018-06-26 16:21:55 +02:00
Lubomir Rintel
49844ea55f device: generate pseudo 48-bit address from the WPAN short one
If an IEEE 802.15.4 WPAN device has a short address it is to be used to
get an interface identifier.
2018-06-26 16:21:55 +02:00
Lubomir Rintel
1d396e9972 core-utils: use 64-bit WPAN address for a 6LoWPAN IID
If the hardware address is a 64-bit value it can be used directly as an
IEEE EUI-64 address when generating an interface identifier.
2018-06-26 16:21:55 +02:00
Lubomir Rintel
179909a4f2 devices: add NMDeviceWpan 2018-06-26 16:21:54 +02:00
Lubomir Rintel
a7d2cad67e platform/linux: add support for WPAN links 2018-06-26 16:21:54 +02:00
Lubomir Rintel
4120ad2431 platform/wpan: add WPAN utils
Modelled after wifi-utils, sans the complexity of dispatching to anything like
WEXT.
2018-06-26 16:21:54 +02:00
Lubomir Rintel
5036406b58 platform: add support for WPAN links 2018-06-26 16:21:54 +02:00
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
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
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
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
Andrew Zaborowski
f11246154e 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).
2018-06-22 16:39:01 +02:00
Andrew Zaborowski
24f5cf23e5 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.
2018-06-22 16:39:01 +02:00
Andrew Zaborowski
74d9e04a66 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.
2018-06-22 16:39:01 +02:00
Andrew Zaborowski
ffd96edf76 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.
2018-06-22 16:39:01 +02:00
Andrew Zaborowski
0876332bae 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.
2018-06-22 16:39:01 +02:00
Andrew Zaborowski
d01ba607a6 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.
2018-06-22 16:39:01 +02:00
Beniamino Galvani
a2b85d5c6e manager: fix typo in 'PrimaryConnectionType' D-Bus property name
Fixes: 297d4985ab
2018-06-22 15:53:46 +02:00
Thomas Haller
a3289400d3 wifi: ensure wake-on-wlan restore only acts once
- in wake_on_wlan_restore(), if we decide that there is something
  to restore, also clear priv->wowlan_restore by setting it to
  IGNORE. That way, we are sure to only try resetting the value
  once after setting it.

- from nm_platform_wifi_get_wake_on_wlan(), return IGNORE if
  the value cannot be read. If we could not read the value
  we should not restore NONE, but don't restore.
2018-06-22 14:03:48 +02:00
Alfonso Sánchez-Beato
c6e40215ef devices: restore past WoWLAN when disconnecting wifi
Restore previous WoWLAN settings on disconnection in case we had
configured it when connecting.
2018-06-22 13:54:37 +02:00
Alfonso Sánchez-Beato
ac13027934 platform: add methods to retrieve current WoWLAN state 2018-06-22 13:54:37 +02:00
Beniamino Galvani
2f8917237f 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.
2018-06-20 18:50:44 +02:00
Beniamino Galvani
9f8b0697de 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.
2018-06-20 18:49:56 +02:00
Beniamino Galvani
d9df1f1d05 device: introduce nm_device_get_configured_mtu_from_connection()
Deduplicate similar code from devices.
2018-06-20 18:30:56 +02:00
Thomas Haller
94200b03fe device: require that device-factories support at least one link-type or setting-type
If a device-factory wouldn't support any link-type or setting-type,
we would not take an additional reference to the @factory instance
(because, the factory is not added to one of the static hash tables).

As such, we would invoke the callback with a factory instance, which
is about to be destroyed immediately afterwards. That would be unusual
for device-plugins, because usually a device-plugin is never destroyed
and essentially leaked at exit.

Just don't get into that situation. All device plugins are internal API,
and they are known to support at least something. Assert for that.
2018-06-20 16:36:26 +02:00
Thomas Haller
4c43d7cad3 device: fix leaking internal device factories
Actually, we anyway leak them, because they are added to static hash tables
which are never released. Anyway, get the ref-count right.
2018-06-20 16:31:18 +02:00
Thomas Haller
dff157b867 device: suppress info logging about internal device plugins
Internal device plugins are compiled-in. In fact, none of the
internal device plugins can currently be disabled via compile
time options. The user would have to patch the sources to
not include a particular device plugin.

Hence, the available device plugins depends exclusively on the
build itself. That is not worth <info> level logging. Especially,
as it was quite verbose, logging 13 lines.
2018-06-20 16:17:03 +02:00