Commit graph

14776 commits

Author SHA1 Message Date
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
Thomas Haller
2fb5aaecef libnm/vpn: search VPN plugin in NMPLUGINDIR
In commit ca000cffbb, we changed to
accept a plugin library name without path. One reason for that
is to keep architecture dependent parts out of the .name file
and possibly support multilib.

However, the shared libraries of VPN plugins are not installed in
a global library search path, but for example into
"/usr/lib64/NetworkManager/libnm-vpn-plugin-openvpn.so".
In that case, specifying "plugin=libnm-vpn-plugin-openvpn.so"
would not be enough to find plugin.

Instead, when configuring a plugin name without path, assume
it is in NMPLUGINDIR directory. Modify nm_vpn_editor_plugin_load_from_file()
to allow path-less plugin-names. Previously such names would be rejected
as not being absolute. This API allows to do file verification
before loading the plugin, but it now supports prepending NMPLUGINDIR
to the plugin name. Basically, this function mangles the plugin_name
argument and checks that such a file exists.

The recently added nm_vpn_editor_plugin_load() continues to behave
as before: it does no checks whatsoever and passes the name directly
to dlopen(). That way, it uses system search paths like LD_LIBRARY_PATH
and performs no checks on the file.

Fixes: ca000cffbb
(cherry picked from commit 0b128aeced)
2016-04-19 15:16:07 +02:00
Thomas Haller
5bc6e22528 libnm/vpn: allow specifying non-absolute plugin name in VPN .name file
Since commit 3dfbbb227e, we enforce that
the plugin path in the .name file is absolute and we perform several
checks on the file before loading it (ownership, etc).

Relax that, to also allow libray names without path component.
In that case, g_module_open()/dlopen() will search for a library
in various search paths. This allows, to omit absolute paths
in the .name file. The latter is problematic, because by default
we install the .name file in the architecture independent location
/usr/lib/NetworkManager. As such, it should not contain paths
to architecture dependent libraries. With this change, a .name
file can contain only the library name and it will be loaded
using the usual mechanism.

However, specifying absolute paths is still possible and works
same as before, including checking file permissions.

As such, distributions probably should package the VPN plugins
to have no path in the .name file. On the other hand, a user
compiling from source probably wants to specify an absolute
path. The reason is, that the user probably doesn't build the
plugin for multiple achitectures and that way, he can install
the plugin in a separate (private) prefix.

(cherry picked from commit ca000cffbb)
2016-04-19 15:16:07 +02:00
Thomas Haller
e10f50400f libnm/vpn: fix code comment for nm_vpn_editor_plugin_load_from_file()
The @plugin_filename argument must be an absolute path.
That was changed later, but forgot to update the comment.

Fixes: 3dfbbb227e
(cherry picked from commit cb22f02588)
2016-04-19 15:14:17 +02:00
Thomas Haller
dd28e792ee libnm/vpn: clear internal "keyfile" from NMVpnPluginInfo
The GKeyFile is no longer needed after constuction. All strings are
copied over to the "keys" hash.

(cherry picked from commit 4003edbbf9)
2016-04-19 15:14:17 +02:00
Thomas Haller
f25a8fee7e libnm/vpn: lookup nm_vpn_plugin_info_supports_multiple() from cached values
Instead of looking into the keyfile, lookup the "supports-multiple-connections" setting
in the "keys" hash. This has some behavioral difference:

  - g_key_file_get_boolean() first does g_key_file_get_value(), and then
    converts the string using the private g_key_file_parse_value_as_boolean()
    function -- which is case-sensitive, accepts "true|false|0|1" and
    considers only the text until the first whitespace.

  - now, we put g_key_file_get_string() into the cache "keys" and
    parse it with _nm_utils_ascii_str_to_bool(). The latter is
    case insensitive, allows also "yes|no|on|off", strips whitespaces.

However, the difference is subtle and shouldn't matter.

The point of this change is to free "keyfile" after construction.

(cherry picked from commit 6878999ca3)
2016-04-19 15:14:17 +02:00
Thomas Haller
7e41c15ace shared: move nm_utils_ascii_str_to_bool() to shared/nm-shared-utils.h
(cherry picked from commit 186787744c)
2016-04-19 15:14:17 +02:00
Lubomir Rintel
e3e7a25429 device: check for a parent device
The device creation can be attempted if the name can be determined. It
alone is doesn't mean that there's a parent device -- the name could
just have been hardcoded in the connection.

  NetworkManager[21519]: nm_device_get_ifindex: assertion 'NM_IS_DEVICE (self)' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00007ffff4ec88c3 in g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046
  #1  0x00007ffff4ec8a3f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
  #2  0x00005555555d2090 in nm_device_get_ifindex (self=0x0) at devices/nm-device.c:562
  #3  0x00005555555ef77a in nm_device_supports_vlans (self=0x0) at devices/nm-device.c:9865
  #4  0x00005555555bf2f9 in create_and_realize (device=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, out_plink=0x7fffffffd5f8, error=0x7fffffffd700) at devices/nm-device-vlan.c:225
  #5  0x00005555555d5757 in nm_device_create_and_realize (self=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, error=0x7fffffffd700) at devices/nm-device.c:1783
  #6  0x0000555555688601 in system_create_virtual_device (self=0x555555af51c0 [NMManager], connection=0x555555b451e0) at nm-manager.c:1120
  #7  0x000055555568894e in connection_changed (settings=0x555555ae8220 [NMSettings], connection=0x555555b451e0, manager=0x555555af51c0 [NMManager]) at nm-manager.c:1172
  #8  0x0000555555693448 in nm_manager_start (self=0x555555af51c0 [NMManager], error=0x7fffffffda30) at nm-manager.c:4466
  #9  0x00005555555d166f in main (argc=1, argv=0x7fffffffdba8) at main.c:454
  (gdb)

Fixes: 332994f1b1
(cherry picked from commit 03584e420f)
2016-04-19 13:33:33 +02:00
Lubomir Rintel
17e9337054 infiniband: check that the connection to be created is a partition first
No functional change. It will make it a bit easier to produce a good
error message in subsequent commit.

(cherry picked from commit 7eca706751)
2016-04-19 13:33:33 +02:00
Lubomir Rintel
6223d32e90 infiniband: consistently use the error code
Only report CREATION_FAILED when we did actually attempt creation.

(cherry picked from commit dda8e24a21)
2016-04-19 13:33:32 +02:00
Lubomir Rintel
af7321ae3f macvlan: fix error handling
(cherry picked from commit f9a0aface3)
2016-04-19 13:33:32 +02:00
Lubomir Rintel
4abb943e84 device-factory: always prefer manually set interface name to a generated one
If the connection specifies an interface name, it should never attach to
a device of a different name even if the factory thinks the connection
is compatible with the device.

This fixes an issue that caused the inifniband connections to attach to
different devices or partitions.

(cherry picked from commit 332994f1b1)
2016-04-18 19:01:56 +02:00
Lubomir Rintel
60226446b3 libnm-core/vpn-connection: get the service for bus path from plugin
...not from the connection. Otherwise the o.fdo.NM.openswan connection
would try to use a name they're not allowed to use.

(cherry picked from commit 178c972fac)
2016-04-18 19:01:55 +02:00
Thomas Haller
401fd3adf9 linux-platform: fix crash in _new_from_nl_link() when sharing lnk data
We want to reuse an existing (equal) lnk-data from the cache.

  NetworkManager[20977]: <debug> [1460993609.1427] platform: signal: link   added: 11: qib_ib0.8002@4 <UP,LOWER_UP;broadcast,multicast,up,running,lowerup> mtu 65520 arp 32 infiniband? not-init addrgenmode eui64 addr 80:00:00:11:FE:80:00:00:00:00:00:00:00:11:75:00:00:6F:33:DE driver ib_ipoib
  ...
  NetworkManager[20977]: <debug> [1460993609.1467] platform-linux: do-request-link: 11
  NetworkManager[20977]: nmp_object_ref: assertion 'NMP_OBJECT_IS_VALID (obj)' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x55555583dcce "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffc8e0) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00002aaaad94b8c3 in g_logv (log_domain=0x55555583dcce "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffc8e0) at gmessages.c:1046
  #1  0x00002aaaad94ba3f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
  #2  0x00005555557863be in nmp_object_ref (obj=0x0) at platform/nmp-object.c:210
  #3  0x0000555555624c0e in event_handler_recvmsgs (id_only=<optimized out>, nlh=<optimized out>, cache=<optimized out>, platform=<optimized out>) at platform/nm-linux-platform.c:1568
  #4  0x0000555555624c0e in event_handler_recvmsgs (id_only=<optimized out>, msg=0x555555b0ebf0, cache=<optimized out>, platform=<optimized out>) at platform/nm-linux-platform.c:1923
  #5  0x0000555555624c0e in event_handler_recvmsgs (handle_events=<optimized out>, msg=0x555555b0ebf0, platform=<optimized out>) at platform/nm-linux-platform.c:3656
  #6  0x0000555555624c0e in event_handler_recvmsgs (platform=platform@entry=0x555555b00980 [NMLinuxPlatform], handle_events=handle_events@entry=1) at platform/nm-linux-platform.c:5886
  #7  0x0000555555626857 in event_handler_read_netlink (platform=platform@entry=0x555555b00980 [NMLinuxPlatform], wait_for_acks=wait_for_acks@entry=0) at platform/nm-linux-platform.c:5942
  #8  0x0000555555627093 in do_request_link_no_delayed_actions (platform=platform@entry=0x555555b00980 [NMLinuxPlatform], ifindex=ifindex@entry=11, name=name@entry=0x0) at platform/nm-linux-platform.c:3480
  #9  0x00005555556273d6 in delayed_action_handle_all (ifindex=11, platform=0x555555b00980 [NMLinuxPlatform]) at platform/nm-linux-platform.c:2918
  #10 0x00005555556273d6 in delayed_action_handle_all (platform=0x555555b00980 [NMLinuxPlatform]) at platform/nm-linux-platform.c:3003
  #11 0x00005555556273d6 in delayed_action_handle_all (platform=0x555555b00980 [NMLinuxPlatform], read_netlink=<optimized out>) at platform/nm-linux-platform.c:3029
  #12 0x000055555562a33f in constructed (_object=<optimized out>) at platform/nm-linux-platform.c:6241
  #13 0x00002aaaad6c0292 in g_object_new_internal (class=class@entry=0x555555b12ef0, params=params@entry=0x7fffffffd660, n_params=2) at gobject.c:1814
  #14 0x00002aaaad6c21d4 in g_object_new_valist (object_type=object_type@entry=93824998249472, first_property_name=first_property_name@entry=0x55555580629e "register-singleton", var_args=var_args@entry=0x7fffffffd7b0) at gobject.c:2034
  #15 0x00002aaaad6c25d1 in g_object_new (object_type=93824998249472, first_property_name=0x55555580629e "register-singleton") at gobject.c:1617
  #16 0x00005555555d1798 in main (argc=1, argv=0x7fffffffda58) at main.c:446

Fixes: db5d00d396
(cherry picked from commit 201d91115c)
2016-04-18 18:00:58 +02:00
Thomas Haller
6ccb6e4abe device: merge branch 'th/device-update-default-route'
(cherry picked from commit a787c7db43)
2016-04-15 21:07:22 +02:00
Thomas Haller
58c501eda5 device: fix preserving the default-route during _cleanup_generic_post()
When we want to preserve the default-route on cleanup, we must first
set it to assumed, before clearing it. Otherwise, NMDefaultRouteManager's
update() will delete the default route.

This is the oposite of the deconfigure case, where we first set it to
!has && !assumed, to force the route-manager to delete the route.

(cherry picked from commit 4697376f99)
2016-04-15 21:06:44 +02:00