Commit Graph

24272 Commits

Author SHA1 Message Date
Thomas Haller
cb4bd173eb libnm: fix nm_device_delete_async() after GDBusConnection rework
Fixes: c1046dd803 ('libnm: implement nm_device_delete()/nm_device_delete_async() by using GDBusConnection directly')
2019-10-17 15:06:24 +02:00
Thomas Haller
198591a694 libnm: merge branch 'th/libnm-no-dbus-codegen-1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/299
2019-10-16 18:02:42 +02:00
Thomas Haller
558dacce89 libnm: implement nm_client_add_connection*() by using GDBusConnection directly 2019-10-16 08:56:01 +02:00
Thomas Haller
5f31fd3951 libnm: implement nm_client_save_hostname_async() by using GDBusConnection directly 2019-10-16 08:56:01 +02:00
Thomas Haller
90487ef509 shared: allow "NMRefString" typedef to be forward declared by naming the struct 2019-10-16 08:56:00 +02:00
Thomas Haller
c92eb66d38 libnm: implement nm_client_save_hostname() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
356f1f6f33 libnm: implement nm_client_reload_connections_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
89c1007f92 libnm: implement nm_client_reload_connections() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
4af6219226 libnm: implement nm_client_load_connections_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
d795bcd730 libnm: implement nm_client_load_connections() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
c1046dd803 libnm: implement nm_device_delete()/nm_device_delete_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
6ee416d247 libnm: implement nm_device_disconnect()/nm_device_disconnect_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
bafabddece libnm: implement nm_device_get_applied_connection()/nm_device_get_applied_connection_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
3a66761b92 libnm: implement nm_device_reapply()/nm_device_reapply_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
36df8eabe6 libnm: implement nm_remote_connection_get_secrets()/nm_remote_connection_get_secrets_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
fb3d91db30 libnm: implement nm_remote_connection_delete()/nm_remote_connection_delete_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
dd94a8c0a9 libnm: implement nm_remote_connection_save()/nm_remote_connection_save_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
eff5e730ef libnm: implement nm_remote_connection_update2() by using GDBusConnection directly
Also, implement nm_remote_connection_commit_changes_async() by calling
nm_remote_connection_update2(). It already was also calling the
Update2() D-Bus method.
2019-10-16 08:56:00 +02:00
Thomas Haller
79fbe7a578 libnm: implement nm_remote_connection_commit_changes() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
7871105ff9 libnm: implement nm_device_wifi_p2p_start_find()/nm_device_wifi_p2p_stop_find() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
999e4c6692 libnm: implement nm_device_wifi_request_scan_async() by using GDBusConnection directly
No longer keep track if a request is already pending. Previously,
in that case, the function would return success in an idle handler.

Instead, just always issue the new request. It's up to the caller to
rate-limit the requests and trigger a scan whenever appropriate. libnm
should not add additional logic to that.
2019-10-16 08:56:00 +02:00
Thomas Haller
e2b27f5736 libnm: implement nm_device_wifi_request_scan() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
09e275dc28 libnm: implement nm_client_reload() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
b1871a7549 libnm: implement nm_client_checkpoint_adjust_rollback_timeout() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
1bce0a090f libnm: implement nm_client_checkpoint_rollback() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
3a50585391 libnm: implement nm_client_checkpoint_destroy() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
5bdffa0ffd libnm: implement nm_client_checkpoint_create() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
b44d883d92 libnm: implement nm_client_check_connectivity_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
9bc83ca102 libnm: implement nm_client_check_connectivity() by using GDBusConnection directly
Note that nm_client_check_connectivity() has this odd behavior of
updating the connectivity state right away. We keep doing that.
2019-10-16 08:56:00 +02:00
Thomas Haller
2f21e96e84 libnm: implement nm_client_get_logging()/nm_client_set_logging() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
9f8aacf62a libnm: implement nm_client_networking_set_enabled() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
c85f6c7e85 libnm: implement synchronous get-permission check by using GDBusConnection directly
Drop uses of nmdbus_manager_call_get_permissions_sync().

Of course, we should ever call synchronous API while initizliaing the
NMClient. Needs to be fixed eventually.
2019-10-16 08:56:00 +02:00
Thomas Haller
332a7131a7 libnm: implement asynchronous get-permission check by using GDBusConnection directly
Drop uses of nmdbus_manager_call_get_permissions().
2019-10-16 08:56:00 +02:00
Thomas Haller
90d0ae0faf libnm: implement nm_client_activate_connection()/nm_client_add_and_activate_connection*() by using GDBusConnection directly
We still need the bits in "nm-manager.c", to wait until the
NMActiveConnection instance is ready. This is now done by
nm_manager_complete_active_connection().
2019-10-16 08:56:00 +02:00
Thomas Haller
eaddc22775 libnm: implement nm_client_deactivate_connection_async() by using GDBusConnection directly 2019-10-16 08:56:00 +02:00
Thomas Haller
0625f2c094 libnm: implement nm_client_deactivate_connection() by using GDBusConnection directly
Eventually, I will refactor libnm to no longer use gdbus-codegen and
no GDBusProxy. In preparation of that, we must stop using that
API.

As first step, change nm_client_deactivate_connection(). Note how this
was done previously:

 - nm_client_deactivate_connection() calls nm_manager_deactivate_connection()
   - nmdbus_manager_call_deactivate_connection_sync() calls g_dbus_proxy_call_sync()
     - g_dbus_proxy_call_sync() calls g_dbus_connection_call_sync()

Currently this is still a bit ugly, because NMClient doesn't directly
track the GDBusConnection nor the name owner. Instead, we need to peel
it out of the object manager. One day, that will all be nicer, but first
get rid of gdbus-codegen.
2019-10-16 08:56:00 +02:00
Thomas Haller
e6e6057a13 libnm: add helper functions for refactoring D-Bus calls in libnm
We will drop GDBusProxy and the gdbus-codegen classes. First, we need to
replace all D-Bus calls from nmdbus_*() API with plain uses of GDBusConnection.
For that, add accessors to get the dbus-connection and the name-owner.

This API is not beautiful, it's an interim solution for now.
2019-10-16 08:56:00 +02:00
Thomas Haller
ba2e1d52ad libnm,client: use nm_g_task_new() to set source-tag and check it
Public API should validate input arguments with g_return_*().
Tag the task with the source function (using nm_g_task_new())
and check it in the corresponding _finish() function.
2019-10-16 08:56:00 +02:00
Thomas Haller
03633fef42 shared: add nm_dbus_connection_call_finish_*_cb() helpers 2019-10-16 08:56:00 +02:00
Thomas Haller
9059b49002 shared: add nm_g_task_new() and nm_g_task_is_valid() helper
Note that we should always set the source-tag of our GTask.
This allows us to better assert that the user uses the right
_finish() method for the task.

The plain g_task_new() does not have a souce-tag argument. Hence, we would
always need to explicitly call g_task_set_source_tag().

Likewise, to check the source tag, we would always need to write

  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
  g_return_val_if_fail (g_async_result_is_tagged (result, tag), FALSE);

Actually, g_async_result_is_tagged() uses the GAsyncResultIface to
call iface->is_tagged(). This has unnecessary overhead, so we should
just call g_task_get_source_tag() directly.

Add helper functions for that.
2019-10-16 08:56:00 +02:00
Thomas Haller
256ba8c4cd libnm/tests: fix test for nm_client_add_and_activate_connection_async()
nm_client_add_and_activate_connection_async() must be completed by
nm_client_add_and_activate_connection_finish().

Fixes: be8060f42f ('libnm: add an object-creation-failed test')
2019-10-16 08:56:00 +02:00
Thomas Haller
86097cc2e8 libnm: fix return value for nm_remote_settings_reload_connections*() to ignore server result
Note that the server always returns TRUE for the boolean return value
of ReloadConnections. Hence, this should not change in behavior, because
the server would never have returned FALSE.

However, change behavior of the API. It's odd that the function might
return %FALSE without setting the error output. It's also not clear
what the boolean value of the "ReloadConnections" D-Bus would mean
anyway.
2019-10-16 08:56:00 +02:00
Thomas Haller
9dac3076f7 libnm: fix return value for nm_remote_settings_load_connections() to ignore server result
nm_remote_settings_load_connections() and nm_remote_settings_load_connections_async()
behave inconsistently.

It's unexpected, that a FALSE return value may leave @error unset.

Note that before commit 22e830f046 ('settings/d-bus: fix boolean
return value of "LoadConnections"'), the server boolean response
would have been bogus anyway (at least for some versions).

Unify the behavior, and ignore the boolean return value.
2019-10-16 08:56:00 +02:00
Thomas Haller
28d69b5642 libnm/device: simplify prepare_scan_options() for Wi-Fi scanning
It doesn't actually do anything, as the FIXME comment indicates.
I don't think there is anything to do either. Just simplify the
function.
2019-10-16 08:56:00 +02:00
Thomas Haller
40911fb99b libnm/device: fix memleak options variant in nm_device_wifi_request_scan_options*()
A function that accepts a floating variant must consume it.

Fixes: 7691fe5753 ('libnm: add new functions allowing passing options to RequestScan() D-Bus call')
2019-10-16 08:56:00 +02:00
Thomas Haller
92285cfd3e libnm/device: fix memleak in nm_device_wifi_request_scan_options*()
Fixes: 7691fe5753 ('libnm: add new functions allowing passing options to RequestScan() D-Bus call')
2019-10-16 08:56:00 +02:00
Thomas Haller
b9ff785744 libnm: fix annotation for return value of nm_remote_connection_get_secrets() 2019-10-16 08:56:00 +02:00
Thomas Haller
75a04a8a54 libnm: fix annotation for return value of nm_remote_connection_update2() 2019-10-16 08:56:00 +02:00
Thomas Haller
d80af0225e libnm: mark more synchronous libnm API as deprecated
This is a follow-up to commit e90684a169 ('libnm: deprecate
synchronous/blocking API in libnm') to mark more of such synchronous
API as deprecated.
2019-10-16 08:56:00 +02:00
Thomas Haller
194443237a libnm/trivial: remove unused struct RequestScanInfo in "nm-device-wifi-p2p.c" 2019-10-16 08:56:00 +02:00