Commit graph

11765 commits

Author SHA1 Message Date
Beniamino Galvani
ea30bffbb5 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)
(cherry picked from commit 81cc4ddb1a)
(cherry picked from commit ade9864366)
2019-09-13 14:33:29 +02:00
Beniamino Galvani
11f355dc85 core: fix adding objects to NMIPConfig with @append_force
If the @append_force argument is set and the object is already in the
list, it must be moved at the end.

Fixes: 22edeb5b69 ('core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndex')
(cherry picked from commit 8b121c7048)
(cherry picked from commit 52241748e8)
(cherry picked from commit d6c3d9c9dc)
2019-08-28 16:23:04 +02:00
Beniamino Galvani
db1e24cc49 core: add test to show nm_ipX_config_replace() bug
Add test to show a wrong result of ip_ipX_config_replace() due to a
bug in _nm_ip_config_add_obj(). When an address is added to the tail
of the index and another address with the same id already exists, the
existing object is left at the same place, breaking the order of
addresses.

(cherry picked from commit 24741bff8b)
(cherry picked from commit ebaf890057)
(cherry picked from commit eb56d48c0b)
2019-08-28 16:23:02 +02:00
Thomas Haller
ff890a5473 bluetooth: fix leak in get_managed_objects_cb()
Fixes: 1ae5d53354 ('bluez: add support for BlueZ 5')
(cherry picked from commit 25571bb639)
(cherry picked from commit 6118f808d9)
(cherry picked from commit b629570a75)
2019-08-23 13:19:29 +02:00
Beniamino Galvani
0ec37e55b2 modem: fix memory leak
Fixes: 9b935fad9b ('modem: don't use GAsyncResult pattern for disconnecting modem')
(cherry picked from commit 22cd9e754b)
(cherry picked from commit 47c772354e)
(cherry picked from commit 05319cb391)
2019-08-06 09:18:47 +02:00
Thomas Haller
f9bb1ddc2e wireguard: fix use-after free in _peers_remove()
(cherry picked from commit 85c26341a2)
(cherry picked from commit a3f9ab473b)
(cherry picked from commit 8bcfda364e)
2019-08-03 12:29:10 +02:00
Beniamino Galvani
af2a126dc0 device: fix releasing slaves
Not all masters type have a platform link and so it's wrong to check
for it to decide whether the slave should be really released. Move the
check to master devices that need it (bond, bridge and team).

OVS ports don't need the check because they don't call to platform to
remove a slave.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 57e3734b6c)
(cherry picked from commit ec1b5fb019)
(cherry picked from commit f6a90b899a)
2019-08-01 10:06:41 +02:00
Beniamino Galvani
33309f7c9f device: check platform link compatibility when setting nm-owned flag
We set nm-owned to indicate whether a software device was created by
NM or it was pre-existing. When checking the existence, we must verify
also whether the link type is compatible with the device, otherwise it
is possible to match unrelated interfaces. For example, when checking
for the existence of an ovs-bridge (which is not compatible with any
platform link) we could match a unrelated platform link with the same
name.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 3cb4b36261)
(cherry picked from commit cb20d0791a)
(cherry picked from commit 511ef27d5e)
2019-08-01 10:06:39 +02:00
Beniamino Galvani
f93018a41a ovs: don't release slaves on quit
An OVS bridge and its slaves can continue to work even after NM has
quit. Keep the interface enslaved when the @configure argument of
device->release_slave() is FALSE, which happens on quit and in other
circumstances when we don't really want to release the slave from its
master.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/215
(cherry picked from commit ccd4be4014)
(cherry picked from commit a1f39b69e0)
2019-08-01 10:05:40 +02:00
Thomas Haller
52b52d2f7d platform/netlink: mark nested netlink attribute with NLA_F_NESTED
Kernel 5.2 is adding stricter checking for netlink messages.
In particular, for certain API it checks now that NLA_F_NESTED flag is
set for nested attributes ([1]).

Note that libnl3 does not ever set this flag, and since our netlink
implementation is copied from there, certain netlink messages are now
rejected as invalid.

On the other hand, libmnl always adds this flag ([2]). So we should do that
as well.

In particular, this affects the WireGuard netlink API causing request
from NetworkManager to be rejected ([3]).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b424e432e770d6dd572765459d5b6a96a19c5286
[2] https://git.netfilter.org/libmnl/tree/src/attr.c?id=5937dfcb0185f5cb9cf275992ea701ec4e619d9c#n535
[3] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/212

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/210
(cherry picked from commit 7811d1c187)
(cherry picked from commit 57048338ee)
2019-07-23 14:45:36 +02:00
Thomas Haller
9c72ca5ee9 device: fix reapplying changes to connection ID and UUID
4 properties are not really relevant for an already activated connection
or it makes not sense to change them. These are connection.id, connection.uuid,
connection.autoconnect and connection.stable-id.

For convenience, we allow to reapply these. This way, one can take
a different setting (e.g. with a different connection.id or
connection.uuid) and reapply them, but such changes are silently
ignored.

However this was done wrongly. Instead of reverting the change to the new
applied connection, we would change the input connection.

This is bad, for example with

  nmcli connection up uuid cb922f18-e99a-49c6-b200-1678b5070a82
  nmcli connection modify cb922f18-e99a-49c6-b200-1678b5070a82 con-name "bogus"
  nmcli device reapply eth0

the last re-apply would reset the settings-connection's connection ID to
what was before, while accepting the new name on the applied-connection
(while it should have been rejected).

Fixes: bf3b3d444c ('device: avoid changing immutable properties during reapply')

(cherry picked from commit adb51c2a7f)
(cherry picked from commit 09f37d5bd4)
2019-07-18 12:21:06 +02:00
Thomas Haller
d3b7b0d286 core: fix mangling static IPv6 routes in nm_ip6_config_merge_setting()
https://bugzilla.redhat.com/show_bug.cgi?id=1727193

Fixes: 433d2f8659 ('core: merge IPv4 and IPv6 version of _nm_ip_config_merge_route_attributes()')
(cherry picked from commit a8fa015a4e)
(cherry picked from commit 44e4ed1e95)
2019-07-09 14:35:27 +02:00
Beniamino Galvani
4aa2773f54 ifcfg-rh: fix memory leak reading infiniband setting
(cherry picked from commit c045267837)
(cherry picked from commit 4150dd8c43)
2019-07-04 11:56:01 +02:00
Beniamino Galvani
ae4e82c30f device: ppp: check that connection has a PPPoE parent
NMDevicePPP only handles connections with the pppoe.parent property
set. match_connection() already checks this when we creating a new
device. We should also perform the same check in
check_connection_compatible().

Fixes: 6c3195931e ('core: implement activation of PPP devices')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/203
(cherry picked from commit 17f4a1e794)
(cherry picked from commit 5ca888d693)
2019-07-03 18:05:22 +02:00
Beniamino Galvani
5e1ee4ae9a device: set IPv6 token only when necessary
Setting the IPv6 token triggers a new router solicitation from kernel
and so we should avoid when not strictly necessary.

https://mail.gnome.org/archives/networkmanager-list/2019-May/msg00004.html
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/179
(cherry picked from commit e4ce9bd7af)
(cherry picked from commit 7f239eff44)
2019-06-26 09:20:58 +02:00
Thomas Haller
36cdfe703f connectivity: make platform argument to nm_connectivity_check_start() optional
The platform is used to detect whether to skip the connectivity check right away.
It should be an optional argument, so one could avoid this pre-check.

(cherry picked from commit b626baa313)
(cherry picked from commit a842280dbe)
2019-06-20 11:26:42 +02:00
Thomas Haller
4f489ac450 connectivity: simplify passing result to idle handler
(cherry picked from commit 19c957f091)
(cherry picked from commit 3c2886f447)
2019-06-20 11:26:39 +02:00
Thomas Haller
597b8da697 connectivity: remove unused error varialbe in _idle_cb()
(cherry picked from commit 4001aee370)
(cherry picked from commit 28540a8eb8)
2019-06-20 11:26:35 +02:00
Beniamino Galvani
97d3d27591 device: don't start connectivity check on unconfigured devices
If the interface has no carrier, no addresses or no routes there is no
point in starting a connectivity check on it because it will fail.
Moreover, doing the check on a device without routes causes the
addition of a negative entry in the ARP table for each of the
addresses associated with the connectivity check host; this can lead
to poor network performances.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/181
(cherry picked from commit 91d447df19)
(cherry picked from commit 7f937ecece)
2019-06-20 11:26:34 +02:00
Beniamino Galvani
3f54307650 device: fix matching parent device by connection UUID
We must compare the UUID with the one on the *parent* device.

Also, simplify the checks to only return TRUE at the end of function.

Fixes: 27c281ac5a ('device: deduplicate match_parent()')

https://bugzilla.redhat.com/show_bug.cgi?id=1716438
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/176
(cherry picked from commit 3c54b5eb2b)
(cherry picked from commit 591837d6f5)
2019-06-20 11:20:50 +02:00
Alfonso Sánchez-Beato
61b4f31d72 core/pppd-plugin: wait to recover port settings before notifying death
pppd restores the previous settings for the serial port it uses right
before exiting. It is especially important to do so because otherwise
ModemManager is not able to recover the port as it can receive a hangup
event from the port due to CLOCAL not being restored.  However, there is
currently a race condition that produces this issue. This is because
when PHASE_DEAD is notified, pppd still has not restored the port
settings - it does that a bit later, in the die() function.

This patch delays notifying PHASE_DEAD until when the exitnotify() hook
is called by pppd: when this happens the port settings have already been
restored.

There were previously efforts to fix this in commit fe090c34b7, so
PHASE_DEAD was used instead of PHASE_DISCONNECT to notify MM that the
port was disconnected, but that still early to ensure that the port
settings are restored.

The MM traces seen when the bug is triggered are:

ModemManager[2158]: <warn>  (ttyACM1): could not re-acquire serial port lock: (5) Input/output error
ModemManager[2158]: <warn>  Couldn't load Operator Code: 'Cannot run sequence: 'Could not open serial device ttyACM1: it has been forced close'

https://mail.gnome.org/archives/networkmanager-list/2019-June/msg00014.html

(cherry picked from commit a251712a72)
(cherry picked from commit 3caa065709)
2019-06-14 13:37:07 +02:00
Beniamino Galvani
333956d47f device: reset cached route tables when starting new activation
The values cached in the device may be stale when we start a new
activation because in a disconnected state we might have called
ip_config_merge_and_apply() which cached the main table value.

(cherry picked from commit 5be69ba794)
(cherry picked from commit 14cfffa64c)
2019-06-11 15:43:26 +02:00
Beniamino Galvani
53f1490b50 ifcfg-rh: use PKCS #12 private key also as client cert in reader
Before commit e3ac45c026 the reader set the private key in the
setting using the libnm function, which also set the key as client
certificate if it was in PKCS #12 format.

After the commit, existing connections with a PKCS #12 private key but
without a client certificate became invalid. Restore the old behavior.

Fixes: e3ac45c026 ('ifcfg-rh: don't use 802-1x certifcate setter functions')
(cherry picked from commit 9a410fc312)
(cherry picked from commit 51896e1e6b)
2019-05-28 13:49:21 +02:00
Beniamino Galvani
a828815825 ifcfg-rh: don't check for 802.1x private key or client cert in reader
Let the setting check it in verify().

(cherry picked from commit d9b3b2b8ce)
(cherry picked from commit c28db67a78)
2019-05-28 13:49:19 +02:00
Beniamino Galvani
90517f1b4a ifcfg-rh: write client certificate even if it is pkcs12
The writer should only persist properties without too much additional
logic, which should be instead embedded in the setting itself.

(cherry picked from commit a995244e9b)
(cherry picked from commit 5a5cd8d05d)
2019-05-28 13:49:18 +02:00
Beniamino Galvani
c71b47268f team: don't kill teamd for external devices
The teamd instance must not be killed if the device was externally
activated.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/158
https://bugzilla.redhat.com/show_bug.cgi?id=1693142
(cherry picked from commit 008a4b4215)
(cherry picked from commit bd113fe72e)
2019-05-20 15:00:20 +02:00
Patrick J. Volkerding
6160888e61 hostname-manager: use fqdn for persistent hostname on Slackware
This will be the default for Slackware 15.0 and on.

This should be safe for both master and 1.12.x stable branch, as
no existing Slackware releases are expected to run NM-1.12.x or
later.

Signed-off-by: Robby Workman <rworkman@slackware.com>

https://mail.gnome.org/archives/networkmanager-list/2019-May/msg00011.html

(cherry picked from commit e1df17e0ac)
(cherry picked from commit 065e810424)
2019-05-19 10:48:32 +02:00
Thomas Haller
7a0f8520ff core: fix file permissions for "/var/lib/NetworkManager/secret_key"
Ooherwise, the file has wrong permissions:

  # ls -la /var/lib/NetworkManager/secret_key
  ----r-xr-x. 1 root root 50 May 14 13:52 /var/lib/NetworkManager/secret_key

Luckily, /var/lib/NetworkManager should be already

  # ls -lad /var/lib/NetworkManager
  drwx------. 2 root root 8192 May 14 13:57 /var/lib/NetworkManager

which mitigates this a bit.

Fixes: dbcb1d6d97 ('core: let nm_utils_secret_key_read() handle failures internally')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/175
(cherry picked from commit dc3a2f9bc4)
(cherry picked from commit 2d46247c6a)
2019-05-14 14:04:51 +02:00
Thomas Haller
1337ebd9d0 settings/d-bus: fix boolean return value of "LoadConnections"
The boolean value is intended to indicate success. It would indicated
failure due to a bug.

Fixes: 297d4985ab ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API'):
(cherry picked from commit 22e830f046)
(cherry picked from commit e73a505866)
2019-05-10 15:40:06 +02:00
Thomas Haller
8fe900d323 settings: avoid assertion for LoadConnections D-Bus method with relative paths
$ busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings org.freedesktop.NetworkManager.Settings LoadConnections as 1 relative/filename

triggers a g_critical() assertion in nm_utils_file_is_in_path():

  ...
  #3  0x00007ffff7a19e7d in g_return_if_fail_warning
      (log_domain=log_domain@entry=0x55555586c333 "NetworkManager", pretty_function=pretty_function@entry=0x55555586c0a0 <__FUNCTION__.38585> "nm_utils_file_is_in_path", expression=expression@entry=0x55555586c010 "abs_filename && abs_filename[0] == '/'") at ../glib/gmessages.c:2767
  #4  0x00005555555f1128 in nm_utils_file_is_in_path (abs_filename=abs_filename@entry=0x555555b56670 "dfd", abs_path=<optimized out>) at src/NetworkManagerUtils.c:1077
  #5  0x00005555555a4779 in load_connection (config=<optimized out>, filename=0x555555b56670 "dfd") at src/settings/plugins/keyfile/nms-keyfile-plugin.c:522
  #6  0x00005555557ce291 in nm_settings_plugin_load_connection (self=0x5555559fd400 [NMSKeyfilePlugin], filename=0x555555b56670 "dfd") at src/settings/nm-settings-plugin.c:70
  #7  0x000055555559ccdf in impl_settings_load_connections
      (obj=<optimized out>, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], parameters=<optimized out>) at src/settings/nm-settings.c:1439
  #8  0x00005555555a9bf9 in dbus_vtable_method_call
      (connection=0x5555559b91b0 [GDBusConnection], sender=sender@entry=0x555555b5c360 ":1.32283", object_path=object_path@entry=0x7fffe0019070 "/org/freedesktop/NetworkManager/Settings", interface_name=<optimized out>, interface_name@entry=0x7fffe002aa70 "org.freedesktop.NetworkManager.Settings", method_name=<optimized out>,
      method_name@entry=0x7fffe00276b0 "LoadConnections", parameters=parameters@entry=0x555555c4a690, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], user_data=0x5555559a1a00)
      at src/nm-dbus-manager.c:947
  #9  0x00007ffff7c506c4 in call_in_idle_cb (user_data=user_data@entry=0x7fffe0015ed0) at ../gio/gdbusconnection.c:4874
  #10 0x00007ffff7a0e8eb in g_idle_dispatch (source=source@entry=0x7fffe00208a0, callback=0x7ffff7c50590 <call_in_idle_cb>, user_data=0x7fffe0015ed0) at ../glib/gmain.c:5627
  #11 0x00007ffff7a11fd0 in g_main_dispatch (context=0x555555994d00) at ../glib/gmain.c:3189
  #12 0x00007ffff7a11fd0 in g_main_context_dispatch (context=context@entry=0x555555994d00) at ../glib/gmain.c:3854
  #13 0x00007ffff7a12368 in g_main_context_iterate (context=0x555555994d00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3927
  #14 0x00007ffff7a126b3 in g_main_loop_run (loop=0x555555995e60) at ../glib/gmain.c:4123
  #15 0x000055555558a741 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:444

Filter out relative filenames early.

(cherry picked from commit a1b102eae4)
(cherry picked from commit c21171e069)
2019-05-10 14:46:25 +02:00
Beniamino Galvani
33a01ab84b device: fix intersecting IPv6 configurations
If the link is down we shouldn't drop the link-local address from
configuration as it wasn't removed by user but by kernel.

(cherry picked from commit 18d2edfaa1)
(cherry picked from commit 6f69144500)
2019-05-08 13:51:52 +02:00
Beniamino Galvani
158dae6b5a device: unconditionally reapply IP configuration on link up
Consider the situation in which ipv4.method=auto and there is an
address configured. Also, the DHCP timeout is long and there is no
DHCP server. If the link is brought down temporarily, the prefix route
for the static address is lost and not restored by NM because we
reapply the IP configuration only when the IP state is DONE.

The same can happen also for IPv6, but in that case also static IPv6
addresses are lost.

We should always reapply the IP configuration when the link goes up.

(cherry picked from commit d0b16b9283)
(cherry picked from commit 4482ca64ba)
2019-05-08 13:51:50 +02:00
Beniamino Galvani
25af9b8f0f all: fix typos (milli seconds -> milliseconds)
(cherry picked from commit 4735d6764a)
(cherry picked from commit f6b9366eb4)
2019-05-08 13:51:49 +02:00
Beniamino Galvani
fc61af9a0a device: fix reapply of MTU
When we set the MTU on the link we remember its previous source
(ip-config, parent-device or connection profile) and don't change it
again afterwards to avoid interfering with user's manual changes. The
only exceptions when we change it again are (1) if the parent device
MTU changes and (2) if the new MTU has higher priority than the one
previously set.

To allow a live reapply of the MTU property we also need to clear the
saved source, or the checks described above will prevent setting the
new value.

Fixes: 2f8917237f ('device: rework mtu priority handling')

https://bugzilla.redhat.com/show_bug.cgi?id=1702657
(cherry picked from commit 4ed72fa658)
(cherry picked from commit e738479bdd)
2019-05-08 13:49:03 +02:00
Beniamino Galvani
b7cd8f283b settings: fix failed assertion
Fix the following assertion failure:

  g_object_ref: assertion 'G_IS_OBJECT (object)' failed.

nm_settings_add_connection() can return a NULL connection.

Fixes: f034f17ff6 ('settings: keep the added connection alive for a bit longer')
(cherry picked from commit 48ce3628c5)
(cherry picked from commit d80818e6ca)
2019-05-08 13:48:17 +02:00
Thomas Haller
764ad1b191 device/wireguard: fix memleak for NMDeviceWireGuard
Fixes: 2148d09482 ('core/wireguard: add support for WireGuard peers')
(cherry picked from commit 56d748eb84)
(cherry picked from commit 5a1818b646)
2019-05-03 11:04:33 +02:00
Thomas Haller
400293d350 platform: fix nm_platform_lnk_gre_to_string() for tap links
Why didn't we get a compiler warning about this bug?
At least clang (3.8.0-2ubuntu4, Ubuntu 16.04) warns:

    CC       src/platform/src_libNetworkManagerBase_la-nm-platform.lo
  ../src/platform/nm-platform.c:5389:14: error: data argument not used by format string [-Werror,-Wformat-extra-args]
                      lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
                      ^

Fixes: 4c2862b958 ('platform: add gretap tunnels support')
(cherry picked from commit dfb899f465)
(cherry picked from commit ed88c71f15)
2019-04-18 20:21:22 +02:00
Beniamino Galvani
ffb12bee18 device: fix memory leak
(cherry picked from commit 82c74eb4e2)
2019-04-12 11:52:27 +02:00
Beniamino Galvani
3924e12752 policy: fix memory leak
(cherry picked from commit ade14408d7)
2019-04-12 11:52:25 +02:00
Thomas Haller
ce6b7cc824 connectivity: fix build with --disable-concheck
Fixes: 2cec94bacc ('connectivity: use systemd-resolved for resolving the check endpoint')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/155
(cherry picked from commit 8aefac804c)
2019-04-10 21:26:20 +02:00
Beniamino Galvani
43571d1013 team: clean up state when connection to teamd fails
If NM fails to connect to teamd, it currently just sets the device
state to FAILED and waits that deactivate() is called later. However,
the 5 seconds timeout on teamd process start can hit in the meantime,
which fails with an assertion "nm_device_is_activating (device)".

Clean up the device state when the connection to teamd fails.

https://bugzilla.redhat.com/show_bug.cgi?id=1697900
(cherry picked from commit c48698d747)
2019-04-10 08:46:18 +02:00
Yupeng Chang
00858afc4f ifupdown: fix connection iterator
Fixes: 6aa66426a4 ('settings/ifupdown: merge eni_ifaces and connections hashes in plugin')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/145
https://bugzilla.redhat.com/show_bug.cgi?id=1694912
(cherry picked from commit 1dd67583e3)
2019-04-02 11:36:45 +02:00
Lubomir Rintel
8ec0954570 ovs: don't traverse interface through disconnected when the ovsdb entry is removed
Go straight to unmanaged. That's what all the other devices do when
their backing resources vanish. If the device reached disconnected
state, an autoconnect check would try to connect it back, in vain.

https://github.com/NetworkManager/NetworkManager/pull/324
(cherry picked from commit 045b88a5b5)
2019-03-29 00:03:11 +01:00
Lubomir Rintel
015ef82e1b ovs-interface: dissociate the link on disconnection
Open vSwitch is the special kid on the block -- it likes to be in charge of
the link lifetime and so we shouldn't be. This means that we shouldn't be
attempting to remove the link: we'd just (gracefully) fail anyways.

More importantly, this also means that we shouldn't care if we see the link
go away. Once the device reaches DISCONNECTED state, its configuration is
cleaned up and we may already be activating another connection. We shouldn't
alter the device state when OpenVSwitch decides to drop the old link.

https://bugzilla.redhat.com/show_bug.cgi?id=1543557
https://github.com/NetworkManager/NetworkManager/pull/324
(cherry picked from commit 3a55ec63e1)
2019-03-29 00:03:05 +01:00
Lubomir Rintel
ebdc37e32e settings: keep the added connection alive for a bit longer
Fixes a crash on failed AddAndActivate:

  $ ip link set eth0 down
  $ nmcli d conn eth0
  Error: Failed to add/activate new connection: Connection 'eth0' is not available on device eth0 because device has no carrier
  <NetworkManager crashes>

  #3  0x000055555558b6c5 in _nm_g_return_if_fail_warning
  #4  0x00005555557008c7 in nm_settings_has_connection
  #5  0x0000555555700e5f in pk_add_cb
  #6  0x0000555555726e30 in pk_call_cb
  #7  0x0000555555726e30 in pk_call_cb
  #8  0x0000555555726e30 in pk_call_cb
  #9  0x00005555555aaea8 in _call_id_invoke_callback
  #10 0x00005555555ab2e8 in _call_on_idle

https://github.com/NetworkManager/NetworkManager/pull/325
(cherry picked from commit f034f17ff6)
2019-03-29 00:02:55 +01:00
Lubomir Rintel
b4359e5700 device: fix the slave state change reason on master connection removal
If we surprise-remove the master, slaves would immediately attempt to bring
things up by autoconnecting. Not cool. Policy, however, blocks
autoconnect if the slaves disconnect due to "dependency-failed", and it
indeed seems to be an appropriate reason here:

  $ nmcli c add type bridge
  $ nmcli c add type dummy ifname dummy0 master bridge autoconnect yes
  $ nmcli c del bridge
  $

Before:

  (nm-bridge): state change: ip-config -> deactivating (reason 'connection-removed')
  (nm-bridge): state change: deactivating -> disconnected (reason 'connection-removed')
  (nm-bridge): detached bridge port dummy0
  (dummy0): state change: activated -> disconnected (reason 'connection-removed')
  (nm-bridge): state change: disconnected -> unmanaged (reason 'user-requested')
  (dummy0): state change: disconnected -> unmanaged (reason 'user-requested')
  policy: auto-activating connection 'bridge-slave-dummy0'

After:

  (nm-bridge): state change: ip-config -> deactivating (reason 'connection-removed')
  (nm-bridge): state change: deactivating -> disconnected (reason 'connection-removed')
  (nm-bridge): detached bridge port dummy0
  (dummy0): state change: activated -> deactivating (reason 'dependency-failed')
  (nm-bridge): state change: disconnected -> unmanaged (reason 'user-requested')
  (dummy0): state change: deactivating -> disconnected (reason 'dependency-failed')
  (dummy0): state change: disconnected -> unmanaged (reason 'user-requested')

https://github.com/NetworkManager/NetworkManager/pull/319
(cherry picked from commit 8f2a8a52f0)
2019-03-29 00:02:48 +01:00
Beniamino Galvani
065fa28373 dns: fix memory leak of error
The error was leaked when cancelled.

Fixes: 818023c257 ('dns/resolved: add systemd-resolved backend')
(cherry picked from commit 579373a5df)
2019-03-26 17:39:46 +01:00
Thomas Haller
e1ef6c0b26 device/wifi: fix handling static WEP connections in act_stage4_ip_config_timeout()
Fixes: 5e71f01605 ('device: merge stage3 and stage4 ip-config function for IPv4 and IPv6')
(cherry picked from commit fd2106dbd6)
2019-03-15 16:02:15 +01:00
Thomas Haller
9294b42ba0 ifcfg-rh: avoid duplicate cache lookup in is_wifi_device()
(cherry picked from commit 6580f2931d)
2019-03-11 16:44:59 +01:00
Thomas Haller
355cbbfb5c core: assert for valid NM_DEVICE_DEVICE_TYPE setting
(cherry picked from commit 7dd44d6dc8)
2019-03-11 16:43:20 +01:00