Commit Graph

20480 Commits

Author SHA1 Message Date
Thomas Haller
db8696f164 release: update NEWS 2018-06-29 17:01:42 +02:00
Thomas Haller
e0dc1da411 release: fix NEWS entry for NM_DISPATCHER_ACTION
This was not backported to nm-1-10 branch.
2018-06-29 17:01:42 +02:00
Thomas Haller
f3d1cf8100 device: merge branch 'th/device-dad-handling-rh1593210'
While this fixes rh#1593210 and CI test "ipv6_keep_external_routes",
it breaks CI test "ipv6_add_static_address_manually_not_active". See
related bug rh#1585078. It seems in the short term, the fix is more
important than the new issue, hence merging.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
https://github.com/NetworkManager/NetworkManager/pull/144

(cherry picked from commit 8076a6f003)
2018-06-29 16:43:31 +02:00
Thomas Haller
1609344eda device: only check for IPv6 DAD and link-local address on actively managed devices
In device_ipx_changed() we only keep track of dad6_failed_addrs
addresses if the device's state is > DISCONNECTED.

For the same reason, we should also do that in queued_ip_config_change().

But it's worse. If the device is in state disconnected, and the user
externally adds IPv6 addresses, we will end up in queued_ip_config_change().
It is easily possible that "need_ipv6ll" ends up being TRUE, which results
in a call to check_and_add_ipv6ll_addr() and later possibly

  ip_config_merge_and_apply (self, AF_INET6, TRUE);

This in turn will modify the IP configuration on the device, although
the device may be externally managed and NetworkManager shouldn't touch it.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
(cherry picked from commit 890c748643)
2018-06-29 16:43:10 +02:00
Thomas Haller
e7ea66eb1a device: emit IP address changes in queued_ip_config_change() only once
We first iterate over addresses that might have failed IPv6 DAD and
update the state in NMNDisc.

However, while we do that, don't yet invoke the changed signal.
Otherwise, we will invoke it multiple times (in case multiple addresses
failed). Instead, keep track of whether something changed, and handle
it once a bit later.

(cherry picked from commit f312620276)
2018-06-29 16:43:10 +02:00
Thomas Haller
b638edf4a0 device: refactor handling dad6_failed_addrs in queued_ip_config_change()
Whenever we process queued IP changes, we must handle all pending
dad6_failed_addrs. This is, to ensure we don't accumulate more
and more addresses in the list.

Rework the code, by stealing the entire list once at the beginning

    dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);

and free it at the end:

    g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);

This makes it easier to see, that we always process all addresses in
priv->dad6_failed_addrs.

(cherry picked from commit e2c13af805)
2018-06-29 16:43:10 +02:00
Thomas Haller
f5b48bd973 device: split handling for dad6_failed_addrs and dad6_ip6_config in queued_ip_config_change()
There is no change in behavior, however don't handle dad6_failed_addrs
and dad6_ip6_config in the same block.

While both parts are related to IPv6 DAD, they do something rather
different:

 - the first block, checks all candidates from dad6_failed_addrs whether
   they actually indicate DAD failed, and handles them by notifying
   NMNDisc about failed addresses.

 - the second block, checks whether we have now all addresses from
   dad6_ip6_config that we are waiting for.

Split the blocks.

(cherry picked from commit 3fcdba1a19)
2018-06-29 16:43:10 +02:00
Thomas Haller
b86d8968d5 device: simplify postponing IP config change in queued_ip_config_change()
We don't need to cancel the current idle-action and schedule a new
one. Just return and wait to be called again.

Also, drop the logging. Similarly, we don't log the postponing for
the previous case either.

(cherry picked from commit 63cf5bd249)
2018-06-29 16:43:10 +02:00
Thomas Haller
171001c34d device: clear dad6_failed_addrs in _cleanup_ip_pre()
We also cancel the idle handler

  nm_clear_g_source (&priv->queued_ip_config_id_x[IS_IPv4])

which means, nobody is going to process these addresses (at least
for the moment).

The purpose of "dad6_failed_addrs" is to keep track of addresses that
might be interesting for checking about DAD failures. If we are no
longer reacting on IP changes (because the idle handler was removed),
we also no longer need these addresses.

(cherry picked from commit dbb936e5c8)
2018-06-29 16:43:10 +02:00
Thomas Haller
3ce80c8d65 device: simplify handling of IP config changes while initializing link
This simplifies commit 31ca7962f8.

We don't need the boolean flags like "queued_ip4_config_pending" to
track whether we received any platform signals while being not yet
initialized in platform (udev, NM_UNMANAGED_PLATFORM_INIT).

In general, as long as the device is NM_UNMANAGED_PLATFORM_INIT,
all platform signals are ignored. And when the device becomes managed,
we schedule anyway an initial config-change.

(cherry picked from commit 18ecc4b4f1)
2018-06-29 16:43:10 +02:00
Beniamino Galvani
5ccd7f7fd7 device: clear the dhcp grace-period source id
Fixes: 17009ed91d
(cherry picked from commit db1867bafd)
2018-06-29 16:12:14 +02:00
Thomas Haller
c2b4e8b290 mailmap: minor adjustment to mailmap not to match by name
We use the email address of the user as their ID. In this case,
there is no need to restrict the match based on the name as well.

In practice, this makes no difference at all, because these email
addresses only come with the present names.

(cherry picked from commit d1aca62475)
2018-06-29 11:10:35 +02:00
Lubomir Rintel
44cca6b31f mailmap: add mailmap
This allows us to disambiguate committers. The list was compiled
manually, with preference of latter e-mail addresses if more were used
throughout the history.

(cherry picked from commit 0eafdcd572)
2018-06-29 11:10:34 +02:00
Thomas Haller
863428ef26 clients/docs: fix generated documentation for Open vSwitch
Fixes: 9be0c3330d
(cherry picked from commit bf7b941502)
2018-06-29 09:59:51 +02:00
Lubomir Rintel
225f25e041 docs: provide soft descriptions for NM{Simple,Remote}Connection
...and order them on more logical places in the libnm manual.

(cherry picked from commit e53a7365ca)
2018-06-28 20:43:29 +02:00
Lubomir Rintel
4fa1a49542 docs: include missing documentation in libnm and D-Bus docs
Check that we don't repeat the omission in future.

(cherry picked from commit cb1172ee3d)
2018-06-28 20:43:26 +02:00
Lubomir Rintel
79fe82753d examples/qt/meson: drop dbus-glib dependency
It's not actually required.

(cherry picked from commit 22813fdc60)
2018-06-28 20:41:12 +02:00
Lubomir Rintel
b478b77558 libnm/meson: make generate_setting_docs depend on the typelib
Otherwise it would attempt to use a system-wide installed one, resulting
in sadness and misery.

(cherry picked from commit d6c08691d9)
2018-06-28 20:41:12 +02:00
Lubomir Rintel
03733911cb meson: generate-setting-docs.py environment correctly
It's ugly, because meson doesnt' seem to provide any useful facilities for
dealing with environment variables. Not my fault.

(cherry picked from commit 21840f5321)
2018-06-28 20:41:12 +02:00
Timothy Redaelli
bb9ce74a59 contrib/rpm: Use Open vSwitch instead of OpenVSwitch
The correct naming is Open vSwitch so use it instead of OpenVSwitch

[lkundrak@v3.sk: added some more cases of the same]

https://github.com/NetworkManager/NetworkManager/pull/150

Fixes: 830a5a14cb
(cherry picked from commit 9be0c3330d)
2018-06-28 20:40:13 +02:00
Thomas Haller
f550674d25 logging: merge branch 'th/logging-rh1593519'
https://github.com/NetworkManager/NetworkManager/pull/145
https://bugzilla.redhat.com/show_bug.cgi?id=1593519

(cherry picked from commit 71a26617d8)
2018-06-27 09:21:52 +02:00
Thomas Haller
dbd48f260e 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.

(cherry picked from commit 2ccf6168dc)
2018-06-27 09:21:33 +02:00
Thomas Haller
a64b424da3 logging/trivial: add code comment about logging-backend
(cherry picked from commit 504ad2aeed)
2018-06-27 09:21:33 +02:00
Thomas Haller
1b83cab13b 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.

(cherry picked from commit 2912155584)
2018-06-27 09:21:33 +02:00
Thomas Haller
64e14855f7 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.

(cherry picked from commit 4439b6a35d)
2018-06-27 09:21:33 +02:00
Thomas Haller
b4844435be main: accept invalid logging configuration in NetworkManager.conf gracefully
https://bugzilla.redhat.com/show_bug.cgi?id=1593519
(cherry picked from commit 11303fd2d1)
2018-06-27 09:21:33 +02:00
Thomas Haller
5be0ad48e8 main: free error variable in main() at exit
Just try to free everything that was allocated. Don't leak
error in case of failure.

(cherry picked from commit 9e20ba6646)
2018-06-27 09:21:33 +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
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
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
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
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
Beniamino Galvani
64e4616a3d manager: fix typo in 'PrimaryConnectionType' D-Bus property name
Fixes: 297d4985ab
(cherry picked from commit a2b85d5c6e)
2018-06-22 16:00:58 +02:00
Thomas Haller
da81f346cd libnm: fix leaking filename in NMRemoteConnection
Fixes: bd6fe17815
(cherry picked from commit 9bc6ca96f6)
2018-06-21 16:09:14 +02:00
Thomas Haller
1388569fce 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.

(cherry picked from commit 94200b03fe)
2018-06-20 16:42:15 +02:00