From f3c6d0765dff885e168b94f28e06ecc640315a74 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 31 Jan 2020 12:10:14 +0100 Subject: New upstream version 1.22.6 --- libnm/nm-client.c | 117 +++++++++++++++++++++++++++++++++++++++------ libnm/nm-device-wifi-p2p.c | 8 ++-- libnm/nm-wifi-p2p-peer.c | 20 ++++---- 3 files changed, 117 insertions(+), 28 deletions(-) (limited to 'libnm') diff --git a/libnm/nm-client.c b/libnm/nm-client.c index eabbe022..4fa1c1f3 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -2988,9 +2988,12 @@ _dbus_handle_interface_removed (NMClient *self, } static void -_dbus_managed_objects_changed_cb (const char *object_path, - GVariant *added_interfaces_and_properties, - const char *const*removed_interfaces, +_dbus_managed_objects_changed_cb (GDBusConnection *connection, + const char *sender_name, + const char *arg_object_path, + const char *interface_name, + const char *signal_name, + GVariant *parameters, gpointer user_data) { NMClient *self = user_data; @@ -2998,19 +3001,50 @@ _dbus_managed_objects_changed_cb (const char *object_path, const char *log_context; gboolean changed; + nm_assert (nm_streq0 (interface_name, DBUS_INTERFACE_OBJECT_MANAGER)); + if (priv->get_managed_objects_cancellable) { /* we still wait for the initial GetManagedObjects(). Ignore the event. */ return; } - if (!added_interfaces_and_properties) { - log_context = "interfaces-removed"; - changed = _dbus_handle_interface_removed (self, log_context, object_path, NULL, removed_interfaces); - } else { + if (nm_streq (signal_name, "InterfacesAdded")) { + gs_unref_variant GVariant *interfaces_and_properties = NULL; + const char *object_path; + + if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(oa{sa{sv}})"))) + return; + + g_variant_get (parameters, + "(&o@a{sa{sv}})", + &object_path, + &interfaces_and_properties); + log_context = "interfaces-added"; - changed = _dbus_handle_interface_added (self, log_context, object_path, added_interfaces_and_properties); + changed = _dbus_handle_interface_added (self, log_context, object_path, interfaces_and_properties); + goto out; + } + + if (nm_streq (signal_name, "InterfacesRemoved")) { + gs_free const char **interfaces = NULL; + const char *object_path; + + if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(oas)"))) + return; + + g_variant_get (parameters, + "(&o^a&s)", + &object_path, + &interfaces); + + log_context = "interfaces-removed"; + changed = _dbus_handle_interface_removed (self, log_context, object_path, NULL, interfaces); + goto out; } + return; + +out: if (changed) _dbus_handle_changes (self, log_context, TRUE); } @@ -5143,7 +5177,7 @@ nm_client_add_and_activate_connection2_finish (NMClient *client, { return NM_ACTIVE_CONNECTION (_request_wait_finish (client, result, - nm_client_add_connection2, + nm_client_add_and_activate_connection2, out_result, error)); } @@ -6512,12 +6546,13 @@ _init_fetch_all (NMClient *self) priv->get_managed_objects_cancellable = g_cancellable_new (); - priv->dbsid_nm_object_manager = nm_dbus_connection_signal_subscribe_object_manager (priv->dbus_connection, - priv->name_owner, - "/org/freedesktop", - _dbus_managed_objects_changed_cb, - self, - NULL); + priv->dbsid_nm_object_manager = nm_dbus_connection_signal_subscribe_object_manager_plain (priv->dbus_connection, + priv->name_owner, + "/org/freedesktop", + NULL, + _dbus_managed_objects_changed_cb, + self, + NULL); priv->dbsid_dbus_properties_properties_changed = nm_dbus_connection_signal_subscribe_properties_changed (priv->dbus_connection, priv->name_owner, @@ -7398,6 +7433,18 @@ constructed (GObject *object) NML_NMCLIENT_LOG_D (self, "new NMClient instance"); } +static inline gboolean +_dispose_cleanup_context_busy_watcher_cb (gpointer user_data) +{ + nm_auto_unref_gmaincontext GMainContext *context = NULL; + gs_unref_object GObject *context_busy_watcher = NULL; + + nm_utils_user_data_unpack (user_data, &context, &context_busy_watcher); + + nm_assert (G_IS_OBJECT (context_busy_watcher)); + return G_SOURCE_REMOVE; +} + static void dispose (GObject *object) { @@ -7446,6 +7493,46 @@ dispose (GObject *object) nm_clear_pointer (&priv->udev, udev_unref); + if ( priv->context_busy_watcher + && priv->dbus_context) { + GSource *cleanup_source; + + /* Technically, we cancelled all pending actions (and these actions + * (GTask) keep the context_busy_watcher object alive). Also, we passed + * no destroy notify to g_dbus_connection_signal_subscribe(). + * That means, there should be no other unaccounted GSource'es left. + * + * However, we really need to be sure that the context_busy_watcher's + * lifetime matches the time that the context is busy. That is especially + * important with synchronous initialization, where the context-busy-watcher + * keeps the inner GMainContext integrated in the caller's. + * We must not g_source_destroy() that integration too early. + * + * So to be really sure all this is given, always schedule one last + * cleanup idle action with low priority. This should be the last + * thing related to this instance that keeps the context busy. + * + * Note that we could also *not* take a reference on priv->dbus_context + * and unref priv->context_busy_watcher via the GDestroyNotify. That would + * allow for the context to be wrapped up early, and when the last user + * gives up the reference to the context, the destroy notify could complete + * without even invoke the idle handler. However, that destroy notify may + * not be called in the right thread. So, we want to be sure that we unref + * the context-busy-watcher in the right context. Hence, we always take an + * additional reference and always cleanup in the idle handler. This means: + * the user *MUST* always keep iterating the context after NMClient got destroyed. + * But that is not a severe limitation, because the user anyway must be prepared + * to do that. That is because in many cases it is necessary anyway (and the user + * wouldn't know a priory when not). This way, it is just always necessary. */ + cleanup_source = nm_g_idle_source_new (G_PRIORITY_LOW + 10, + _dispose_cleanup_context_busy_watcher_cb, + nm_utils_user_data_pack (g_main_context_ref (priv->dbus_context), + g_steal_pointer (&priv->context_busy_watcher)), + NULL); + g_source_attach (cleanup_source, priv->dbus_context); + g_source_unref (cleanup_source); + } + nm_clear_pointer (&priv->dbus_context, g_main_context_unref); nm_clear_pointer (&priv->main_context, g_main_context_unref); diff --git a/libnm/nm-device-wifi-p2p.c b/libnm/nm-device-wifi-p2p.c index 191d30eb..aa5089c7 100644 --- a/libnm/nm-device-wifi-p2p.c +++ b/libnm/nm-device-wifi-p2p.c @@ -165,8 +165,8 @@ nm_device_wifi_p2p_start_find (NMDeviceWifiP2P *device, cancellable, callback, user_data, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, + _nm_object_get_path (device), + NM_DBUS_INTERFACE_DEVICE_WIFI_P2P, "StartFind", g_variant_new ("(@a{sv})", options), G_VARIANT_TYPE ("()"), @@ -224,8 +224,8 @@ nm_device_wifi_p2p_stop_find (NMDeviceWifiP2P *device, cancellable, callback, user_data, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, + _nm_object_get_path (device), + NM_DBUS_INTERFACE_DEVICE_WIFI_P2P, "StopFind", g_variant_new ("()"), G_VARIANT_TYPE ("()"), diff --git a/libnm/nm-wifi-p2p-peer.c b/libnm/nm-wifi-p2p-peer.c index 50910445..9edf0848 100644 --- a/libnm/nm-wifi-p2p-peer.c +++ b/libnm/nm-wifi-p2p-peer.c @@ -409,15 +409,17 @@ const NMLDBusMetaIface _nml_dbus_meta_iface_nm_wifip2ppeer = NML_DBUS_META_IFACE nm_wifi_p2p_peer_get_type, NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_HIGH, NML_DBUS_META_IFACE_DBUS_PROPERTIES ( - NML_DBUS_META_PROPERTY_INIT_U ("Flags", PROP_FLAGS, NMWifiP2PPeer, _priv.flags ), - NML_DBUS_META_PROPERTY_INIT_S ("HwAddress", PROP_HW_ADDRESS, NMWifiP2PPeer, _priv.hw_address ), - NML_DBUS_META_PROPERTY_INIT_I ("LastSeen", PROP_LAST_SEEN, NMWifiP2PPeer, _priv.last_seen ), - NML_DBUS_META_PROPERTY_INIT_S ("Manufacturer", PROP_MANUFACTURER, NMWifiP2PPeer, _priv.manufacturer ), - NML_DBUS_META_PROPERTY_INIT_S ("Model", PROP_MODEL, NMWifiP2PPeer, _priv.model ), - NML_DBUS_META_PROPERTY_INIT_S ("ModelNumber", PROP_MODEL_NUMBER, NMWifiP2PPeer, _priv.model_number ), - NML_DBUS_META_PROPERTY_INIT_S ("Serial", PROP_SERIAL, NMWifiP2PPeer, _priv.serial ), - NML_DBUS_META_PROPERTY_INIT_Y ("Strength", PROP_STRENGTH, NMWifiP2PPeer, _priv.strength ), - NML_DBUS_META_PROPERTY_INIT_AY ("WfdIEs", PROP_WFD_IES, NMWifiP2PPeer, _priv.wfd_ies ), + NML_DBUS_META_PROPERTY_INIT_U ("Flags", PROP_FLAGS, NMWifiP2PPeer, _priv.flags ), + NML_DBUS_META_PROPERTY_INIT_IGNORE ("Groups", "as" ), + NML_DBUS_META_PROPERTY_INIT_S ("HwAddress", PROP_HW_ADDRESS, NMWifiP2PPeer, _priv.hw_address ), + NML_DBUS_META_PROPERTY_INIT_I ("LastSeen", PROP_LAST_SEEN, NMWifiP2PPeer, _priv.last_seen ), + NML_DBUS_META_PROPERTY_INIT_S ("Manufacturer", PROP_MANUFACTURER, NMWifiP2PPeer, _priv.manufacturer ), + NML_DBUS_META_PROPERTY_INIT_S ("Model", PROP_MODEL, NMWifiP2PPeer, _priv.model ), + NML_DBUS_META_PROPERTY_INIT_S ("ModelNumber", PROP_MODEL_NUMBER, NMWifiP2PPeer, _priv.model_number ), + NML_DBUS_META_PROPERTY_INIT_S ("Name", PROP_NAME, NMWifiP2PPeer, _priv.name ), + NML_DBUS_META_PROPERTY_INIT_S ("Serial", PROP_SERIAL, NMWifiP2PPeer, _priv.serial ), + NML_DBUS_META_PROPERTY_INIT_Y ("Strength", PROP_STRENGTH, NMWifiP2PPeer, _priv.strength ), + NML_DBUS_META_PROPERTY_INIT_AY ("WfdIEs", PROP_WFD_IES, NMWifiP2PPeer, _priv.wfd_ies ), ), ); -- cgit 1.3.0-6-gf8a5 From e536d40eaea5dcdc0743b0a5e8e17faa46608a50 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Wed, 19 Feb 2020 23:31:24 +0100 Subject: New upstream version 1.22.8 --- libnm/libnm.ver | 5 +++++ libnm/nm-active-connection.c | 29 +++++++++++++++++++++++++++++ libnm/nm-client.c | 14 +++++++++++--- libnm/nm-libnm-utils.h | 2 ++ libnm/nm-property-docs.xml | 13 +++++++------ libnm/nm-settings-docs.xml | 13 +++++++------ libnm/nm-settings-ifcfg-rh-docs.xml | 2 ++ 7 files changed, 63 insertions(+), 15 deletions(-) (limited to 'libnm') diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 5e6dd230..326383c8 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1657,3 +1657,8 @@ libnm_1_22_2 { global: nm_client_get_capabilities; } libnm_1_22_0; + +libnm_1_22_8 { +global: + nm_setting_ip6_config_get_ra_timeout; +} libnm_1_22_2; diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index aa8504e6..ade2edbe 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -425,6 +425,33 @@ _nm_active_connection_state_changed_commit (NMActiveConnection *self, _notify_event_state_changed, g_object_ref (self)); } +/*****************************************************************************/ + +static gboolean +is_ready (NMObject *nmobj) +{ + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (nmobj); + + /* Usually, we don't want to expose our NMObject instances until they are fully initialized. + * For NMRemoteSetting this means to wait until GetSettings() returns. + * + * Note that most object types reference each other (directly or indirectly). E.g. the + * NMActiveConnection refers to the NMRemoteConnection and the NMDevice instance. So, + * we don't want to hide them too long, otherwise basically the entire set of objects + * will be hidden until they are all initialized. So, usually, when a NMObject references + * objects that are not yet initialized, that reference will just be NULL but the object + * will be considered ready already. + * + * For NMActiveConnection referencing a NMRemoteConnection don't do that. Here we wait for the + * NMRemoteConnection to be ready as well. This is somewhat arbitrary special casing, but + * the effect is that when nm_client_add_and_activate*() returns, the NMActiveConnection already + * references a initialized NMRemoteConnection. + */ + if (!nml_dbus_property_o_is_ready_fully (&priv->property_o[PROPERTY_O_IDX_CONNECTION])) + return FALSE; + + return NM_OBJECT_CLASS (nm_active_connection_parent_class)->is_ready (nmobj); +} /*****************************************************************************/ @@ -550,6 +577,8 @@ nm_active_connection_class_init (NMActiveConnectionClass *klass) object_class->get_property = get_property; object_class->finalize = finalize; + nm_object_class->is_ready = is_ready; + _NM_OBJECT_CLASS_INIT_PRIV_PTR_INDIRECT (nm_object_class, NMActiveConnection); _NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_N (nm_object_class, NMActiveConnectionPrivate, property_o); diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 4fa1c1f3..0c4daab2 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -1256,7 +1256,7 @@ nml_dbus_object_obj_changed_link (NMClient *self, nm_assert (changed_type != NML_DBUS_OBJ_CHANGED_TYPE_NONE); if (!NM_FLAGS_ALL ((NMLDBusObjChangedType ) dbobj->obj_changed_type, changed_type)) - NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x linked", dbobj->dbus_path->str, (guint) changed_type); + NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x linked", dbobj->dbus_path->str, (guint) changed_type); if (dbobj->obj_changed_type == NML_DBUS_OBJ_CHANGED_TYPE_NONE) { NMClientPrivate *priv; @@ -1302,7 +1302,7 @@ nml_dbus_object_obj_changed_consume (NMClient *self, if (dbobj->obj_changed_type == NML_DBUS_OBJ_CHANGED_TYPE_NONE) { c_list_unlink (&dbobj->obj_changed_lst); nm_assert (changed_type_res != NML_DBUS_OBJ_CHANGED_TYPE_NONE); - NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x consumed", dbobj->dbus_path->str, (guint) changed_type_res); + NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x consumed", dbobj->dbus_path->str, (guint) changed_type_res); return changed_type_res; } @@ -1310,7 +1310,7 @@ nml_dbus_object_obj_changed_consume (NMClient *self, nm_assert (!c_list_contains (&priv->obj_changed_lst_head, &dbobj->obj_changed_lst)); nm_c_list_move_tail (&priv->obj_changed_lst_head, &dbobj->obj_changed_lst); - NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x consumed (still has 0x%02x)", dbobj->dbus_path->str, (guint) changed_type_res, (guint) dbobj->obj_changed_type); + NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x consumed (still has 0x%02x)", dbobj->dbus_path->str, (guint) changed_type_res, (guint) dbobj->obj_changed_type); return changed_type_res; } @@ -1567,6 +1567,14 @@ nml_dbus_property_o_is_ready (const NMLDBusPropertyO *pr_o) || !pr_o->owner_dbobj; } +gboolean +nml_dbus_property_o_is_ready_fully (const NMLDBusPropertyO *pr_o) +{ + return !pr_o->owner_dbobj + || !pr_o->obj_watcher + || pr_o->nmobj; +} + static void nml_dbus_property_o_notify_changed (NMLDBusPropertyO *pr_o, NMClient *self) diff --git a/libnm/nm-libnm-utils.h b/libnm/nm-libnm-utils.h index 8ac05d70..9138e08c 100644 --- a/libnm/nm-libnm-utils.h +++ b/libnm/nm-libnm-utils.h @@ -210,6 +210,8 @@ gpointer nml_dbus_property_o_get_obj (NMLDBusPropertyO *pr_o); gboolean nml_dbus_property_o_is_ready (const NMLDBusPropertyO *pr_o); +gboolean nml_dbus_property_o_is_ready_fully (const NMLDBusPropertyO *pr_o); + void nml_dbus_property_o_clear (NMLDBusPropertyO *pr_o, NMClient *client); diff --git a/libnm/nm-property-docs.xml b/libnm/nm-property-docs.xml index cdf60f8c..fe5672a1 100644 --- a/libnm/nm-property-docs.xml +++ b/libnm/nm-property-docs.xml @@ -13,9 +13,9 @@ - + - + @@ -177,10 +177,10 @@ - + - + @@ -201,10 +201,10 @@ - + - + @@ -213,6 +213,7 @@ + diff --git a/libnm/nm-settings-docs.xml b/libnm/nm-settings-docs.xml index 08178df5..68f09cdb 100644 --- a/libnm/nm-settings-docs.xml +++ b/libnm/nm-settings-docs.xml @@ -13,9 +13,9 @@ - + - + @@ -180,10 +180,10 @@ - + - + @@ -206,10 +206,10 @@ - + - + @@ -218,6 +218,7 @@ + diff --git a/libnm/nm-settings-ifcfg-rh-docs.xml b/libnm/nm-settings-ifcfg-rh-docs.xml index 7bed7f4d..9934e4de 100644 --- a/libnm/nm-settings-ifcfg-rh-docs.xml +++ b/libnm/nm-settings-ifcfg-rh-docs.xml @@ -219,6 +219,7 @@ but in route6-* file instead in the form of command line for 'ip route add& + +