summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2018-02-20 06:37:40 (GMT)
committerJaehyun Kim <jeik01.kim@samsung.com>2018-02-21 06:14:10 (GMT)
commit63d4f774d04c381000e45e7490bc838da9b36027 (patch)
tree37c181ca6916c3f926dec23c87e6ca91e95f21e4
parent45e07ac85c513f438bf4534b4a6abe36f0467248 (diff)
downloadconnman-63d4f774d04c381000e45e7490bc838da9b36027.zip
connman-63d4f774d04c381000e45e7490bc838da9b36027.tar.gz
connman-63d4f774d04c381000e45e7490bc838da9b36027.tar.bz2
Added new dbus method to support bssid based connectionrefs/changes/72/170472/3
Change-Id: I95d2a56c1d26db06cbdb5c85dc0e2b33b3c10da3 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h2
-rw-r--r--gsupplicant/supplicant.c32
-rwxr-xr-xplugins/wifi.c15
-rwxr-xr-xsrc/connman.h11
-rwxr-xr-xsrc/technology.c57
5 files changed, 106 insertions, 11 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 46d065b..0476ff6 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -173,6 +173,8 @@ struct _GSupplicantSSID {
int ignore_broadcast_ssid;
#if defined TIZEN_EXT
unsigned char *bssid;
+ unsigned int bssid_for_connect_len;
+ unsigned char bssid_for_connect[6];
#endif
};
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 724520e..9b7a934 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -4815,7 +4815,8 @@ static void interface_select_network_params(DBusMessageIter *iter,
dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
&interface->network_path);
#if defined TIZEN_EXT
- dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &ssid->freq);
+ if (!ssid->bssid_for_connect_len)
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &ssid->freq);
#endif
}
@@ -4842,14 +4843,20 @@ static void interface_add_network_result(const char *error,
#if defined TIZEN_EXT
SUPPLICANT_DBG(".Interface.SelectNetworkFreq");
-#endif
+ GSupplicantSSID *ssid = data->ssid;
-#if defined TIZEN_EXT
- supplicant_dbus_method_call(data->interface->path,
- SUPPLICANT_INTERFACE ".Interface", "SelectNetworkFreq",
- interface_select_network_params,
- interface_select_network_result, data,
- interface);
+ if (!ssid->bssid_for_connect_len)
+ supplicant_dbus_method_call(data->interface->path,
+ SUPPLICANT_INTERFACE ".Interface", "SelectNetworkFreq",
+ interface_select_network_params,
+ interface_select_network_result, data,
+ interface);
+ else
+ supplicant_dbus_method_call(data->interface->path,
+ SUPPLICANT_INTERFACE ".Interface", "SelectNetwork",
+ interface_select_network_params,
+ interface_select_network_result, data,
+ interface);
#else
supplicant_dbus_method_call(data->interface->path,
SUPPLICANT_INTERFACE ".Interface", "SelectNetwork",
@@ -5401,9 +5408,16 @@ static void interface_add_network_params(DBusMessageIter *iter, void *user_data)
supplicant_dbus_dict_close(iter, &dict);
return;
}
- snprintf(bssid, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
+
+ if (ssid->bssid_for_connect_len)
+ snprintf(bssid, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
+ ssid->bssid_for_connect[0], ssid->bssid_for_connect[1], ssid->bssid_for_connect[2],
+ ssid->bssid_for_connect[3], ssid->bssid_for_connect[4], ssid->bssid_for_connect[5]);
+ else
+ snprintf(bssid, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
ssid->bssid[0], ssid->bssid[1], ssid->bssid[2],
ssid->bssid[3], ssid->bssid[4], ssid->bssid[5]);
+
supplicant_dbus_dict_append_basic(&dict, "bssid",
DBUS_TYPE_STRING, &bssid);
g_free(bssid);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index c66f838..3d7636c 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2393,6 +2393,8 @@ static void connect_callback(int result, GSupplicantInterface *interface,
DBG("network %p result %d", network, result);
#if defined TIZEN_EXT
+ set_connman_bssid(RESET_BSSID, NULL);
+
for (list = iface_list; list; list = list->next) {
wifi = list->data;
@@ -2500,7 +2502,16 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
ssid->bssid = connman_network_get_bssid(network);
#endif
#if defined TIZEN_EXT
- ssid->freq = connman_network_get_frequency(network);
+ if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
+ ssid->bssid_for_connect_len = 6;
+ set_connman_bssid(GET_BSSID, (char *)ssid->bssid_for_connect);
+ DBG("BSSID : %02x:%02x:%02x:%02x:%02x:%02x",
+ ssid->bssid_for_connect[0], ssid->bssid_for_connect[1],
+ ssid->bssid_for_connect[2], ssid->bssid_for_connect[3],
+ ssid->bssid_for_connect[4], ssid->bssid_for_connect[5]);
+ } else {
+ ssid->freq = connman_network_get_frequency(network);
+ }
#endif
if (connman_setting_get_bool("BackgroundScanning"))
@@ -2803,7 +2814,7 @@ static bool handle_wps_completion(GSupplicantInterface *interface,
return true;
}
- ret = send_encryption_request(passphrase, passphrase);
+ ret = send_encryption_request(passphrase, network);
g_free(passphrase);
diff --git a/src/connman.h b/src/connman.h
index 4125463..a5977b8 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -564,6 +564,17 @@ void __connman_technology_remove_interface(enum connman_service_type type,
void __connman_technology_notify_regdom_by_device(struct connman_device *device,
int result, const char *alpha2);
+#if defined TIZEN_EXT
+enum bssid_type {
+ CHECK_BSSID = 0,
+ GET_BSSID = 1,
+ SET_BSSID = 2,
+ RESET_BSSID = 3,
+};
+
+int set_connman_bssid(enum bssid_type mode, char *bssid);
+#endif
+
#include <connman/device.h>
int __connman_device_init(const char *device, const char *nodevice);
diff --git a/src/technology.c b/src/technology.c
index 5aea9f4..5d5b70f 100755
--- a/src/technology.c
+++ b/src/technology.c
@@ -25,6 +25,9 @@
#include <errno.h>
#include <string.h>
+#if defined TIZEN_EXT
+#include <stdio.h>
+#endif
#include <gdbus.h>
@@ -876,6 +879,49 @@ make_reply:
return reply;
}
+#if defined TIZEN_EXT
+int set_connman_bssid(enum bssid_type mode, char *bssid)
+{
+ static unsigned char bssid_for_connect[6];
+ static int bssid_len;
+
+ DBG("mode : %d", mode);
+
+ if (mode == CHECK_BSSID) {
+ return bssid_len;
+ }
+
+ if (mode == GET_BSSID && bssid) {
+ memcpy(bssid, bssid_for_connect, 6);
+ return bssid_len;
+ }
+
+ if (mode == RESET_BSSID) {
+ bssid_len = 0;
+ return bssid_len;
+ }
+
+ if (mode != SET_BSSID || !bssid) {
+ DBG("Invalid parameter");
+ return 0;
+ }
+
+ bssid_len = sscanf(bssid, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &bssid_for_connect[0], &bssid_for_connect[1], &bssid_for_connect[2],
+ &bssid_for_connect[3], &bssid_for_connect[4], &bssid_for_connect[5]);
+ if (bssid_len != 6) {
+ DBG("Incorrect BSSID format. bssid_len = %d", bssid_len);
+ bssid_len = 0;
+ }
+
+ DBG("SET BSSID len : %d, BSSID : %02x:%02x:%02x:%02x:%02x:%02x", bssid_len,
+ bssid_for_connect[0], bssid_for_connect[1], bssid_for_connect[2],
+ bssid_for_connect[3], bssid_for_connect[4], bssid_for_connect[5]);
+
+ return bssid_len;
+}
+#endif
+
static DBusMessage *set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -1023,6 +1069,17 @@ static DBusMessage *set_property(DBusConnection *conn,
dbus_message_iter_get_basic(&value, &enable);
return set_powered(technology, msg, enable);
+#if defined TIZEN_EXT
+ } else if (g_str_equal(name, "SetBSSID")) {
+ char *key;
+
+ if (type != DBUS_TYPE_STRING)
+ return __connman_error_invalid_arguments(msg);
+
+ dbus_message_iter_get_basic(&value, &key);
+ DBG("BSSID %s", key);
+ set_connman_bssid(SET_BSSID, key);
+#endif
} else
return __connman_error_invalid_property(msg);