#include <gsupplicant/gsupplicant.h>
+#include "src/shared/util.h"
+
#define CLEANUP_TIMEOUT 8 /* in seconds */
#define INACTIVE_TIMEOUT 12 /* in seconds */
#define FAVORITE_MAXIMUM_RETRIES 2
-#define BGSCAN_DEFAULT "simple:30:-45:300"
+#define BGSCAN_DEFAULT "simple:30:-65:300"
#define AUTOSCAN_EXPONENTIAL "exponential:3:300"
#define AUTOSCAN_SINGLE "single:3"
bool allow_full_scan;
unsigned int automaxspeed_timeout;
GSupplicantScanParams *hidden_scan_params;
+ unsigned int mac_policy;
+ unsigned int preassoc_mac_policy;
+ unsigned int mac_lifetime;
#endif
int disconnect_code;
int assoc_code;
return;
}
-#endif
+#else
/*
* On the contrary, if BackgroundScanning is disabled, update autoscan
wifi->autoscan = parse_autoscan_params(AUTOSCAN_SINGLE);
break;
}
+#endif
}
static void finalize_interface_creation(struct wifi_data *wifi)
interface = connman_inet_ifname(index);
ret = g_supplicant_interface_create(interface, driver, NULL,
+#ifdef TIZEN_EXT
+ connman_device_get_mac_policy(device),
+ connman_device_get_preassoc_mac_policy(device),
+ connman_device_get_random_mac_lifetime(device),
+#endif /* TIZEN_EXT */
interface_create_callback,
wifi);
g_free(interface);
g_key_file_free(keyfile);
continue;
}
- g_time_val_from_iso8601(str, &modified);
+ util_iso8601_to_timeval(str, &modified);
g_free(str);
ssid = g_key_file_get_string(keyfile,
g_sequence_free(latest_list);
g_key_file_free(keyfile);
g_free(ssid);
+#if defined TIZEN_EXT
+ g_strfreev(services);
+#endif
return -ENOMEM;
}
return ret;
}
+
+static void wifi_mac_policy_callback(int result,
+ unsigned int policy,
+ void *user_data)
+{
+ struct connman_device *device = user_data;
+
+ if (result == 0)
+ connman_device_mac_policy_notify(device, result, policy);
+
+ connman_device_unref(device);
+}
+
+int wifi_set_mac_policy(struct connman_device *device, unsigned int policy)
+{
+ struct wifi_data *wifi = connman_device_get_data(device);
+ int ret;
+
+ if (!wifi)
+ return -EINVAL;
+
+ connman_device_ref(device);
+
+ ret = g_supplicant_interface_set_mac_policy(wifi->interface,
+ wifi_mac_policy_callback,
+ policy, device);
+ if (ret != 0)
+ connman_device_unref(device);
+
+ return ret;
+}
+
+static void wifi_preassoc_mac_policy_callback(int result,
+ unsigned int policy,
+ void *user_data)
+{
+ struct connman_device *device = user_data;
+
+ if (result == 0)
+ connman_device_preassoc_mac_policy_notify(device, result, policy);
+
+ connman_device_unref(device);
+}
+
+int wifi_set_preassoc_mac_policy(struct connman_device *device, unsigned int policy)
+{
+ struct wifi_data *wifi = connman_device_get_data(device);
+ int ret;
+
+ if (!wifi)
+ return -EINVAL;
+
+ connman_device_ref(device);
+
+ ret = g_supplicant_interface_set_preassoc_mac_policy(wifi->interface,
+ wifi_preassoc_mac_policy_callback,
+ policy, device);
+ if (ret != 0)
+ connman_device_unref(device);
+
+ return ret;
+}
+
+static void wifi_random_mac_lifetime_callback(int result,
+ unsigned int lifetime,
+ void *user_data)
+{
+ struct connman_device *device = user_data;
+
+ if (result == 0)
+ connman_device_random_mac_lifetime_notify(device, result, lifetime);
+
+ connman_device_unref(device);
+}
+
+int wifi_set_random_mac_lifetime(struct connman_device *device, unsigned int lifetime)
+{
+ struct wifi_data *wifi = connman_device_get_data(device);
+ int ret;
+
+ if (!wifi)
+ return -EINVAL;
+
+ connman_device_ref(device);
+
+ ret = g_supplicant_interface_set_random_mac_lifetime(wifi->interface,
+ wifi_random_mac_lifetime_callback,
+ lifetime, device);
+ if (ret != 0)
+ connman_device_unref(device);
+
+ return ret;
+}
#endif
#if defined TIZEN_EXT_WIFI_MESH
.set_regdom = wifi_set_regdom,
#if defined TIZEN_EXT
.specific_scan = wifi_specific_scan,
+ .set_mac_policy = wifi_set_mac_policy,
+ .set_preassoc_mac_policy = wifi_set_preassoc_mac_policy,
+ .set_random_mac_lifetime = wifi_set_random_mac_lifetime,
#endif
#if defined TIZEN_EXT_WIFI_MESH
.abort_scan = mesh_abort_scan,
return;
}
- if (wifi->network != wifi->pending_network)
+ if (wifi->network && wifi->network != wifi->pending_network)
connman_network_set_connected(wifi->network, false);
wifi->network = NULL;
#if defined TIZEN_EXT
if (handle_assoc_status_code(interface, wifi)) {
- GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
const char *group = connman_network_get_group(network);
GSupplicantNetwork *supplicant_network;
+ GSList *bssid_list = NULL;
guint bssid_length = 0;
if (group) {
g_supplicant_network_update_assoc_reject(interface, supplicant_network);
}
+ bssid_list = (GSList *)connman_network_get_bssid_list(network);
if (bssid_list)
bssid_length = g_slist_length(bssid_list);
need_save = connman_device_set_last_connected_ident(wifi->device, service_ident);
if (need_save)
connman_device_save_last_connected(wifi->device);
+
+ g_free(service_ident);
}
connman_network_set_last_connected_bssid(connman_network,
info->wifi->interface = NULL;
g_supplicant_interface_create(info->ifname, driver, info->wifi->bridge,
+#ifdef TIZEN_EXT
+ 0, 0, 60,
+#endif /* TIZEN_EXT */
ap_create_callback,
info);
}