- implements 'nmcli connection add type adsl'
- initializes adsl.protocol for 'nmcli con edit type adsl'
- fixes errors in adsl properties in libnm-core/libnm-util
g_dbus_message_get_interface() can return NULL in the message filter,
for example when the client does:
#!/usr/bin/env python
import dbus
bus = dbus.SystemBus()
proxy = bus.get_object("org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager")
proxy.foobar()
Use g_strcmp0() to compare the interface and member names.
Fixes: 34ba4e14b8
While an NMExportedObject is exported (i.e. registered at NMBusManager),
it has a list of GDBusInterfaceSkeleton interfaces. The properties of
the nm-object are bound to the interfaces and the signals connected.
Previously, when unexporting the NMExportedObject, we would only unref
the interfaces, but not explicitly disconnect. As there is no guarantee
that the lifetime of the interfaces is shorter then the lifetime of the
nm-object, hence, explicitly disconnect.
Clone the connection upon activation. This makes it safe for the user
to modify the original connection while it is activated.
This involves several changes:
- NMActiveConnection gets @settings_connection and @applied_connection.
To support add-and-activate, we constructing a NMActiveConnection with
no connection set. Previously, we would set the "connection" field to
a temporary NMConnection. Now NMManager piggybacks this temporary
connection as object-data (TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE).
- get rid of the functions nm_active_connection_get_connection_type()
and nm_active_connection_get_connection_uuid(). From their names
it is unclear whether this returns the settings or applied connection.
The (few) callers should figure that out themselves.
- rename nm_active_connection_get_id() to
nm_active_connection_get_settings_connection_id(). This function
is only used internally for logging.
- dispatcher calls now get two connections as well. The
applied-connection is used for the connection data, while
the settings-connection is used for the connection path.
- needs special handling for properties that apply immediately
when changed (nm_device_reapply_settings_immediately()).
Co-Authored-By: Thomas Haller <thaller@redhat.com>
https://bugzilla.gnome.org/show_bug.cgi?id=724041
NMSecretAgent (and in turn NMAgentManager) used the @connection argument both
for the connection data, but also for the connection path. Detangle these, and
accept the path separate from the connection.
This makes NMSecretAgent and NMAgentManager truly operate on a plain
NMConnection, without the non-obvious requirement, that the path of the
connection must be set.
Those getters are convenience methods to retrieve the id/type from
the NMSettingConnection. If the NMSettingConnection was missing
(and thus the connection invalid) we would raise an assertion.
Don't be so strict and just silently return NULL.
Otherwise, the caller cannot use the functions on unverified
connections.
This now gives every logging line of a NMVpnConnection
a fully descriptive prefix.
Especially for non-debug logging, this looks a bit verbose
and repetitive, so we could suppress the prefix in that case.
I still add it because I think the verbose information does help
during debugging.
connection_added() can be called before init_get_settings_cb(), and we can't
complete the connection until it is visible, else it would be uninitialized.
Test case:
* have 'em1' interface
$ nmcli con add type ethernet con-name myeth ifname em1 autoconnect no
(process:9039): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed
Connection '(null)' ((null)) successfully added.
$ nmcli con add type ethernet con-name myeth ifname em1X autoconnect no
Connection 'myeth' (71159504-c2af-4773-8ca9-a3626aa0da33) successfully added.
https://bugzilla.gnome.org/show_bug.cgi?id=754767https://bugzilla.gnome.org/show_bug.cgi?id=754794
[lkundrak@v3.sk: This is not quite the correct fix, we shouldn't emit
NMObject:connection-added for an unfinished object. Nevertheless, let's go with
it until we have a better one. Will revert this afterwards. See linked bugs.]
Refactor agent-manager to always invoke the complete function for
nm_agent_manager_get_secrets().
In general, the complete function is always invoked asnychronously
when starting the operation. On the other hand, when cancelling the
operation or disposing the manager with pending operations, we now
(always) synchronously invoke the callback.
This makes it simpler for the user to reliably cancel the request
and perform potential cleanup.
This behavior bubbles up through NMSettingsConnection and NMActRequest,
and other callers that make directly or indicrectly make use of
nm_agent_manager_get_secrets().
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.
This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).
OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).
In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).
Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.
For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
- move nm_auth_chain_check_done() and nm_auth_chain_remove_call()
into the only caller auth_call_complete().
- take a ref of the "context" argument.
- in nm_auth_chain_add_call(), assert that we didn't yet invoke the
done-callback. The auth-chain should not be reusued.
- use slice allocator for ChainData, AuthCall and NMAuthChain
This way, the function matches the other names like nm_device_set_unmanaged().
Arguably, the name currently makes some sense. But future commits will make
nm_device_get_unmanaged() more to be a counterpart of nm_device_set_unmanaged().