Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
01580195fa platform: merge branch 'th/platform-parent-other-netns-bgo753726'
Add support for IFLA_LINK_NETNSID to properly handle linked parent
interfaces that reside in another netns.

This requires support of the IFLA_LINK_NETNSID from both the kernel
and libnl3.

https://bugzilla.gnome.org/show_bug.cgi?id=753726
2015-08-25 22:36:54 +02:00
Thomas Haller
790a0713d2 platform: handle parent interfaces in other netns
The parent of a link (IFLA_LINK) can be in another network namespace and
thus invisible to NM.

This requires the netlink attribute IFLA_LINK_NETNSID which is supported
by recent versions of kernel and libnl.

In this case, set the parent field to NM_PLATFORM_LINK_OTHER_NETNS
and properly handle this special case.
2015-08-25 22:33:14 +02:00
Thomas Haller
31902f8f6b platform: minor refactoring in _nl_get_vtable() 2015-08-25 22:25:23 +02:00
Thomas Haller
677d802be6 platform: minor fix in nm_platform_link_to_string()
This had not real consequences, because @master and @parent are of
the same size.
2015-08-25 22:25:23 +02:00
Thomas Haller
2189c7c75b platform: return const argument from _nl_get_vtable() 2015-08-25 22:25:23 +02:00
Thomas Haller
19ebe51e2e platform: assert we loaded the right libnl library 2015-08-25 22:25:23 +02:00
Thomas Haller
803fc616fd libnm: properly handle floating references in nm_vpn_service_plugin_set_ip6_config() 2015-08-25 18:53:39 +02:00
Thomas Haller
3afa894bfb agent-manager: fix wrong unref in request_remove_agent()
Fixes: 13386f760a
2015-08-25 18:53:39 +02:00
Lubomir Rintel
b823a6b533 libnm: export nm_vpn_service_plugin_set_{ip6_,}config
Seems to be forgotten.
2015-08-25 18:21:36 +02:00
Thomas Haller
da1b6c2c32 settings: merge branch 'th/secret-agent-rh1253407'
Several fixes and refactoring for NMSecretAgent and NMAgentManager.

https://bugzilla.redhat.com/show_bug.cgi?id=1253407
2015-08-25 16:39:06 +02:00
Thomas Haller
13386f760a agent-manager: fix leak of secret-agent 2015-08-25 16:37:44 +02:00
Thomas Haller
9b35d29d06 secret-agent: fix detection of disapearing secret-agent
The signal "notify:g-name-owner" is only emitted for well-known
names, but not for unique connection names (":1.x") such as the secret
agent's connection. Also, it will not be emited for private connections.

That meant that when the client disconnected without explicitly
unregistering, the NMSecretAgent was not cleaned up and leaked
indefinitely.
As only one instance of secret agent with a certain 'identifier/uid'
pair can register, this bug also prevented the client from registering
until restart of NetworkManager.

Fixes: df6706813a
2015-08-25 16:37:44 +02:00
Thomas Haller
214faf4695 agent-manager: refactor logging in agent-manager 2015-08-25 16:37:44 +02:00
Thomas Haller
0b3e021538 secret-agent: add trace logging to secret agent 2015-08-25 16:37:44 +02:00
Thomas Haller
ea14cd45f1 agent-manager: remove @asked field from request
This code was unused, because we never enqueued any hashes
to the @asked list. Note that hashing also might give wrong
hash collisions, so this was buggy anyway.

Also, note that impl_agent_manager_register_with_capabilities()
already ensures that duplicate agents are not registered
in the first place (find_agent_by_identifier_and_uid()).
2015-08-25 16:37:44 +02:00
Thomas Haller
e5c59d1f38 secret-agent: don't assert against existing getpwuid() entry
There is a race and there is no guarantee that getpwuid() can lookup a
uid that (previously) existed. Just accept %NULL as @owner_username.
2015-08-25 16:37:43 +02:00
Thomas Haller
92dda6472c secret-agent: rework handling of asynchronous request and cancelling
Refactor the handling of the asynchronous requests so that now
NMSecretAgent has the following properties:

- The callback will *always* be invoked exactly once (sans crashes).
  Even if you cancel the call or if you dispose NMSecretAgent with
  pending calls. That allows the caller to rely on being called back
  and possibly cleanup the user-data.

- Callbacks are always invoked asynchronously with respect to their
  start-call.

- You can cancel all 3 types of operations, not only the 'GetSecrets'
  call. Note that this will still not cancel the calls 'DeleteSecrets'
  and 'SaveSecrets' on a D-Bus level.
  When cancelling, the callback will be invoked synchronously with
  respect to the cancel call, with an GError indicating the cancellation
  (G_IO_ERROR_CANCELLED).

- During dispose, the callback is also invoked synchronously, with
  some other error reason.

This also fixes a crash where handling of the asynchronous data was
messed up and the priv->requests hash would end up to containing dangling
pointers.

https://bugzilla.redhat.com/show_bug.cgi?id=1253407
2015-08-25 16:37:43 +02:00
Thomas Haller
9cace5b411 libnm/trivial: add code comment to _nm_dbus_error_has_name() 2015-08-25 16:37:43 +02:00
Thomas Haller
cf16010fb6 agent-manager: fix checking for D-Bus error after gdbus switch
With gdbus, errors are now properly translated. We must check for
the error domain/code, intead of the dbus-error.

Fixes: df6706813a
2015-08-25 16:37:43 +02:00
Thomas Haller
88e485bc1d secret-agent: refactor call-id to be of an opaque pointer type instead of a void pointer
This gives some type safety.
2015-08-25 16:37:43 +02:00
Thomas Haller
8ed98a381b secret-agent: fix leak of @dbus_owner
The @dbus_owner field was only cleaned up when the
proxy disconnected and leaked otherwise.

Also, don't clear @dbus_owner together with the proxy.
Otherwise, get_description() might yield different results
after the proxy got cleared. That can lead to problems because
NMAgentManager tracks the secrets agents by their "dbus-owner" --
IOW, NMAgentManager uses the "dbus-owner" as identifer for the
secret agent. Thus it must not change.

Fixes: 2a2fd1216b
2015-08-25 16:37:43 +02:00
Thomas Haller
6bcc1eda0b macros: add NM_PRINT_FMT_QUOTE_STRING() macro 2015-08-25 16:37:43 +02:00
Beniamino Galvani
127a4c5d9e dispatcher: merge branch 'bg/dispatch-sync-requests-rh746703'
Allow scripts to be marked as "no-wait", so that the dispatcher will
schedule them immediately and in parallel with other no-wait scripts.
This is particularly useful for pre-up scripts to avoid excessive
delays when activating multiple interfaces in parallel.

https://bugzilla.gnome.org/show_bug.cgi?id=746703
2015-08-25 16:24:49 +02:00
Thomas Haller
e7685f4304 dispatcher: refactor logging of nm-dispatcher
Refactor logging so that all logging lines for a request/script
have the same prefix, indicating the event to which they belong.

Previously, we only scheduled one script at a time so it was always
clear for which request a script belongs. Now we schedule scripts
in parallel, so we must know the event (request) for which we log
a message.
2015-08-25 15:27:19 +02:00
Thomas Haller
e81ba75949 dispatcher: return error reason from nm_dispatcher_utils_construct_envp()
Also, error out in handle_action() when nm_dispatcher_utils_construct_envp()
indicates a failure.
2015-08-25 15:27:19 +02:00
Thomas Haller
199754a845 dispatcher: remove local @iface variable from handle_action() 2015-08-25 15:27:18 +02:00
Thomas Haller
38fa197bab dispatcher: move clearing @quit_id in handle_action()
First create and initialize @request, and then start it.
2015-08-25 15:27:18 +02:00
Thomas Haller
8143d895ca dispatcher: use slice allocator for Request and ScriptInfo 2015-08-25 15:27:18 +02:00
Thomas Haller
e97a334e37 dispatcher: run "wait" scripts only after "no-wait" scripts complete
Previously, dispatcher would start all "no-wait" script right away,
but it would also start the first "wait" script while the "no-wait"
script are still running (unless, there are other "wait" scripts that
delay the execution).

Now, do not start processing the "wait" scripts, as long as there are
any "no-wait" scripts from the same request running.
2015-08-25 15:27:18 +02:00
Beniamino Galvani
1999723241 nm-dispatcher: allow scripts to be marked as no-wait
When a script is a symbolic link to the 'no-wait.d' subdirectory, the
dispatcher now schedules it immediately and in parallel with other
no-wait scripts.

https://bugzilla.gnome.org/show_bug.cgi?id=746703
2015-08-25 15:27:18 +02:00
Beniamino Galvani
2e2e588cd5 nm-dispatcher: fix memory leaks 2015-08-25 15:27:18 +02:00
Beniamino Galvani
0bc335cfbe libnm: backport NMSettingWired Wake-on-LAN symbols to 1.0.6
Backport to 1.0.6 the following symbols:

  - nm_setting_wired_get_wake_on_lan
  - nm_setting_wired_get_wake_on_lan_password
  - nm_setting_wired_wake_on_lan_get_type

added to 1.0.6 with commit d449d823046ac02f19d086575a19be7f40278bd0
2015-08-25 10:23:57 +02:00
Beniamino Galvani
0969d16ad8 libnm: backport enum conversion utilities to 1.0.6
Backport to 1.0.6 the following symbols:

  - nm_utils_enum_from_str
  - nm_utils_enum_to_str

added to 1.0.6 with commit f4ce6760e0ebb66aee3df35e9618be656355f318
2015-08-25 10:23:57 +02:00
Thomas Haller
b2a66d59c8 Revert "all: change "Since: 1.2" to "Since: 1.0.4"/"Since: 1.0.6" for backported API"
API should be added with "Since:" of the next release on the same branch.
That means, new API on 1.1 branch (development), should be "Since: 1.2"
and new API on 1.0 branch (stable) will be "Since: 1.0.x". Similarly, new
API on master is NM_AVAILABLE_IN_1_2 and will be added with the linker
version libnl_1_2 -- never the versions of minor releases.

It is also strongly advised that for the 1.0 branch, we only add API
that was previously formerly added on master. IOW, that we only do true
backports of API that already exists on master.

API that gets backported, must also be added to master via NM_BACKPORT_SYMBOL().
That gives ABI compatibility and an application that was build against 1.0.x
will work with 1.y.z version (y > 0) without need for recompiling -- provided
that 1.y.z also contains that API.

There is one important caveat: if a major branch (e.g. current master) has a
linker section of backported APIs (e.g. libnm_1_0_6), we must do the minor release
(1.0.6) before the next major release (1.2). The reason is that after the major
release, the linker section (libnm_1_0_6) must not be extended and thus
the minor release (1.0.6) must be already released at that point.

In general, users should avoid using backported API because it limits
the ability to upgrade to arbitrary later versions. But together with the
previous point (that we only backport API to minor releases), a user that
uses backported API can be sure that a 1.y.z version is ABI compatible with
1.0.x, if the 1.y.z release date was after the release date of 1.0.x.

This reverts commit 02a136682c.
2015-08-25 09:04:35 +02:00
Beniamino Galvani
913f5d9898 settings: fix memory leak in for_each_secret()
Fixes: df6706813a
2015-08-24 16:15:50 +02:00
Jiří Klimeš
75b3107b09 libnm-util: fix flags for GObject introspection (rh #1255436)
Without marking the enumeration as flags, the types will be "enumeration"
instead of "bitfield". And python raises ValueError exception.

Example:
from gi.repository import NMClient, NetworkManager
client = NMClient.Client.new()
for dev in client.get_devices():
    if dev.get_device_type() == NetworkManager.DeviceType.WIFI:
        for ap in dev.get_access_points():
            ap.get_rsn_flags()

raises "ValueError: invalid enum value: 648"

https://bugzilla.redhat.com/show_bug.cgi?id=1255436
2015-08-24 12:33:12 +02:00
Jiří Klimeš
cb64067b7a examples: add flags and mode parsing to show-wifi-networks.[lua|py] 2015-08-24 12:33:04 +02:00
Thomas Haller
d46a2c1af3 merge: fix racing issues in NMManager/prop_filter (th/prop-filter-bgo753874)
https://bugzilla.gnome.org/show_bug.cgi?id=753874
2015-08-21 17:31:45 +02:00
Thomas Haller
751c674643 manager: fix race subscribing prop_filter()
prop_filter() gets invoked on another thread and we don't take
a strong reference to the manager when subscribing the filter.

Fix the race, by passing on a weak reference.
2015-08-21 17:26:18 +02:00
Thomas Haller
52ed6a8e5c manager: check for object type in do_set_property_check() 2015-08-21 17:20:46 +02:00
Thomas Haller
c79d6dfc1b manager: don't invoke non-thread-safe operations during prop_filter()
prop_filter() is run on another thread. It cannot make use of
the non-thread-safe object NMBusManager.
2015-08-21 17:20:46 +02:00
Thomas Haller
eca0d12306 manager: also audit-log early failure to setting property 2015-08-21 17:10:24 +02:00
Thomas Haller
d188dbe9c3 manager: use slice allocator for PropertyFilterData 2015-08-21 17:10:24 +02:00
Thomas Haller
9fe46cd24f manager: take a reference to NMBusManager 2015-08-21 17:10:24 +02:00
Lubomir Rintel
00b73a9f10 libnm,vpn-editor-plugin: don't assert the plugin name is the same as service name
It's not. It's meant to be human readable (e.g. "IPSec network that sometimes
works").
2015-08-21 16:06:39 +02:00
Lubomir Rintel
4b9f56ecfb Revert "libnm,vpn-editor-plugin: don't assert the plugin name is the same as service name"
This reverts commit 7583f6fc5e.
2015-08-21 16:00:37 +02:00
Lubomir Rintel
7583f6fc5e libnm,vpn-editor-plugin: don't assert the plugin name is the same as service name
It's not. It's meant to be human readable (e.g. "IPSec network that sometimes
works").
2015-08-21 13:37:24 +02:00
Jiří Klimeš
79db8e83e1 libnm: fix the callback in g_simple_async_result_new() 2015-08-21 13:36:05 +02:00
Lubomir Rintel
4fb5879c44 build: avoid premature expanding
We want ${prefix} unexpanded in a .pc files and the rest expands just fine in
Makefiles.
2015-08-21 10:53:16 +02:00
Jiří Klimeš
02a136682c all: change "Since: 1.2" to "Since: 1.0.4"/"Since: 1.0.6" for backported API 2015-08-21 10:43:53 +02:00