#include "network-state.h"
#include "cellular-state.h"
#include "signal-handler.h"
-#include "wifi-ssid-scan.h"
#include "wifi-background-scan.h"
#include "wifi-tdls.h"
+#include "ip-conflict-detect.h"
+#if defined TIZEN_DEBUG_ENABLE
+#include "network-dump.h"
+#endif
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
#define MAX_SIG_LEN 64
#define TOTAL_CONN_SIGNALS 5
+#define MAX_SOCKET_OPEN_RETRY 5
typedef enum {
SIG_INTERFACE_REMOVED = 0,
};
static int supp_subscription_ids[SIG_MAX] = {0};
+#if defined TIZEN_DEBUG_ENABLE
+static int dumpservice_subscription_id = 0;
+#endif
typedef void (*supplicant_signal_cb)(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data);
-static void __netconfig_extract_ipv4_signal_data(GVariant *dictionary, const gchar *profile)
+static void __netconfig_extract_ipv4_signal_data(GVariant *dictionary,
+ const gchar *profile)
{
gchar *key = NULL;
const gchar *value = NULL;
GVariant *var = NULL;
GVariantIter iter;
+ GVariantBuilder *builder;
+ GVariant *params;
g_variant_iter_init(&iter, dictionary);
while (g_variant_iter_loop(&iter, "{sv}", &key, &var)) {
g_variant_get(var, "&s", &value);
char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP);
- DBG("Old IPv4.Address [%s] Received new IPv4.Address [%s]", old_ip, value);
+ DBG("Old IPv4.Address [%s] Received new IPv4.Address [%s]", old_ip,
+ value);
if (g_strcmp0(old_ip, value) != 0) {
- if (value != NULL)
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
+ if (value != NULL) {
vconf_set_str(VCONFKEY_NETWORK_IP, value);
- else if (old_ip != NULL && strlen(old_ip) > 0)
+ g_variant_builder_add(builder, "{sv}", "IPv4Address",
+ g_variant_new_string(value));
+ } else if (old_ip != NULL && strlen(old_ip) > 0) {
vconf_set_str(VCONFKEY_NETWORK_IP, "");
+ g_variant_builder_add(builder, "{sv}", "IPv4Address",
+ g_variant_new_string(""));
+ }
+
+ params = g_variant_new("(@a{sv})",
+ g_variant_builder_end(builder));
+
+ netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
+ params);
}
free(old_ip);
}
}
}
-static void __netconfig_extract_ipv6_signal_data(GVariant *dictionary, const gchar *profile)
+static void __netconfig_extract_ipv6_signal_data(GVariant *dictionary,
+ const gchar *profile)
{
gchar *key = NULL;
const gchar *value = NULL;
GVariant *var = NULL;
GVariantIter iter;
+ GVariantBuilder *builder;
+ GVariant *params;
g_variant_iter_init(&iter, dictionary);
while (g_variant_iter_loop(&iter, "{sv}", &key, &var)) {
g_variant_get(var, "&s", &value);
char *old_ip6 = vconf_get_str(VCONFKEY_NETWORK_IP6);
- DBG("Old IPv6.Address [%s] Received new IPv6.Address [%s]", old_ip6, value);
+ DBG("Old IPv6.Address [%s] Received new IPv6.Address [%s]", old_ip6,
+ value);
if (g_strcmp0(old_ip6, value) != 0) {
- if (value != NULL)
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
+ if (value != NULL) {
vconf_set_str(VCONFKEY_NETWORK_IP6, value);
- else if (old_ip6 != NULL && strlen(old_ip6) > 0)
+ g_variant_builder_add(builder, "{sv}", "IPv6Address",
+ g_variant_new_string(value));
+ } else if (old_ip6 != NULL && strlen(old_ip6) > 0) {
vconf_set_str(VCONFKEY_NETWORK_IP6, "");
+ g_variant_builder_add(builder, "{sv}", "IPv6Address",
+ g_variant_new_string(""));
+ }
+
+ params = g_variant_new("(@a{sv})",
+ g_variant_builder_end(builder));
+
+ netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
+ params);
}
free(old_ip6);
}
static void _service_signal_cb(GDBusConnection *conn,
const gchar *name, const gchar *path,
- const gchar *interface, const gchar *sig, GVariant *param, gpointer user_data)
+ const gchar *interface, const gchar *sig,
+ GVariant *param, gpointer user_data)
{
gchar *sigvalue = NULL;
gchar *property;
GVariant *variant = NULL, *var;
GVariantIter *iter;
const gchar *value = NULL;
+ struct sock_data *sd = NULL;
+ int idx = 0;
if (path == NULL || param == NULL)
goto done;
if (g_strcmp0(sigvalue, "State") == 0) {
g_variant_get(variant, "s", &property);
- DBG("[%s] %s", property, path);
+ DBG("[%s] %s", property, path);
+ if (netconfig_is_wifi_profile(path) || netconfig_is_ethernet_profile(path)) {
+ if (g_strcmp0(property, "ready") == 0) {
+ for (idx = 0; idx < MAX_SOCKET_OPEN_RETRY; idx++) {
+ sd = start_ip_conflict_mon();
+ if (sd != NULL)
+ break;
+ }
+ } else if (g_strcmp0(property, "online") == 0) {
+ // do nothing
+ } else {
+ stop_ip_conflict_mon();
+ }
+ }
+
if (netconfig_is_wifi_profile(path) == TRUE) {
int wifi_state = 0;
g_variant_get(variant, "a{sv}", &iter);
while (g_variant_iter_loop(iter, "{sv}", &property, &var)) {
+ GVariantBuilder *builder;
+ GVariant *sig_params;
if (g_strcmp0(property, "Servers") == 0) {
GVariantIter *iter_sub = NULL;
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
g_variant_get(var, "as", &iter_sub);
g_variant_iter_loop(iter_sub, "s", &value);
g_variant_iter_free(iter_sub);
DBG("Proxy - [%s]", value);
vconf_set_str(VCONFKEY_NETWORK_PROXY, value);
+ g_variant_builder_add(builder, "{sv}", "ProxyAddress",
+ g_variant_new_string(value));
+
+ sig_params = g_variant_new("(@a{sv})",
+ g_variant_builder_end(builder));
+
+ netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
+ sig_params);
+
g_free(property);
g_variant_unref(var);
break;
value = g_variant_get_string(var, NULL);
DBG("Method - [%s]", value);
- if (g_strcmp0(value, "direct") == 0)
+ if (g_strcmp0(value, "direct") == 0) {
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
vconf_set_str(VCONFKEY_NETWORK_PROXY, "");
+ g_variant_builder_add(builder, "{sv}", "ProxyAddress",
+ g_variant_new_string(""));
+
+ sig_params = g_variant_new("(@a{sv})",
+ g_variant_builder_end(builder));
+
+ netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE,
+ "NetworkConfigChanged", sig_params);
+ }
g_free(property);
g_variant_unref(var);
is_cell_internet_prof = netconfig_is_cellular_internet_profile(
service_path);
if (service_path != NULL) {
- while (g_variant_iter_loop(next, "{sv}", &property,
+ while (next && g_variant_iter_loop(next, "{sv}", &property,
&variant)) {
if (g_strcmp0(property, "State") == 0) {
g_variant_get(variant, "s", &value);
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
{
- gchar *key;
- GVariantIter *iter;
- GVariant *variant;
+ DBG("Properties changed handling!");
+ gchar *key = NULL;
+ const gchar *state = NULL;
+ GVariantIter *iter = NULL;
+ GVariant *variant = NULL;
gboolean scanning = FALSE;
if (param == NULL)
g_variant_unref(variant);
g_free(key);
+ variant = NULL;
+ key = NULL;
+ break;
+ } else if (g_strcmp0(key, "State") == 0) {
+ state = g_variant_get_string(variant, NULL);
+ if (state != NULL)
+ ERR("Supplicant state : %s", state);
+
+ g_variant_unref(variant);
+ g_free(key);
+ variant = NULL;
+ key = NULL;
+ break;
+ } else if (g_strcmp0(key, "DisconnectReason") == 0) {
+ int reason = g_variant_get_int32(variant);
+ ERR("Supplicant DisconnReason : %d", reason);
+
+ g_variant_unref(variant);
+ g_free(key);
+ variant = NULL;
+ key = NULL;
break;
+ } else {
+ gchar *value;
+ value = g_variant_print(variant, TRUE);
+ DBG("Supplicant %s : %s", key, value);
+
+ g_free(value);
}
}
const gchar *sig, GVariant *param, gpointer user_data)
{
DBG("BSS added handling!");
- if (wifi_ssid_scan_get_state() == TRUE)
- wifi_ssid_scan_add_bss(param);
- else
- wifi_state_set_bss_found(TRUE);
+ wifi_state_set_bss_found(TRUE);
return;
}
return;
}
- if (netconfig_wifi_get_bgscan_state() != TRUE) {
- if (wifi_ssid_scan_get_state() == TRUE)
- wifi_ssid_scan_emit_scan_completed();
- else
- wifi_ssid_scan(NULL);
- } else {
+ if (netconfig_wifi_get_bgscan_state() == TRUE) {
if (wifi_state_get_technology_state() >=
NETCONFIG_WIFI_TECH_POWERED)
netconfig_wifi_bgscan_start(FALSE);
DBG("Driver Hanged handling!");
ERR("Critical. Wi-Fi firmware crashed");
+#if !defined TIZEN_WEARABLE
+ netconfig_send_message_to_net_popup("Wi-Fi Error",
+ "Wi-Fi Driver Hanged. Please get log dump and report", "popup", NULL);
+#endif
wifi_power_recover_firmware();
return;
+
}
static void _supplicant_session_overlapped(GDBusConnection *conn,
#endif
}
+#if defined TIZEN_DEBUG_ENABLE
+static void __netconfig_dumpservice_handler(GDBusConnection *conn,
+ const gchar *name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ int mode;
+ gchar *signal_path = NULL;
+
+ if (param == NULL)
+ return;
+
+ g_variant_get(param, "(is)", &mode, &signal_path);
+ DBG("Path: %s and mode: %d", signal_path, mode);
+
+ netconfig_dump_log(signal_path);
+ if (signal_path)
+ g_free(signal_path);
+
+ return;
+}
+#endif
+
static void _supplicant_tdls_connected(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
static void _supplicant_wifi_wps_credentials(GVariant *param)
{
gchar *key;
- char ssid[32];
- char wps_key[100];
+ char ssid[32] = {0, };
+ char wps_key[100] = {0, };
GVariantIter *iter;
GVariant *variant;
int config_error = 0;
INFO("Successfully register Supplicant DBus signal filters");
+#if defined TIZEN_DEBUG_ENABLE
+ dumpservice_subscription_id = g_dbus_connection_signal_subscribe(
+ connection,
+ NULL,
+ DUMP_SERVICE_INTERFACE,
+ DUMP_SIGNAL,
+ NULL,
+ NULL,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ __netconfig_dumpservice_handler,
+ NULL,
+ NULL);
+
+ INFO("Successfully registered Dumpservice DBus signal filter");
+#endif
+
/* In case ConnMan precedes this signal register,
* net-config should update the default connected profile.
*/
}
}
+#if defined TIZEN_DEBUG_ENABLE
+ g_dbus_connection_signal_unsubscribe(connection,
+ dumpservice_subscription_id);
+#endif
}