summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaesub kim <taesub.kim@samsung.com>2018-01-22 05:52:51 (GMT)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2018-01-22 05:52:51 (GMT)
commita079cfe6f815f8c69055de834d1ccbdf1fd94ba7 (patch)
tree3d64db87050fd34c2fd502c1c14fdc0c63263e8d
parente2d7fb2f0a93e6af36870f0d79e4373108aa5375 (diff)
parent3210aec76f77e83630367d47b888db89baec44c4 (diff)
downloadconnman-a079cfe6f815f8c69055de834d1ccbdf1fd94ba7.zip
connman-a079cfe6f815f8c69055de834d1ccbdf1fd94ba7.tar.gz
connman-a079cfe6f815f8c69055de834d1ccbdf1fd94ba7.tar.bz2
Merge "Modified logic to process each VSIE of all vendors." into tizensubmit/tizen/20180122.055447submit/tizen/20180122.055424accepted/tizen/unified/20180123.061054
-rwxr-xr-xgsupplicant/gsupplicant.h3
-rwxr-xr-xgsupplicant/supplicant.c82
-rwxr-xr-xinclude/network.h4
-rwxr-xr-xplugins/wifi.c14
-rwxr-xr-xsrc/network.c48
-rwxr-xr-xsrc/service.c23
6 files changed, 104 insertions, 70 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 612ab5a..123f3b2 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -377,8 +377,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 9a58e29..243dcd0 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -211,8 +211,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;
@@ -240,8 +239,7 @@ struct _GSupplicantNetwork {
char *identity;
char *phase2;
unsigned int keymgmt;
- char *wifi_vsie;
- unsigned int wifi_vsie_len;
+ GSList *vsie_list;
#endif
};
@@ -671,7 +669,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);
@@ -683,7 +681,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);
}
@@ -1381,16 +1379,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
@@ -1687,14 +1698,18 @@ static void 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.");
}
}
@@ -1878,9 +1893,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;
@@ -1912,16 +1924,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 995fab4..0d33f4d 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3221,8 +3221,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);
@@ -3249,9 +3248,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) {
@@ -3276,9 +3272,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 5aac8d6..f7a9925 100755
--- a/src/network.c
+++ b/src/network.c
@@ -109,8 +109,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;
@@ -971,7 +970,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);
@@ -2395,6 +2394,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
@@ -2419,16 +2443,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;
}
@@ -2457,14 +2471,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 129b410..033c8f8 100755
--- a/src/service.c
+++ b/src/service.c
@@ -3248,14 +3248,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);