#include "signal-handler.h"
#include "wifi-background-scan.h"
#include "wifi-tdls.h"
+#include "wifi-dpp.h"
#include "ip-conflict-detect.h"
#include "wifi-key-encryption.h"
+#include "clatd-handler.h"
#if defined TIZEN_DEBUG_ENABLE
#include "network-dump.h"
#define NETWORK_LOG_DUMP_SCRIPT "/opt/var/lib/net-config/network_log_dump.sh"
#define SIGNAL_TDLS_DISCONNECTED "TDLSDisconnected"
#define SIGNAL_TDLS_PEER_FOUND "TDLSPeerFound"
+#define SIGNAL_DPP_AUTH_SUCCESS "DPPAuthSuccess"
+#define SIGNAL_DPP_AUTH_FAILED "DPPAuthFailed"
+#define SIGNAL_DPP_NOT_COMPATIBLE "DPPNotCompatible"
+#define SIGNAL_DPP_CONF_FAILED "DPPConfFailed"
+#define SIGNAL_DPP_SCAN_PEER_QR "DPPScanPeerQrCode"
+#define SIGNAL_DPP_NETWORK_ID "DPPNetworkID"
+#define SIGNAL_DPP_CONF_SENT "DPPConfSent"
+#define SIGNAL_DPP_CONF_RECEIVED "DPPConfReceived"
+#define SIGNAL_DPP_CONF_OBJ "DPPConfObj"
+
#define SIGNAL_WPS_CONNECTED "WPSConnected"
#define SIGNAL_WPS_EVENT "Event"
#define SIGNAL_WPS_CREDENTIALS "Credentials"
#define CONNMAN_SIGNAL_SERVICES_CHANGED "ServicesChanged"
#define CONNMAN_SIGNAL_PROPERTY_CHANGED "PropertyChanged"
-#define CONNMAN_SIGNAL_NAME_CHANGED "NameOwnerChanged"
+#define SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
#define MAX_SIG_LEN 64
-#define TOTAL_CONN_SIGNALS 5
+#define TOTAL_CONN_SIGNALS 6
#define MAX_SOCKET_OPEN_RETRY 5
typedef enum {
SIG_TDLS_CONNECTED,
SIG_TDLS_DISCONNECTED,
SIG_TDLS_PEER_FOUND,
+ SIG_DPP_AUTH_SUCCESS,
+ SIG_DPP_AUTH_FAILED,
+ SIG_DPP_NOT_COMPATIBLE,
+ SIG_DPP_CONF_FAILED,
+ SIG_DPP_SCAN_PEER_QR,
+ SIG_DPP_NETWORK_ID,
+ SIG_DPP_CONF_SENT,
+ SIG_DPP_CONF_RECEIVED,
+ SIG_DPP_CONF_OBJ,
SIG_MAX
} SuppSigArrayIndex;
SIGNAL_TDLS_CONNECTED,
SIGNAL_TDLS_DISCONNECTED,
SIGNAL_TDLS_PEER_FOUND,
+ SIGNAL_DPP_AUTH_SUCCESS,
+ SIGNAL_DPP_AUTH_FAILED,
+ SIGNAL_DPP_NOT_COMPATIBLE,
+ SIGNAL_DPP_CONF_FAILED,
+ SIGNAL_DPP_SCAN_PEER_QR,
+ SIGNAL_DPP_NETWORK_ID,
+ SIGNAL_DPP_CONF_SENT,
+ SIGNAL_DPP_CONF_RECEIVED,
+ SIGNAL_DPP_CONF_OBJ,
+};
+static const char *supplicant_iface_for_sig[SIG_MAX] = {
+ SUPPLICANT_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_INTERFACE,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
+ SUPPLICANT_IFACE_DPP,
};
static int supp_subscription_ids[SIG_MAX] = {0};
errno = 0;
if (execve(file_path, args, envs) == -1) {
- strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
- DBG("Fail to execute command (%s)", error_buf);
+ DBG("Fail to execute command (%s)",
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
exit(1);
}
} else if (pid > 0) {
return rv;
}
- strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
- DBG("failed to fork(%s)", error_buf);
+ DBG("failed to fork(%s)",
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
return -EIO;
}
GVariantIter *iter;
const gchar *value = NULL;
struct sock_data *sd = NULL;
+ gchar *pf = NULL;
int idx = 0;
if (path == NULL || param == NULL)
if (netconfig_is_cellular_internet_profile(path))
netconfig_update_default_profile(path);
}
+ } else {
+ pf = netconfig_get_connected_cellular_internet_ipv6only_profile(NULL);
+ if (pf)
+ {
+ g_free(pf);
+
+ /* Enable clatd if it is not in running state */
+ DBG("Connected to ipv6 only cellular, enable clatd");
+ netconfig_clatd_enable();
+ }
}
if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path))
goto done;
}
- if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path))
+ if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path)) {
cellular_state_set_service_state(NETCONFIG_CELLULAR_IDLE);
+ /* Disable clatd if it is in running state */
+ DBG("disable clatd");
+ netconfig_clatd_disable();
+ }
+
if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
g_free(property);
goto done;
DBG("ConnMan destroyed: name %s, old %s, new %s", name, old, new);
connman_register_agent();
+ } else if (g_strcmp0(name, CLATD_SERVICE) == 0 && *new == '\0') {
+ DBG("Clat destroyed: name %s, old %s, new %s", name, old, new);
+
+ /* If clatd is terminated unexpectedly, reset and enable clat service. */
+ if (NETCONFIG_CELLULAR_ONLINE == cellular_state_get_service_state())
+ netconfig_clatd_reset();
}
g_free(name);
g_free(old);
return;
}
+static void _supplicant_dpp_auth_success(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Auth Success Signal");
+ netconfig_wifi_dpp_auth_success_event(param);
+ return;
+}
+
+static void _supplicant_dpp_auth_failed(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Auth Failed Signal");
+ netconfig_wifi_dpp_auth_failed_event(param);
+ return;
+}
+
+static void _supplicant_dpp_not_compatible(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Not Compatible Signal");
+ netconfig_wifi_dpp_not_compatible_event(param);
+ return;
+}
+
+static void _supplicant_dpp_conf_failed(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Conf Failed Signal");
+ netconfig_wifi_dpp_conf_failed_event(param);
+ return;
+}
+
+static void _supplicant_dpp_scan_peer_qr(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Scan Peer QR Signal");
+ netconfig_wifi_dpp_scan_peer_qr_event(param);
+ return;
+}
+
+static void _supplicant_dpp_network_id(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Network Id Signal");
+ netconfig_wifi_dpp_network_id_event(param);
+ return;
+}
+
+static void _supplicant_dpp_conf_sent(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Conf Sent Signal");
+ netconfig_wifi_dpp_conf_sent_event(param);
+ return;
+}
+
+static void _supplicant_dpp_conf_received(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Conf Received Signal");
+ netconfig_wifi_dpp_conf_received_event(param);
+ return;
+}
+
+static void _supplicant_dpp_conf_obj(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ DBG("Received DPP Conf Obj Signal");
+ netconfig_wifi_dpp_conf_obj_event(param);
+ return;
+}
+
static void _supplicant_wifi_wps_connected(GVariant *param)
{
gchar *key;
if (g_strcmp0(key, "SSID") == 0) {
const char *t_key = NULL;
t_key = g_variant_get_fixed_array(variant, &ssid_len, sizeof(guchar));
- INFO("wps ssid_len is %d ", ssid_len);
+ INFO("wps ssid_len is %zd ", ssid_len);
if (t_key == NULL) {
g_free(key);
g_variant_unref(variant);
const char *t_key = NULL;
key_len = g_variant_get_size(variant);
- INFO("wps password len %d ", key_len);
+ INFO("wps password len %zd ", key_len);
if (key_len > 0) {
t_key = g_variant_get_fixed_array(variant, &key_len,
sizeof(guchar));
const char *t_key = NULL;
t_key = g_variant_get_fixed_array(variant, &ssid_len,
sizeof(guchar));
- INFO("wps ssid_len is %d ", ssid_len);
+ INFO("wps ssid_len is %zd ", ssid_len);
if (!t_key) {
g_free(key);
g_variant_unref(variant);
_supplicant_session_overlapped,
_supplicant_tdls_connected,
_supplicant_tdls_disconnected,
- _supplicant_tdls_peer_found
+ _supplicant_tdls_peer_found,
+ _supplicant_dpp_auth_success,
+ _supplicant_dpp_auth_failed,
+ _supplicant_dpp_not_compatible,
+ _supplicant_dpp_conf_failed,
+ _supplicant_dpp_scan_peer_qr,
+ _supplicant_dpp_network_id,
+ _supplicant_dpp_conf_sent,
+ _supplicant_dpp_conf_received,
+ _supplicant_dpp_conf_obj,
};
void register_gdbus_signal(void)
{
GDBusConnection *connection = NULL;
- const char *interface = NULL;
SuppSigArrayIndex sig;
connection = netdbus_get_connection();
connection,
DBUS_SERVICE_DBUS,
DBUS_INTERFACE_DBUS,
- CONNMAN_SIGNAL_NAME_CHANGED,
+ SIGNAL_NAME_OWNER_CHANGED,
NULL,
CONNMAN_SERVICE,
G_DBUS_SIGNAL_FLAGS_NONE,
INFO("Successfully register Supplicant WPS DBus signal filters");
- for (sig = SIG_INTERFACE_REMOVED; sig < SIG_MAX; sig++) {
- /*
- * For SIG_INTERFACE_REMOVED INTERFACE_ADDED
- */
- interface = (sig == SIG_INTERFACE_REMOVED) ?
- SUPPLICANT_INTERFACE : SUPPLICANT_IFACE_INTERFACE;
+ conn_subscription_ids[5] = g_dbus_connection_signal_subscribe(
+ connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_INTERFACE_DBUS,
+ SIGNAL_NAME_OWNER_CHANGED,
+ NULL,
+ CLATD_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++) {
supp_subscription_ids[sig] = g_dbus_connection_signal_subscribe(
connection,
SUPPLICANT_SERVICE,
- interface,
+ supplicant_iface_for_sig[sig],
supplicant_signals[sig],
NULL,
NULL,