diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index 7ddffb0493..282b7ae691 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -80,6 +80,7 @@ handle_action (NMDBusDispatcher *dbus_dispatcher, GVariant *device_ip6_props, GVariant *device_dhcp4_props, GVariant *device_dhcp6_props, + const char *connectivity_state, const char *vpn_ip_iface, GVariant *vpn_ip4_props, GVariant *vpn_ip6_props, @@ -668,6 +669,7 @@ handle_action (NMDBusDispatcher *dbus_dispatcher, GVariant *device_ip6_props, GVariant *device_dhcp4_props, GVariant *device_dhcp6_props, + const char *connectivity_state, const char *vpn_ip_iface, GVariant *vpn_ip4_props, GVariant *vpn_ip6_props, diff --git a/callouts/nm-dispatcher.xml b/callouts/nm-dispatcher.xml index 27f15fe5b9..6268f970b5 100644 --- a/callouts/nm-dispatcher.xml +++ b/callouts/nm-dispatcher.xml @@ -13,6 +13,7 @@ @device_ip6_config: Properties of the device's IPv6 configuration. @device_dhcp4_config: Properties of the device's DHCPv4 configuration. @device_dhcp6_config: Properties of the device's DHCPv6 configuration. + @connectivity_state: Current connectivity state: unknown, none, limited, portal or full. @vpn_ip_iface: VPN interface name. @vpn_ip4_config: Properties of the VPN's IPv4 configuration. @vpn_ip6_config: Properties of the VPN's IPv6 configuration. @@ -30,6 +31,7 @@ + diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index 2b8b170a51..7cf3e70797 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -99,7 +99,7 @@ update_state (NMConnectivity *self, NMConnectivityState state) g_object_notify (G_OBJECT (self), NM_CONNECTIVITY_STATE); /* Notify dispatcher scripts of a connectivity state change */ - nm_dispatcher_call_connectivity (DISPATCHER_ACTION_CONNECTIVITY_CHANGE); + nm_dispatcher_call_connectivity (DISPATCHER_ACTION_CONNECTIVITY_CHANGE, state); } } diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index c8193c33ff..df9be2e711 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -28,11 +28,13 @@ #include "nm-dispatcher-api.h" #include "NetworkManagerUtils.h" #include "nm-utils.h" +#include "nm-connectivity.h" #include "nm-device.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" +#include "nm-manager.h" #include "nm-settings-connection.h" #include "nm-platform.h" #include "nm-core-internal.h" @@ -450,6 +452,7 @@ _dispatcher_call (DispatcherAction action, NMSettingsConnection *settings_connection, NMConnection *applied_connection, NMDevice *device, + NMConnectivityState connectivity_state, const char *vpn_iface, NMIP4Config *vpn_ip4_config, NMIP6Config *vpn_ip6_config, @@ -581,7 +584,7 @@ _dispatcher_call (DispatcherAction action, GVariantIter *results; ret = _nm_dbus_proxy_call_sync (dispatcher_proxy, "Action", - g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}sa{sv}a{sv}b)", + g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}ssa{sv}a{sv}b)", action_to_string (action), connection_dict, &connection_props, @@ -590,6 +593,7 @@ _dispatcher_call (DispatcherAction action, &device_ip6_props, device_dhcp4_props, device_dhcp6_props, + nm_connectivity_state_to_string (connectivity_state), vpn_iface ? vpn_iface : "", &vpn_ip4_props, &vpn_ip6_props, @@ -616,7 +620,7 @@ _dispatcher_call (DispatcherAction action, info->callback = callback; info->user_data = user_data; g_dbus_proxy_call (dispatcher_proxy, "Action", - g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}sa{sv}a{sv}b)", + g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}ssa{sv}a{sv}b)", action_to_string (action), connection_dict, &connection_props, @@ -625,6 +629,7 @@ _dispatcher_call (DispatcherAction action, &device_ip6_props, device_dhcp4_props, device_dhcp6_props, + nm_connectivity_state_to_string (connectivity_state), vpn_iface ? vpn_iface : "", &vpn_ip4_props, &vpn_ip6_props, @@ -674,8 +679,9 @@ nm_dispatcher_call (DispatcherAction action, gpointer user_data, guint *out_call_id) { - return _dispatcher_call (action, FALSE, settings_connection, applied_connection, device, NULL, NULL, - NULL, callback, user_data, out_call_id); + return _dispatcher_call (action, FALSE, settings_connection, applied_connection, device, + NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, + callback, user_data, out_call_id); } /** @@ -696,8 +702,8 @@ nm_dispatcher_call_sync (DispatcherAction action, NMConnection *applied_connection, NMDevice *device) { - return _dispatcher_call (action, TRUE, settings_connection, applied_connection, device, NULL, NULL, - NULL, NULL, NULL, NULL); + return _dispatcher_call (action, TRUE, settings_connection, applied_connection, device, + NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, NULL, NULL, NULL); } /** @@ -731,8 +737,9 @@ nm_dispatcher_call_vpn (DispatcherAction action, gpointer user_data, guint *out_call_id) { - return _dispatcher_call (action, FALSE, settings_connection, applied_connection, parent_device, vpn_iface, - vpn_ip4_config, vpn_ip6_config, callback, user_data, out_call_id); + return _dispatcher_call (action, FALSE, settings_connection, applied_connection, + parent_device, NM_CONNECTIVITY_UNKNOWN, vpn_iface, vpn_ip4_config, + vpn_ip6_config, callback, user_data, out_call_id); } /** @@ -759,22 +766,25 @@ nm_dispatcher_call_vpn_sync (DispatcherAction action, NMIP4Config *vpn_ip4_config, NMIP6Config *vpn_ip6_config) { - return _dispatcher_call (action, TRUE, settings_connection, applied_connection, parent_device, vpn_iface, + return _dispatcher_call (action, TRUE, settings_connection, applied_connection, + parent_device, NM_CONNECTIVITY_UNKNOWN, vpn_iface, vpn_ip4_config, vpn_ip6_config, NULL, NULL, NULL); } /** * nm_dispatcher_call_connectivity(): * @action: the %DispatcherAction + * @connectivity_state: the #NMConnectivityState value * * This method does not block the caller. * * Returns: %TRUE if the action was dispatched, %FALSE on failure */ gboolean -nm_dispatcher_call_connectivity (DispatcherAction action) +nm_dispatcher_call_connectivity (DispatcherAction action, + NMConnectivityState connectivity_state) { - return _dispatcher_call (action, FALSE, NULL, NULL, NULL, + return _dispatcher_call (action, FALSE, NULL, NULL, NULL, connectivity_state, NULL, NULL, NULL, NULL, NULL, NULL); } diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h index 72c7e6e815..47cb64816b 100644 --- a/src/nm-dispatcher.h +++ b/src/nm-dispatcher.h @@ -76,7 +76,8 @@ gboolean nm_dispatcher_call_vpn_sync (DispatcherAction action, NMIP4Config *vpn_ip4_config, NMIP6Config *vpn_ip6_config); -gboolean nm_dispatcher_call_connectivity (DispatcherAction action); +gboolean nm_dispatcher_call_connectivity (DispatcherAction action, + NMConnectivityState state); void nm_dispatcher_call_cancel (guint call_id);