summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
Diffstat (limited to 'gsupplicant')
-rwxr-xr-xgsupplicant/gsupplicant.h3
-rw-r--r--gsupplicant/supplicant.c86
2 files changed, 53 insertions, 36 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 88606262..46d065bf 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -382,8 +382,7 @@ const char *g_supplicant_network_get_eap(GSupplicantNetwork *network);
const char *g_supplicant_network_get_identity(GSupplicantNetwork *network);
const char *g_supplicant_network_get_phase2(GSupplicantNetwork *network);
unsigned int g_supplicant_network_get_keymgmt(GSupplicantNetwork *network);
-const void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network,
- unsigned int *wifi_vsie_len);
+void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network);
#endif
struct _GSupplicantCallbacks {
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 5e9f5095..724520e0 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -221,8 +221,7 @@ struct g_supplicant_bss {
#if defined TIZEN_EXT
dbus_bool_t ft_psk;
dbus_bool_t ft_ieee8021x;
- char *wifi_vsie;
- unsigned int wifi_vsie_len;
+ GSList *vsie_list;
dbus_bool_t hs20;
#endif
unsigned int wps_capabilities;
@@ -250,8 +249,7 @@ struct _GSupplicantNetwork {
char *identity;
char *phase2;
unsigned int keymgmt;
- char *wifi_vsie;
- unsigned int wifi_vsie_len;
+ GSList *vsie_list;
#endif
};
@@ -808,7 +806,7 @@ static void remove_network(gpointer data)
g_free(network->phase2);
#endif
#if defined TIZEN_EXT
- g_free(network->wifi_vsie);
+ g_slist_free_full(network->vsie_list, g_free);
#endif
g_free(network);
@@ -820,7 +818,7 @@ static void remove_bss(gpointer data)
g_free(bss->path);
#if defined TIZEN_EXT
- g_free(bss->wifi_vsie);
+ g_slist_free_full(bss->vsie_list, g_free);
#endif
g_free(bss);
}
@@ -1558,16 +1556,29 @@ bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network)
return false;
}
-const void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network,
- unsigned int *wifi_vsie_len)
+void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network)
{
- if (!network) {
- *wifi_vsie_len = 0;
+ GSList *vsie_list = NULL;
+
+ if (!network)
return NULL;
+
+ if (g_slist_length(network->vsie_list) > 0) {
+ GSList *list = NULL;
+ unsigned char *vsie = NULL;
+ for (list = network->vsie_list; list; list = list->next) {
+ unsigned char *ie = (unsigned char *)list->data;
+ vsie = (unsigned char *)g_try_malloc0(ie[1]+2); // tag number size(1), tag length size(1)
+
+ if (vsie) {
+ memcpy(vsie, ie, ie[1]+2);
+ vsie_list = g_slist_append(vsie_list, vsie);
+ } else
+ SUPPLICANT_DBG("Failed to allocate memory");
+ }
}
- *wifi_vsie_len = network->wifi_vsie_len;
- return network->wifi_vsie;
+ return vsie_list;
}
#endif
@@ -1849,14 +1860,18 @@ static int add_or_replace_bss_to_network(struct g_supplicant_bss *bss)
#if defined TIZEN_EXT
network->keymgmt = bss->keymgmt;
- if (bss->wifi_vsie_len > 0) {
- SUPPLICANT_DBG("vsie len: %d", bss->wifi_vsie_len);
- network->wifi_vsie = (char *)g_try_malloc0(bss->wifi_vsie_len);
- if(network->wifi_vsie) {
- network->wifi_vsie_len = bss->wifi_vsie_len;
- memcpy(network->wifi_vsie, bss->wifi_vsie, network->wifi_vsie_len);
- } else {
- SUPPLICANT_DBG("Failed to allocate memory for wifi_vsie");
+ if (g_slist_length(bss->vsie_list) > 0) {
+ GSList *list = NULL;
+ unsigned char *vsie = NULL;
+ for (list = bss->vsie_list; list; list = list->next) {
+ unsigned char *ie = (unsigned char *)list->data;
+ vsie = (unsigned char *)g_try_malloc0(ie[1]+2); // tag number size(1), tag length size(1)
+
+ if (vsie) {
+ memcpy(vsie, ie, ie[1]+2);
+ network->vsie_list = g_slist_append(network->vsie_list, vsie);
+ } else
+ SUPPLICANT_DBG("Failed to allocate memory.");
}
}
@@ -2047,9 +2062,6 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
{
struct g_supplicant_bss *bss = user_data;
const unsigned char WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 };
-#if defined TIZEN_EXT
- const unsigned char WIFI_OUI[] = {0x00, 0x16, 0x32};
-#endif
unsigned char *ie, *ie_end;
DBusMessageIter array;
unsigned int value;
@@ -2081,16 +2093,20 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
for (ie_end = ie + ie_len; ie < ie_end && ie + ie[1] + 1 <= ie_end;
ie += ie[1] + 2) {
#if defined TIZEN_EXT
- if((ie[0] == VENDOR_SPECIFIC_INFO) && (memcmp(ie+2, WIFI_OUI, sizeof(WIFI_OUI)) == 0)) {
- SUPPLICANT_DBG("IE: match WIFI_OUI");
- bss->wifi_vsie = (char *)g_try_malloc0(ie[1] + 2); // tag number size(1), tag length size(1)
- if (bss->wifi_vsie) {
- bss->wifi_vsie_len = ie[1] + 2;
- memcpy(bss->wifi_vsie, ie, bss->wifi_vsie_len);
- } else {
- SUPPLICANT_DBG("Failed to allocate memory for wifi_vsie");
- }
- continue;
+ unsigned char *vsie;
+ int vsie_len = 0;
+ if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) {
+ 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);
+
+ if (vsie) {
+ memcpy(vsie, ie, vsie_len);
+ bss->vsie_list = g_slist_append(bss->vsie_list, vsie);
+ } else
+ SUPPLICANT_DBG("Failed to allocate memory");
+ continue;
}
#endif
if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN ||
@@ -5540,11 +5556,13 @@ static void decryption_request_reply(DBusPendingCall *call,
if (dbus_set_error_from_message(&error, reply)) {
SUPPLICANT_DBG("decryption_request_reply() %s %s", error.name, error.message);
dbus_error_free(&error);
+ ret = -EINVAL;
goto done;
}
if (dbus_message_iter_init(reply, &args) == FALSE) {
SUPPLICANT_DBG("dbus_message_iter_init() failed");
+ ret = -EINVAL;
goto done;
}
@@ -5559,6 +5577,7 @@ static void decryption_request_reply(DBusPendingCall *call,
interface_add_network_result, data,
data->interface);
+done:
if (ret < 0) {
SUPPLICANT_DBG("AddNetwork failed %d", ret);
callback_assoc_failed(decrypt_request_data.data->user_data);
@@ -5567,7 +5586,6 @@ static void decryption_request_reply(DBusPendingCall *call,
dbus_free(data);
}
-done:
dbus_message_unref(reply);
dbus_pending_call_unref(call);