Commit graph

14791 commits

Author SHA1 Message Date
Beniamino Galvani
71270b8295 device: postpone updates of IP configuration when a commit is pending
When a new dynamic configuration is received, it is stored in a member
of private structure (e.g. @dhcp6_ip6_config) and a commit is
scheduled. Before the commit is executed, an update_ipx_config() could
be called and it would change the configuration before it is
committed.

This race condition causes failures in assigning the addresses
received through DHCPv6 when the internal client is used (but
potentially other clients and methods are affected).

To fix it, postpone updates of IP configurations when a commit is
already pending.

(cherry picked from commit a47c13a7a2)
2016-04-29 17:28:37 +02:00
Thomas Haller
389102ad7e core,libnm: merge branch 'th/module-close'
(cherry picked from commit 69863204e2)
2016-04-29 15:58:12 +02:00
Thomas Haller
97c15ed358 settings: don't unload settings plugins on failure
Also, registering a weak-pointer to close the module that
was just made as resident is pointless.

(cherry picked from commit c6a92224a4)
2016-04-29 15:56:20 +02:00
Thomas Haller
3497dce786 device: don't unload device plugins on failure
(cherry picked from commit cd39cbfc1f)
2016-04-29 15:56:19 +02:00
Thomas Haller
8ecb915131 libnm/vpn: don't close the VPN plugin library on cleanup
Closing the library will interfere badly as the glib types cannot be
unregistered. We must leak the library handle.

Switch to dlopen() instead of g_module_open(), because the former
supports RTLD_NOLOAD. This is useful for two reasons:

  - checking the file prior loading only makes any sense when
    dlopen() would actually load a file anew.

  - if the library was loaded before, we want to return the handle.
    On the other hand, if the library was not loaded, we leak the
    handle.

Thereby, refactor the code from if-else blocks to return-early, because
the function nicely does individual steps and if one fails just error
out.

(cherry picked from commit 264189e756)
2016-04-29 15:56:13 +02:00
Lubomir Rintel
9ecead6081 ifupdown: avoid calloc()
It can return NULL and makes Coverity upset:

CID 75369 (#1 of 1): Dereference null return value (NULL_RETURNS)
4.  dereference: Dereferencing a null pointer ret.

(cherry picked from commit 76844c65d6)
2016-04-29 13:14:56 +02:00
Lubomir Rintel
544827a8d1 ifnet: fix error handling
CID 76722 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement:
g_set_error(error, nm_setti....

(cherry picked from commit 2e563d9c84)
2016-04-29 13:14:55 +02:00
Beniamino Galvani
62e7bd6b12 cli: handle device failure when activating
We might receive the update of the device state to FAILED when the
active connection is still in ACTIVATING. Handle this case properly.

(cherry picked from commit a06487a6ae)
2016-04-29 11:18:26 +02:00
Lubomir Rintel
52fc28893f linux-platform: re-read the link type if the name changed
For some device types, we use the DEVTYPE from sysfs to determine the
link type. However, the way we read from sysfs can race with device
renames and we could miss the chance to read DEVTYPE correctly.

This doesn't completely fix the sysfs race, but cures the boot-time race
with systemd renaming the device while we are initializing the link.

We ideally should use GUDev for all sysfs accesses, but that would need
some more work for this particular case as currently we need the link type
before we have an udev device instance.

https://bugzilla.gnome.org/show_bug.cgi?id=764803

Co-Authored-By: Beniamino Galvani <bgalvani@redhat.com>
(cherry picked from commit dd4d8b24da)
2016-04-29 10:41:58 +02:00
Thomas Haller
459293e501 libnm/vpn: don't leak editor-plugin if nm_vpn_editor_plugin_load() fails
(cherry picked from commit c1147fc71b)
2016-04-28 16:45:16 +02:00
Thomas Haller
c8e2b38cbf libnm: store NMConnectionPrivate via g_object_set_qdata()
g_object_get_data() and g_object_get_qdata() end up to be identical,
except that g_object_get_data() also requires to intern the string
on every lookup (which involves a hash lookup and locking).

(cherry picked from commit d350d72a2e)
2016-04-28 16:45:16 +02:00
Francesco Giudici
863f2ffb4d settings: add notification after connections load
The notification was missing from a long time. The issue has been exposed only
now due to the c57e5a6b66 fix which properly
implemented the "startup-complete" notification substituting out of place code
which masked the bug.

(cherry picked from commit 19350c8975)
2016-04-28 16:45:16 +02:00
Beniamino Galvani
5fa3c1230f device/ethernet: ignore s390 'portname' attribute when not set
The 'portname' sysfs attribute of s390 devices is deprecated since
kernel 4.4 and always set to 'no portname required'. But even on older
kernels such value must be interpreted as an unset portname and thus
ignored.

https://bugzilla.redhat.com/show_bug.cgi?id=1327204
(cherry picked from commit 0589e659ca)
2016-04-28 09:33:37 +02:00
Thomas Haller
1e1d5b24fd device: merge branch 'th/default-wired-connection-stable-uuid-bgo765464'
https://bugzilla.gnome.org/show_bug.cgi?id=765464

(cherry picked from commit c17b4ba6c7)
2016-04-26 12:59:31 +02:00
Thomas Haller
7ede2a7a63 device: generate stable UUID for default-wired-connection
Generate a stable connection UUID for the default-wired-connection.
Otherwise, on every reboot, the UUID changes although the generated
connection is the same.

But also hash into the UUID the machine-id, the device name and the
hardware address. So, the UUID is only the same if the connection is
identical in every aspect.

Also, the UUID is used as Network_ID for the stable-privacy address
generation mode. It is bad to re-create different UUIDs on every boot
as it causes different addresses.

(cherry picked from commit 89cf9429a7)
2016-04-26 12:59:20 +02:00
Thomas Haller
fd82e00f2f core: use nm_utils_machine_id_read() in "nm-dhcp-client.c"
(cherry picked from commit 54233b6f3b)
2016-04-26 12:59:20 +02:00
Thomas Haller
33d75792c3 core: add nm_utils_machine_id_read() and parse() util
(cherry picked from commit f137af2e23)
2016-04-26 12:59:20 +02:00
Thomas Haller
de22249183 core: add nm_utils_get_secret_key() util
(cherry picked from commit d787b8c827)
2016-04-26 12:59:20 +02:00
Dan Williams
50dc5fecab dhcp/systemd: actually hook up information-only mode
Fixes: 89d1e46615
Tested-by: Celti on IRC
(cherry picked from commit 8c8a577a30)
2016-04-25 17:01:21 -05:00
Thomas Haller
63ed5ab7b4 libnm/doc: fix documentation of NMSettingIP6Config:addr-gen-mode
The value cannot be unset. It must be set to one of the two currently
supported values.

(cherry picked from commit bad9becf99)
2016-04-25 16:53:42 +02:00
Lubomir Rintel
3ad7be3e6a bluetooth: add a missing GError initializer 2016-04-25 16:06:31 +02:00
Thomas Haller
b69ce27688 settings: merge branch 'th/settings-read-hostname'
(cherry picked from commit 77f287818c)
2016-04-25 15:29:21 +02:00
Thomas Haller
9f6dd5afb7 settings: refactor read_hostname_*()
(cherry picked from commit 316359d8b6)
2016-04-25 15:28:49 +02:00
Thomas Haller
eb4e694565 settings: cleanup #if blocks for HOSTNAME_PERSIST_*
(cherry picked from commit 79d85ca180)
2016-04-25 15:28:48 +02:00
Patrick J. Volkerding
6e86ad8e0f settings: fix Slackware hostname setting
https://mail.gnome.org/archives/networkmanager-list/2016-April/msg00075.html
(cherry picked from commit 1a714ee5e6)
2016-04-25 15:28:47 +02:00
Thomas Haller
6558ebae10 lldp: fix crash in nm_device_update_dynamic_ip_setup() due to uninitialized @error
Fixes: 07a9364d9c
(cherry picked from commit ee3ac13e50)
2016-04-25 12:09:07 +02:00
Lubomir Rintel
cb3fab7eb3 tools: add forgotten file to dist
Fixes: f15c412015
(cherry picked from commit 8280ab69f1)
2016-04-23 20:26:16 +02:00
Lubomir Rintel
f15c412015 docs: include the D-Bus enums reference with the API documentation
Otherwise the types links would be dangling or resolved to slightly
irrelevant documentation in libnm or completely irrelevant documentation
in libnm-util.

(cherry picked from commit db6ebe003d)
2016-04-22 17:14:14 +02:00
Lubomir Rintel
523296a2f1 libnm-core: don't link to NMDevice type from the D-Bus spec
It isn't right in that context -- NMDevice is a libnm-core object,
not a bus object. In rendered documentation this would generate
a dangling link.

(cherry picked from commit c850868faf)
2016-04-22 17:14:13 +02:00
Thomas Haller
4f06ae603e auth: allow failures to read process start_time from /proc/$PID/stat with hidepid
When mounting /proc with hidepid, we might fail to read the
start-time of the process from /proc/$PID/stat. In this case,
we should just accept a start-time of zero.

On the other side of authentication, polkit should accept a zero
start-time too.

nm_utils_get_start_time_for_pid() has other uses in NetworkManager,
mostly when killing a process from a PIDFILE or during
nm_utils_kill_process_sync(). In both these cases, this will only
succeed if we try to kill a process that also runs a root.

For processes started by the current instance, we don't care about the
PIDFILE and use nm_utils_kill_child_?sync() -- so there is no problem
with hidepid there.

https://bugzilla.gnome.org/show_bug.cgi?id=764502
(cherry picked from commit 3d505b3f87)
2016-04-22 14:42:51 +02:00
Thomas Haller
885bd8d4d2 dns: merge branch 'th/dnsmasq-dbus-bgo765043'
https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00144.html
https://bugzilla.gnome.org/show_bug.cgi?id=765043

(cherry picked from commit 497a8aa5c6)
2016-04-22 13:41:03 +02:00
Thomas Haller
3341365e29 dns: avoid using global "/etc/dnsmasq.conf" config for dnsmasq
Pass an empty configuration file otherwise dnsmasq loads
"/etc/dnsmasq.conf".

We already allow for a config.d/ directory "/etc/NetworkManager/dnsmasq.d"
to allow the user to overwrite configuration. We don't want to consider
the global config file.

Fixes: 497a8aa5c6
(cherry picked from commit 3d3f71acec)
2016-04-22 13:40:17 +02:00
Thomas Haller
99168f6009 dns: various cleanup for new dnsmasq's D-Bus support
(cherry picked from commit baaec81aea)
2016-04-22 13:39:23 +02:00
Mathieu Trudel-Lapierre
08673a623f dns: use DBus to make dnsmasq nameserver changes
Use DBus to make nameserver updates rather than restarting the dnsmasq binary
again and again.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>

https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00144.html
(cherry picked from commit 18282df0aa)
2016-04-22 13:39:23 +02:00
Thomas Haller
9f3c8f3e01 dns: add and use _NMLOG() logging macro in nm-dns-plugin.c
(cherry picked from commit 44a61eda77)
2016-04-22 13:39:23 +02:00
Thomas Haller
4fa0f205b6 dns: cleanup managing child process for NMDnsPlugin
The 4 private fields pid, watch_id, progname and pidfile strictly
belong together. When spawning a child, we set all 4 of them and
when killing the child all get cleared. Cleanup to code to always
set those 4 fields together.

(cherry picked from commit 4d5ca7f9de)
2016-04-22 13:39:23 +02:00
Thomas Haller
3571356d9d dns: remove unnecessary finalize() implementation from NMDnsPlugin
dispose() already calls nm_dns_plugin_child_kill(), which clears
both pidfile and progname.

(cherry picked from commit 252258eb2a)
2016-04-22 13:39:23 +02:00
Thomas Haller
853b815266 dns: minor code cleanup in NMDnsPlugin
(cherry picked from commit de9ad6bd8c)
2016-04-22 13:39:23 +02:00
Dan Williams
41f0654818 misc: update maintainers and authors 2016-04-21 13:39:30 -05:00
Lubomir Rintel
65676f9fd9 release: bump to 1.2.1 (development) 2016-04-20 18:58:34 +02:00
Lubomir Rintel
d3d648f9ef release: bump version to 1.2.0 2016-04-20 18:17:56 +02:00
Lubomir Rintel
8ea39c3f1c modem: cancel secrets only if there's an outstanding request
Fixes an assertion failure on WWAN connection attempts that fail before
secrets are requested.

(cherry picked from commit 22c11f8ef1)
2016-04-20 18:16:35 +02:00
Thomas Haller
fa7cacd7df manager: fix wrongly removing DNS configuration on shutdown
When NetworkManager exits, it must preserve the DNS configuration of
devices that are left up.

Fixes: 9498ea507e
(cherry picked from commit 2158d6a5a8)
2016-04-20 17:54:24 +02:00
Lubomir Rintel
0633974952 libnm/vpn-service-plugin: don't register a bus name before creating the VPN object
Otherwise NetworkManager can be too fast calling a method:

  <error> [1461073999.2362] vpn-connection[0x7fe39ec491e0,be049803-a705-438f-b8f5-49db87640c93,"libreswan",0]:
  plugin NeedSecrets request #1 failed: No such interface 'org.freedesktop.NetworkManager.VPN.Plugin'
  on object at path /org/freedesktop/NetworkManager/VPN/Plugin

(cherry picked from commit 843a05f7cc)
2016-04-20 10:50:14 +02:00
Lubomir Rintel
8de4c718af infiniband: remove the partitions on unrealizing
The infiniband drivers don't implement the rtnetlink link deletions.
Therefore we unrealize the NMDevice instance but the backing resources
stay around, preventing us from ever realizing the device again.

(cherry picked from commit a93807c288)
2016-04-20 10:49:35 +02:00
Lubomir Rintel
bb5a51aab3 platform: add functionality to remove infiniband partitions
(cherry picked from commit 940a423de4)
2016-04-20 10:49:34 +02:00
Lubomir Rintel
7c229b6562 libnm-core: empty key is not a pkcs12 file
nmcli> set 802-1x.ca-cert file:///tmp/certs/eaptest_ca_cert.pem
  (process:31015): libnm-CRITICAL **: crypto_is_pkcs12_data: assertion 'data != NULL' failed
  Error: failed to set 'ca-cert' property: PEM certificate had no start tag '-----BEGIN CERTIFICATE-----'.

(cherry picked from commit 1d66d415b8)
2016-04-20 10:49:34 +02:00
Beniamino Galvani
8fa4375e9e examples: fix crash in add-connection-libnm
Reported-by: Ali Nematollahi <alirezan1@gmail.com>
(cherry picked from commit 76348adb8e)
2016-04-20 09:47:28 +02:00
Dan Williams
866a5389e1 Revert "core: don't leak ActiveConnection object on AddAndActivate failure"
This reverts commit 8b6a1ac62f.

Original patch was in error; 'active' is already gs_unref_object.

(cherry picked from commit 2b0e5cd6e6)
2016-04-19 15:24:51 -05:00
Thomas Haller
6ce72f45f6 libnm/vpn: merge branch 'th/vpn-load-plugin-bgo765225'
Allow loading VPN plugins without absolute path.

Omit nm_vpn_editor_plugin_load() function from backporting
as that is 1.4 API.

https://bugzilla.gnome.org/show_bug.cgi?id=765225
2016-04-19 15:32:06 +02:00