Commit Graph

24261 Commits

Author SHA1 Message Date
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
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
f23fa470a7 shared/tests: add tests for NMRefString 2019-10-16 08:53:39 +02:00
Thomas Haller
5ed917a8c1 shared: avoid extra asserts in production code for NMRefString
These asserts were always intended as for extra debugging mode.
Don't enable them in production code.

Fixes: 908fadec96 ('shared: add NMRefString')
2019-10-16 08:53:33 +02:00
Thomas Haller
61ccdf1710 shared: fix crash in nm_ref_string_new_len()
Obvious bug, apparently untested so far :)
No worry, this code will get in use soon.

Fixes: 908fadec96 ('shared: add NMRefString')
2019-10-16 08:37:02 +02:00
Beniamino Galvani
495ae4a676 merge: branch 'bg/802-1x-optional'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/249
https://bugzilla.redhat.com/show_bug.cgi?id=1698532
2019-10-15 08:47:01 +02:00
Beniamino Galvani
eb3e932b6a ifcfg-rh: drop trailing dot from error messages 2019-10-15 08:34:31 +02:00
Beniamino Galvani
8afce75bf3 ethernet: honor the 802-1x.optional property
If the 802.1X authentication fails and 802-1x.optional is set,
continue with activation. In this case, subscribe to the auth-state
supplicant property so that any dynamic IP method can be restarted
when the authentication succeeds. This is because upon authentication
the switch could have changed the VLAN we are connected to.
2019-10-15 08:34:31 +02:00
Beniamino Galvani
8763e6da9c all: add 802-1x.optional property
Introduce a 802-1x.optional boolean property that can be used to
succeed the connection even after an authentication timeout or
failure.
2019-10-15 08:34:31 +02:00
Beniamino Galvani
5b4f4a4c30 supplicant: export authentication state
Add a property to the supplicant to indicate the current state of the
authentication process.
2019-10-15 08:34:31 +02:00
Beniamino Galvani
292ba430a0 ifcfg-rh: refactor reading 802.1X phase2 auth method
Refactor reading the phase2 authentication method for 802.1X.
Previously the reader only considered the first item of the
space-separated list; but since the 802.1x setting can hold distinct
phase2-auth and phase2-autheap properties - both mapped to the same
ifcfg-rh variable - we should parse the whole list. We only emit a
warning when multiple methods of the same type are found to avoid
breaking existing manually written ifcfg files.

Moreover, the reader implemented different checks for each of the
outer tunneled methods (PEAP, TTLS and FAST); drop those checks and
accept whatever the 802.1X setting also consider as valid. Note that
some combinations that are in principle valid, like PEAP + EAP-MD5,
were dropped before.
2019-10-15 08:33:46 +02:00
Beniamino Galvani
c7fc49cfa0 libnm-core: update 802-1x.phase2-auth* documentation
Only a single method is allowed for 802-1x.phase2-auth and
802-1x.phase2_autheap properties. Update the documentation.
2019-10-15 08:08:56 +02:00
Thomas Haller
10c63f167d core: don't use pointer value for pending action string in active-connection
The pending action gets logged. We should not log plain pointer
values because they may be used to defeat ASLR.

Instead, construct the pending action using the "version_id". This
number is also unique, and suits sufficiently well. With debug logging
you can still grep the log for the corresponding active-connection (and
anyway it's obvious from the context).
2019-10-14 16:37:16 +02:00