#define SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
#define MAX_SIG_LEN 64
-#define TOTAL_CONN_SIGNALS 6
+#define TOTAL_CONN_SIGNALS 7
#define MAX_SOCKET_OPEN_RETRY 5
typedef enum {
/* If clatd is terminated unexpectedly, reset and enable clat service. */
if (NETCONFIG_CELLULAR_ONLINE == cellular_state_get_service_state())
netconfig_clatd_reset();
+ } else if (g_strcmp0(name, SUPPLICANT_SERVICE) == 0 && *new == '\0') {
+ DBG("Supplicant destroyed: name %s, old %s, new %s", name, old, new);
+ __mark_supplicant_stopped();
}
g_free(name);
g_free(old);
NULL,
NULL);
+ conn_subscription_ids[6] = g_dbus_connection_signal_subscribe(
+ connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_INTERFACE_DBUS,
+ SIGNAL_NAME_OWNER_CHANGED,
+ NULL,
+ SUPPLICANT_SERVICE,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ _dbus_name_changed_cb,
+ NULL,
+ NULL);
+
INFO("Successfully register clat DBus signal filters");
for (sig = SIG_INTERFACE_REMOVED; sig < SIG_MAX; sig++) {
static gboolean wifi_firmware_recovery_mode = FALSE;
static int airplane_mode = 0;
+gboolean is_supplicant_running = FALSE;
static gboolean __is_wifi_restricted(void)
{
g_free(interface_name);
}
+void __mark_supplicant_stopped(void)
+{
+ is_supplicant_running = FALSE;
+}
+
int __execute_supplicant(gboolean enable)
{
/*
char *const args_disable[] = { "/usr/bin/wpa_supp.sh", "stop", NULL };
#endif
char *const envs[] = { NULL };
- static gboolean enabled = FALSE;
- if (enabled == enable)
+ if (is_supplicant_running == enable)
return -EALREADY;
if (enable == TRUE)
DBG("wpa_supplicant %s", enable == TRUE ? "started" : "stopped");
if (enable)
- enabled = enable;
+ is_supplicant_running = enable;
return 0;
}