#include "dbus.h"
#include "gsupplicant.h"
+#if defined TIZEN_EXT
+#include "setting.h"
+#endif
+
#define IEEE80211_CAP_ESS 0x0001
#define IEEE80211_CAP_IBSS 0x0002
#define IEEE80211_CAP_PRIVACY 0x0010
dbus_bool_t sae;
dbus_bool_t owe;
dbus_bool_t dpp;
+ dbus_bool_t owe_transition_mode;
+ unsigned int transition_mode_ssid_len;
+ unsigned char transition_mode_bssid[6];
+ unsigned char transition_mode_ssid[32];
#endif
};
GSList *vsie_list;
unsigned char country_code[COUNTRY_CODE_LENGTH];
GSupplicantPhy_mode phy_mode;
-#endif
-#if defined TIZEN_EXT
+ dbus_bool_t owe_transition_mode;
+ unsigned int transition_mode_ssid_len;
+ unsigned char transition_mode_bssid[6];
+ unsigned char transition_mode_ssid[32];
unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX];
GHashTable *assoc_reject_table;
#endif
};
static unsigned int last_connected_bss_timeout = 0;
+static bool simplified_log = true;
#endif
static int network_remove(struct interface_data *data);
unsigned int val)
{
int i;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
for (i = 0; map[i].str; i++) {
if (val & map[i].val)
SUPPLICANT_DBG("%s: %s", label, map[i].str);
key, dbus_message_iter_get_arg_type(iter));
}
+static void set_bss_expiration_age(DBusMessageIter *iter, void *user_data)
+{
+ unsigned int bss_expiration_age = GPOINTER_TO_UINT(user_data);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
+ &bss_expiration_age);
+}
+
+int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface *interface,
+ unsigned int bss_expiration_age)
+{
+ return supplicant_dbus_property_set(interface->path,
+ SUPPLICANT_INTERFACE ".Interface",
+ "BSSExpireAge", DBUS_TYPE_UINT32_AS_STRING,
+ set_bss_expiration_age, NULL,
+ GUINT_TO_POINTER(bss_expiration_age), NULL);
+}
+
struct set_apscan_data
{
unsigned int ap_scan;
return (const unsigned char *)network->best_bss->bssid;
}
+dbus_bool_t g_supplicant_network_get_transition_mode(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return FALSE;
+
+ return network->owe_transition_mode;
+}
+
+
+const unsigned char *g_supplicant_network_get_transition_mode_bssid(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return NULL;
+
+ return (const unsigned char *)network->transition_mode_bssid;
+}
+
+const void *g_supplicant_network_get_transition_mode_ssid(GSupplicantNetwork *network,
+ unsigned int *transition_mode_ssid_len)
+{
+ if (!network) {
+ *transition_mode_ssid_len = 0;
+ return NULL;
+ }
+
+ *transition_mode_ssid_len = network->transition_mode_ssid_len;
+ return network->transition_mode_ssid;
+}
unsigned int g_supplicant_network_get_maxrate(GSupplicantNetwork *network)
{
return g_string_free(str, FALSE);
}
+#if defined TIZEN_EXT
+static void update_network_with_best_bss(GSupplicantNetwork *network,
+ struct g_supplicant_bss *best_bss)
+{
+ network->signal = best_bss->signal;
+ network->frequency = best_bss->frequency;
+ network->best_bss = best_bss;
+}
static bool update_best_bss(GSupplicantNetwork *network,
struct g_supplicant_bss *bss, struct g_supplicant_bss *best_bss)
int score_new;
int score_best;
+ if (network->best_bss == NULL) {
+ update_network_with_best_bss(network, bss);
+ return true;
+ }
+
score_new = calculate_score(
compare_bssid(bss->bssid, network->last_connected_bssid),
get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
bss->frequency, bss->signal);
+
score_best = calculate_score(
compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
MAC2STR(bss->bssid), score_new,
MAC2STR(network->best_bss->bssid), score_best);
- network->signal = bss->signal;
- network->frequency = bss->frequency;
- network->best_bss = bss;
+ update_network_with_best_bss(network, bss);
SUPPLICANT_DBG("Update best BSS for %s", network->name);
return false;
}
-
+#endif
static int add_or_replace_bss_to_network(struct g_supplicant_bss *bss)
{
GSupplicantInterface *interface = bss->interface;
}
#if defined TIZEN_EXT
+ network->owe_transition_mode = bss->owe_transition_mode;
+ memcpy(network->transition_mode_ssid, bss->transition_mode_ssid, bss->transition_mode_ssid_len);
+ memcpy(network->transition_mode_bssid, bss->transition_mode_bssid, WIFI_BSSID_LEN_MAX);
+
network->keymgmt = bss->keymgmt;
if (g_slist_length(bss->vsie_list) > 0) {
unsigned int value;
int ie_len;
#if defined TIZEN_EXT
+ const unsigned char OWE_WFA_OUI[] = { 0x50, 0x6f, 0x9a, 0x1c };
int r_len, j;
unsigned char *rates = NULL;
unsigned char *ext_rates = NULL;
#if defined TIZEN_EXT
unsigned char *vsie;
int vsie_len = 0;
+
+ if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, OWE_WFA_OUI, sizeof(OWE_WFA_OUI)) == 0) {
+ SUPPLICANT_DBG("IE: match vendor specific data : OWE Transition Mode");
+
+/*
+ Tag: Vendor Specific: Wi-Fi Alliance: OWE Transition Mode
+ Tag Number: Vendor Specific (221) -> ie[0]
+ Tag length: 26 -> ie[1]
+ OUI: 50:6f:9a (Wi-Fi Alliance) -> ie[2]
+ Vendor Specific OUI Type: 28 -> ie[5]
+ BSSID: 92:fd:f0:20:2b:09 -> ie[6]
+ SSID length: 15 -> ie[12]
+ SSID: Wi-Fi-5.2.3-owe -> ie[13]
+
+0000 dd 1a 50 6f 9a 1c 92 fd f0 20 2b 09 0f 57 69 2d ..Po..... +..Wi-
+0010 46 69 2d 35 2e 32 2e 33 2d 6f 77 65 Fi-5.2.3-owe
+
+*/
+ bss->owe_transition_mode = TRUE;
+ if (ie[1] >= 11) { // Tag length is at least up to ssid length position.
+ memcpy(bss->transition_mode_bssid, ie+6, WIFI_BSSID_LEN_MAX);
+ if (ie[12] > 0 && ie[12] < 32) {
+ memcpy(bss->transition_mode_ssid, ie+13, ie[12]);
+ bss->transition_mode_ssid_len = ie[12];
+ } else
+ bss->transition_mode_ssid_len = 0;
+ } else
+ bss->owe_transition_mode = FALSE;
+ continue;
+ }
+
if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) {
- SUPPLICANT_DBG("IE: match vendor specific data");
+
+ if (!simplified_log)
+ SUPPLICANT_DBG("IE: match vendor specific data");
vsie_len = ie[1]+2; // tag number size(1), tag length size(1)
vsie = (unsigned char *)g_try_malloc0(vsie_len);
bss->security = G_SUPPLICANT_SECURITY_IEEE8021X;
else if (bss->sae)
bss->security = G_SUPPLICANT_SECURITY_SAE;
- else if (bss->owe)
+ else if (bss->owe || bss->owe_transition_mode)
bss->security = G_SUPPLICANT_SECURITY_OWE;
else if (bss->dpp)
bss->security = G_SUPPLICANT_SECURITY_DPP;
if (!bss->interface)
return;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("key %s", key);
if (!key)
GSupplicantNetwork *network;
struct g_supplicant_bss *bss;
const char *path = NULL;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
dbus_message_iter_get_basic(iter, &path);
if (g_strcmp0(path, "/") == 0)
return NULL;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("%s", path);
network = g_hash_table_lookup(interface->bss_mapping, path);
void *user_data)
{
struct g_supplicant_bss *bss;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
bss = interface_bss_added(iter, user_data);
void *user_data)
{
struct g_supplicant_bss *bss;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
bss = interface_bss_added(iter, user_data);
if (!interface)
return;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("key: %s", key);
if (g_strcmp0(key, "ConfigMethods") == 0) {
if (!interface)
return;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("%s", key);
if (!key) {
static void signal_interface_changed(const char *path, DBusMessageIter *iter)
{
GSupplicantInterface *interface;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
interface = g_hash_table_lookup(interface_table, path);
static void signal_bss_added(const char *path, DBusMessageIter *iter)
{
GSupplicantInterface *interface;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
interface = g_hash_table_lookup(interface_table, path);
unsigned int old_wps_capabilities;
struct g_supplicant_bss *bss;
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
interface = g_hash_table_lookup(bss_mapping, path);
supplicant_dbus_dict_close(iter, &dict);
}
+#if defined TIZEN_EXT
+static void interface_get_state(const char *key, DBusMessageIter *iter,
+ void *user_data)
+{
+ struct interface_create_data *data = user_data;
+ GSupplicantInterface *interface = NULL;
+ const char *str = NULL;
+
+ SUPPLICANT_DBG("key[%s]", key);
+
+ if (!data) {
+ SUPPLICANT_DBG("data is NULL");
+ return;
+ }
+
+ interface = data->interface;
+ if (!interface) {
+ SUPPLICANT_DBG("interface is NULL");
+ return;
+ }
+
+ if (iter)
+ dbus_message_iter_get_basic(iter, &str);
+
+ if (str) {
+ if (string2state(str) != interface->state)
+ interface->state = string2state(str);
+ }
+
+ if (interface->state == G_SUPPLICANT_STATE_DISABLED)
+ interface->ready = FALSE;
+ else
+ interface->ready = TRUE;
+
+ SUPPLICANT_DBG("state %s (%d)", str, interface->state);
+
+ if (data->callback) {
+ data->callback(0, interface, data->user_data);
+#if defined TIZEN_EXT_WIFI_MESH
+ callback_mesh_support(interface);
+#endif
+ }
+
+ interface_create_data_free(data);
+}
+#endif
+
static void interface_get_result(const char *error,
DBusMessageIter *iter, void *user_data)
{
const char *path = NULL;
int err;
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
if (error) {
goto done;
}
+#if defined TIZEN_EXT
+ data->interface = interface;
+ err = supplicant_dbus_property_get(path,
+ SUPPLICANT_INTERFACE ".Interface",
+ "State", interface_get_state, data, NULL);
+
+ if (err == 0)
+ return;
+#endif
+
if (data->callback) {
data->callback(0, interface, data->user_data);
#if !defined TIZEN_EXT
static void interface_get_params(DBusMessageIter *iter, void *user_data)
{
struct interface_create_data *data = user_data;
-
+#if defined TIZEN_EXT
+ if (!simplified_log)
+#endif
SUPPLICANT_DBG("");
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &data->ifname);
add_network_security_proto(dict, ssid);
break;
case G_SUPPLICANT_SECURITY_SAE:
- key_mgmt = "SAE";
+ if (ssid->keymgmt & G_SUPPLICANT_KEYMGMT_WPA_PSK)
+ key_mgmt = "SAE WPA-PSK"; // WFA (WPA3 & WPA2 Mixed -> WPA2 only)
+ else
+ key_mgmt = "SAE";
add_network_security_psk(dict, ssid);
break;
case G_SUPPLICANT_SECURITY_OWE:
ssid->ssid_len);
#if defined TIZEN_EXT
- if (ssid->bssid) {
+ bool owe_transition_mode = FALSE;
+ if ((ssid->security == G_SUPPLICANT_SECURITY_OWE) && !(ssid->keymgmt & G_SUPPLICANT_KEYMGMT_OWE))
+ owe_transition_mode = TRUE;
+
+ if (ssid->bssid && !owe_transition_mode) {
char *bssid = NULL;
bssid = g_try_malloc0(18);
if (bssid == NULL) {
connection = NULL;
return -EIO;
}
-
+#if defined TIZEN_EXT
+ simplified_log = connman_setting_get_bool("SimplifiedLog");
+#endif
callbacks_pointer = callbacks;
eap_methods = 0;