summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2018-01-04 09:18:49 (GMT)
committerSeonah Moon <seonah1.moon@samsung.com>2018-01-23 07:59:24 (GMT)
commit0e3dff67b594543b0488007bc913b3939ffe0fe6 (patch)
tree861e7b40e81acacf63951cc79cc7191893aec420
parent1e0637575d1d1250baa8551dde46bb7bab02bc38 (diff)
downloadconnman-0e3dff67b594543b0488007bc913b3939ffe0fe6.zip
connman-0e3dff67b594543b0488007bc913b3939ffe0fe6.tar.gz
connman-0e3dff67b594543b0488007bc913b3939ffe0fe6.tar.bz2
Modified logic to process each VSIE of all vendors.refs/changes/83/167983/1
Modified logic to process each VSIE of all vendors instead of only samsung vendor(OUI: 001632). Received VSIE will be appended in the list and shared with application. Change-Id: Ifbb0159f40a8949a6f117416e5d436d5c2299b49
-rwxr-xr-xgsupplicant/gsupplicant.h3
-rw-r--r--gsupplicant/supplicant.c82
-rwxr-xr-xinclude/network.h4
-rwxr-xr-xplugins/wifi.c14
-rwxr-xr-xsrc/network.c49
-rwxr-xr-xsrc/service.c23
6 files changed, 104 insertions, 71 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 8860626..46d065b 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 28c95ea..724520e 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 ||
diff --git a/include/network.h b/include/network.h
index 4be5fbf..baf1c01 100755
--- a/include/network.h
+++ b/include/network.h
@@ -183,6 +183,10 @@ int connman_network_set_blob(struct connman_network *network,
const char *key, const void *data, unsigned int size);
const void *connman_network_get_blob(struct connman_network *network,
const char *key, unsigned int *size);
+#if defined TIZEN_EXT
+void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list);
+void *connman_network_get_vsie_list(struct connman_network *network);
+#endif
struct connman_device *connman_network_get_device(struct connman_network *network);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 8bc6307..c66f838 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3335,8 +3335,7 @@ static void network_added(GSupplicantNetwork *supplicant_network)
bool wps_advertizing;
#if defined TIZEN_EXT
- const char *wifi_vsie;
- unsigned int wifi_vsie_len;
+ GSList *vsie_list = NULL;
#endif
mode = g_supplicant_network_get_mode(supplicant_network);
@@ -3363,9 +3362,6 @@ static void network_added(GSupplicantNetwork *supplicant_network)
ssid = g_supplicant_network_get_ssid(supplicant_network, &ssid_len);
-#if defined TIZEN_EXT
- wifi_vsie = g_supplicant_network_get_wifi_vsie(supplicant_network, &wifi_vsie_len);
-#endif
network = connman_device_get_network(wifi->device, identifier);
if (!network) {
@@ -3390,9 +3386,11 @@ static void network_added(GSupplicantNetwork *supplicant_network)
connman_network_set_blob(network, "WiFi.SSID",
ssid, ssid_len);
#if defined TIZEN_EXT
- if(wifi_vsie_len > 0 && wifi_vsie)
- connman_network_set_blob(network, "WiFi.Vsie",
- wifi_vsie, wifi_vsie_len);
+ vsie_list = (GSList *)g_supplicant_network_get_wifi_vsie(supplicant_network);
+ if (vsie_list)
+ connman_network_set_vsie_list(network, vsie_list);
+ else
+ DBG("vsie_list is NULL");
#endif
connman_network_set_string(network, "WiFi.Security", security);
connman_network_set_strength(network,
diff --git a/src/network.c b/src/network.c
index d38fc0a..cf74b6d 100755
--- a/src/network.c
+++ b/src/network.c
@@ -114,8 +114,7 @@ struct connman_network {
bool rsn_mode;
int disconnect_reason;
int assoc_status_code;
- void *wifi_vsie;
- unsigned int wifi_vsie_len;
+ GSList *vsie_list;
#endif
} wifi;
@@ -980,7 +979,7 @@ static void network_destruct(struct connman_network *network)
g_free(network->wifi.phase2_auth);
g_free(network->wifi.pin_wps);
#if defined TIZEN_EXT
- g_free(network->wifi.wifi_vsie);
+ g_slist_free_full(network->wifi.vsie_list, g_free);
#endif
g_free(network->path);
g_free(network->group);
@@ -2388,6 +2387,31 @@ bool connman_network_get_bool(struct connman_network *network,
return false;
}
+#if defined TIZEN_EXT
+/**
+ * connman_network_set_vsie_list:
+ * @network: network structure
+ * @vsie_list: GSList pointer
+ *
+ * Set vendor specific list pointer
+ */
+void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list)
+{
+ network->wifi.vsie_list = vsie_list;
+}
+
+/**
+ * connman_network_get_vsie_list:
+ * @network: network structure
+ *
+ * Get vendor specific list pointer
+ */
+void *connman_network_get_vsie_list(struct connman_network *network)
+{
+ return network->wifi.vsie_list;
+}
+#endif
+
/**
* connman_network_set_blob:
* @network: network structure
@@ -2408,16 +2432,6 @@ int connman_network_set_blob(struct connman_network *network,
network->wifi.ssid_len = size;
} else
network->wifi.ssid_len = 0;
-#if defined TIZEN_EXT
- } else if (g_str_equal(key, "WiFi.Vsie")){
- g_free(network->wifi.wifi_vsie);
- network->wifi.wifi_vsie = g_try_malloc(size);
- if (network->wifi.wifi_vsie) {
- memcpy(network->wifi.wifi_vsie, data, size);
- network->wifi.wifi_vsie_len = size;
- } else
- network->wifi.wifi_vsie_len = 0;
-#endif
} else {
return -EINVAL;
}
@@ -2442,15 +2456,6 @@ const void *connman_network_get_blob(struct connman_network *network,
return network->wifi.ssid;
}
-#if defined TIZEN_EXT
- if (g_str_equal(key, "WiFi.Vsie")) {
- if (size)
- *size = network->wifi.wifi_vsie_len;
-
- return network->wifi.wifi_vsie;
- }
-#endif
-
return NULL;
}
diff --git a/src/service.c b/src/service.c
index d0543ae..ba4acc1 100755
--- a/src/service.c
+++ b/src/service.c
@@ -3305,14 +3305,25 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
connman_dbus_dict_append_basic(dict, "Frequency",
DBUS_TYPE_UINT16, &frequency);
}
- const void *wifi_vsie;
+
+ unsigned char *wifi_vsie;
unsigned int wifi_vsie_len;
- wifi_vsie = connman_network_get_blob(service->network, "WiFi.Vsie", &wifi_vsie_len);
- if(wifi_vsie_len > 0) {
- DBG("ConnMan, service->path=%s vsie length=%d", service->path, wifi_vsie_len);
+ GSList *vsie_list = NULL;
+
+ if (service->network)
+ vsie_list = (GSList *)connman_network_get_vsie_list(service->network);
+
+ if (vsie_list) {
+ DBG("ConnMan, service->path=%s No.of elements in list: %d", service->path, g_slist_length(vsie_list));
+ GSList *list;
+ for (list = vsie_list; list; list = list->next) {
+ wifi_vsie = (unsigned char *)list->data;
+ wifi_vsie_len = wifi_vsie[1] + 2;
+
+ connman_dbus_dict_append_fixed_array(dict, "Vsie", DBUS_TYPE_BYTE,
+ &wifi_vsie, wifi_vsie_len);
+ }
}
- connman_dbus_dict_append_fixed_array(dict, "Vsie", DBUS_TYPE_BYTE,
- &wifi_vsie, wifi_vsie_len);
#endif
str = __connman_service_type2string(service->type);