Add setter/getter for handling MAC randomization policy
[platform/upstream/connman.git] / plugins / wifi.c
index c209da5..5b4a0aa 100755 (executable)
 
 #include <gsupplicant/gsupplicant.h>
 
+#include "src/shared/util.h"
+
 #define CLEANUP_TIMEOUT   8    /* in seconds */
 #define INACTIVE_TIMEOUT  12   /* in seconds */
 #define FAVORITE_MAXIMUM_RETRIES 2
 
-#define BGSCAN_DEFAULT "simple:30:-45:300"
+#define BGSCAN_DEFAULT "simple:30:-65:300"
 #define AUTOSCAN_EXPONENTIAL "exponential:3:300"
 #define AUTOSCAN_SINGLE "single:3"
 
@@ -2269,6 +2271,11 @@ static gboolean autoscan_timeout(gpointer data)
 
        autoscan = wifi->autoscan;
 
+#if defined TIZEN_EXT
+       if (!autoscan)
+               return FALSE;
+#endif
+
        if (autoscan->interval <= 0) {
                interval = autoscan->base;
                goto set_interval;
@@ -2390,6 +2397,18 @@ static void setup_autoscan(struct wifi_data *wifi)
                wifi->autoscan = parse_autoscan_params(AUTOSCAN_EXPONENTIAL);
                return;
        }
+#if defined TIZEN_EXT
+       else {
+               if (wifi->autoscan) {
+                       g_free(wifi->autoscan);
+                       wifi->autoscan = NULL;
+               }
+
+               DBG("BackgroundScanning is disabled");
+
+               return;
+       }
+#else
 
        /*
         * On the contrary, if BackgroundScanning is disabled, update autoscan
@@ -2413,8 +2432,15 @@ static void setup_autoscan(struct wifi_data *wifi)
                wifi->autoscan = parse_autoscan_params(AUTOSCAN_SINGLE);
                break;
        }
+#endif
 }
 
+#ifdef TIZEN_EXT
+int wifi_set_mac_policy(struct connman_device *device, unsigned int policy);
+int wifi_set_preassoc_mac_policy(struct connman_device *device, unsigned int policy);
+int wifi_set_random_mac_lifetime(struct connman_device *device, unsigned int lifetime);
+#endif /* TIZEN_EXT */
+
 static void finalize_interface_creation(struct wifi_data *wifi)
 {
        DBG("interface is ready wifi %p tethering %d", wifi, wifi->tethering);
@@ -2426,6 +2452,17 @@ static void finalize_interface_creation(struct wifi_data *wifi)
 
        connman_device_set_powered(wifi->device, true);
 
+#ifdef TIZEN_EXT
+       wifi_set_mac_policy(wifi->device,
+                               connman_device_get_mac_policy(wifi->device));
+
+       wifi_set_preassoc_mac_policy(wifi->device,
+                               connman_device_get_preassoc_mac_policy(wifi->device));
+
+       wifi_set_random_mac_lifetime(wifi->device,
+                               connman_device_get_random_mac_lifetime(wifi->device));
+#endif /* TIZEN_EXT */
+
        if (wifi->p2p_device)
                return;
 
@@ -2601,7 +2638,7 @@ static int get_latest_connections(int max_ssids,
                        g_key_file_free(keyfile);
                        continue;
                }
-               g_time_val_from_iso8601(str, &modified);
+               util_iso8601_to_timeval(str, &modified);
                g_free(str);
 
                ssid = g_key_file_get_string(keyfile,
@@ -2937,6 +2974,99 @@ static int wifi_specific_scan(enum connman_service_type type,
 
        return ret;
 }
+
+static void wifi_mac_policy_callback(int result,
+                                       unsigned int policy,
+                                               void *user_data)
+{
+       struct connman_device *device = user_data;
+
+       if (result == 0)
+               connman_device_mac_policy_notify(device, result, policy);
+
+       connman_device_unref(device);
+}
+
+int wifi_set_mac_policy(struct connman_device *device, unsigned int policy)
+{
+       struct wifi_data *wifi = connman_device_get_data(device);
+       int ret;
+
+       if (!wifi)
+               return -EINVAL;
+
+       connman_device_ref(device);
+
+       ret = g_supplicant_interface_set_mac_policy(wifi->interface,
+                                       wifi_mac_policy_callback,
+                                       policy, device);
+       if (ret != 0)
+               connman_device_unref(device);
+
+       return ret;
+}
+
+static void wifi_preassoc_mac_policy_callback(int result,
+                                       unsigned int policy,
+                                               void *user_data)
+{
+       struct connman_device *device = user_data;
+
+       if (result == 0)
+               connman_device_preassoc_mac_policy_notify(device, result, policy);
+
+       connman_device_unref(device);
+}
+
+int wifi_set_preassoc_mac_policy(struct connman_device *device, unsigned int policy)
+{
+       struct wifi_data *wifi = connman_device_get_data(device);
+       int ret;
+
+       if (!wifi)
+               return -EINVAL;
+
+       connman_device_ref(device);
+
+       ret = g_supplicant_interface_set_preassoc_mac_policy(wifi->interface,
+                                       wifi_preassoc_mac_policy_callback,
+                                       policy, device);
+       if (ret != 0)
+               connman_device_unref(device);
+
+       return ret;
+}
+
+static void wifi_random_mac_lifetime_callback(int result,
+                                       unsigned int lifetime,
+                                               void *user_data)
+{
+       struct connman_device *device = user_data;
+
+       if (result == 0)
+               connman_device_random_mac_lifetime_notify(device, result, lifetime);
+
+       connman_device_unref(device);
+}
+
+int wifi_set_random_mac_lifetime(struct connman_device *device, unsigned int lifetime)
+{
+       struct wifi_data *wifi = connman_device_get_data(device);
+       int ret;
+
+       if (!wifi)
+               return -EINVAL;
+
+       connman_device_ref(device);
+
+       ret = g_supplicant_interface_set_random_mac_lifetime(wifi->interface,
+                                       wifi_random_mac_lifetime_callback,
+                                       lifetime, device);
+       if (ret != 0)
+               connman_device_unref(device);
+
+       return ret;
+}
 #endif
 
 #if defined TIZEN_EXT_WIFI_MESH
@@ -2969,7 +3099,7 @@ static int mesh_scan(struct connman_device *device)
 
        wifi = connman_device_get_data(device);
 
-       if (!wifi->mesh_interface)
+       if (!wifi || !wifi->mesh_interface)
                return -ENOTSUP;
 
        mesh_info = wifi->mesh_info;
@@ -3212,19 +3342,31 @@ static int wifi_scan(struct connman_device *device,
        connman_device_ref(device);
 
        reset_autoscan(device);
-
+#if defined TIZEN_EXT
+       /*
+        * When doing a full scan, stored hidden networks also need to be scanned
+        * so that we can autoconnect to them.
+        */
+       if (params->force_full_scan)
+               ret = g_supplicant_interface_scan(wifi->interface, scan_params,
+                                                       scan_callback_hidden, device);
+       else
+#endif
        ret = g_supplicant_interface_scan(wifi->interface, scan_params,
                                                scan_callback, device);
        if (ret == 0) {
                connman_device_set_scanning(device,
                                CONNMAN_SERVICE_TYPE_WIFI, true);
 #if defined TIZEN_EXT
-               /*To allow the Full Scan after ssid based scan, set the flag here
-                 It is required because Tizen does not use the ConnMan specific
-                 backgroung Scan feature.Tizen has added the BG Scan feature in
-                 net-config. To sync with up ConnMan, we need to issue the Full Scan
-                 after SSID specific scan.*/
-               wifi->allow_full_scan = TRUE;
+               /*
+                * To allow the Full Scan after ssid based scan, set the flag here
+                * It is required because Tizen does not use the ConnMan specific
+                * backgroung Scan feature.Tizen has added the BG Scan feature in
+                * net-config. To sync with up ConnMan, we need to issue the Full Scan
+                * after SSID specific scan.
+                */
+               if (!params->force_full_scan && !do_hidden)
+                       wifi->allow_full_scan = TRUE;
 #endif
        } else {
                g_supplicant_free_scan_params(scan_params);
@@ -3300,6 +3442,9 @@ static struct connman_device_driver wifi_ng_driver = {
        .set_regdom     = wifi_set_regdom,
 #if defined TIZEN_EXT
        .specific_scan  = wifi_specific_scan,
+       .set_mac_policy           = wifi_set_mac_policy,
+       .set_preassoc_mac_policy  = wifi_set_preassoc_mac_policy,
+       .set_random_mac_lifetime  = wifi_set_random_mac_lifetime,
 #endif
 #if defined TIZEN_EXT_WIFI_MESH
        .abort_scan     = mesh_abort_scan,
@@ -3324,6 +3469,9 @@ static void system_killed(void)
 
 static int network_probe(struct connman_network *network)
 {
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("network %p", network);
 
        return 0;
@@ -3368,7 +3516,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);
+       const char *ifname = g_supplicant_interface_get_ifname(interface);
+       set_connman_bssid(RESET_BSSID, NULL, ifname);
 
        for (list = iface_list; list; list = list->next) {
                wifi = list->data;
@@ -3521,9 +3670,11 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
 #endif
 
 #if defined TIZEN_EXT
-       if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
+       const char *ifname = connman_device_get_string(
+                       connman_network_get_device(network), "Interface");
+       if (set_connman_bssid(CHECK_BSSID, NULL, ifname) == 6) {
                ssid->bssid_for_connect_len = 6;
-               set_connman_bssid(GET_BSSID, (char *)ssid->bssid_for_connect);
+               set_connman_bssid(GET_BSSID, (char *)ssid->bssid_for_connect, ifname);
                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],
@@ -3539,8 +3690,8 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
                 * the user-specified bssid is tried only once at the beginning.
                 * After that, the bssids in the list are tried in order.
                 */
-               if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
-                       set_connman_bssid(RESET_BSSID, NULL);
+               if (set_connman_bssid(CHECK_BSSID, NULL, ifname) == 6) {
+                       set_connman_bssid(RESET_BSSID, NULL, ifname);
                        goto done;
                }
 
@@ -3584,6 +3735,8 @@ done:
 
        if(g_strcmp0(ssid->eap, "fast") == 0)
                ssid->pac_file = g_strdup(WIFI_EAP_FAST_PAC_FILE);
+
+       ssid->keymgmt = connman_network_get_keymgmt(network);
 #endif
 
        if (connman_setting_get_bool("BackgroundScanning"))
@@ -3670,7 +3823,7 @@ found:
                return;
        }
 
-       if (wifi->network != wifi->pending_network)
+       if (wifi->network && wifi->network != wifi->pending_network)
                connman_network_set_connected(wifi->network, false);
        wifi->network = NULL;
 
@@ -3823,6 +3976,7 @@ static void signalpoll_callback(int result, int maxspeed, int strength,
 
        if (result != 0) {
                DBG("Failed to get maxspeed from signalpoll !");
+               connman_network_unref(network);
                return;
        }
 
@@ -3831,11 +3985,12 @@ static void signalpoll_callback(int result, int maxspeed, int strength,
                strength = 100;
 
        DBG("maxspeed = %d, strength = %d", maxspeed, strength);
-       if (network) {
-               connman_network_set_strength(network, (uint8_t)strength);
-               connman_network_set_maxspeed(network, maxspeed);
-               set_connection_mode(network, maxspeed);
-       }
+
+       connman_network_set_strength(network, (uint8_t)strength);
+       connman_network_set_maxspeed(network, maxspeed);
+       set_connection_mode(network, maxspeed);
+
+       connman_network_unref(network);
 }
 
 static int network_signalpoll(struct wifi_data *wifi)
@@ -3846,6 +4001,8 @@ static int network_signalpoll(struct wifi_data *wifi)
        if (!wifi || !wifi->network)
                return -ENODEV;
 
+       wifi->network = connman_network_ref(wifi->network);
+
        interface = wifi->interface;
        network = wifi->network;
 
@@ -3867,6 +4024,9 @@ static gboolean autosignalpoll_timeout(gpointer data)
        if (ret < 0) {
                DBG("Fail to get max speed !!");
                wifi->automaxspeed_timeout = 0;
+
+               if (wifi->network)
+                       connman_network_unref(wifi->network);
                return FALSE;
        }
 
@@ -3888,6 +4048,15 @@ static void interface_added(GSupplicantInterface *interface)
 {
        const char *ifname = g_supplicant_interface_get_ifname(interface);
        const char *driver = g_supplicant_interface_get_driver(interface);
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 #if defined TIZEN_EXT
        bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface);
 #endif
@@ -3916,10 +4085,10 @@ static void interface_added(GSupplicantInterface *interface)
 
        connman_device_set_powered(wifi->device, true);
 #if defined TIZEN_EXT
-       connman_techonology_wifi_set_5ghz_supported(wifi_technology, is_5_0_ghz_supported);
+       connman_device_set_wifi_5ghz_supported(wifi->device, is_5_0_ghz_supported);
        /* Max number of SSIDs supported by wlan chipset that can be scanned */
        int max_scan_ssids = g_supplicant_interface_get_max_scan_ssids(interface);
-       connman_techonology_set_max_scan_ssids(wifi_technology, max_scan_ssids);
+       connman_device_set_max_scan_ssids(wifi->device, max_scan_ssids);
 #endif
 }
 
@@ -4162,6 +4331,15 @@ static void interface_state(GSupplicantInterface *interface)
        struct connman_device *device;
        struct wifi_data *wifi;
        GSupplicantState state = g_supplicant_interface_get_state(interface);
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        bool wps;
        bool old_connected;
 
@@ -4288,8 +4466,19 @@ static void interface_state(GSupplicantInterface *interface)
 #if defined TIZEN_EXT
                if (handle_assoc_status_code(interface, wifi)) {
                        GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
+                       const char *group = connman_network_get_group(network);
+                       GSupplicantNetwork *supplicant_network;
                        guint bssid_length = 0;
 
+                       if (group) {
+                               supplicant_network = g_supplicant_interface_get_network(interface, group);
+
+                               connman_network_set_assoc_reject_table(network,
+                                       g_supplicant_network_get_assoc_reject_table(supplicant_network));
+
+                               g_supplicant_network_update_assoc_reject(interface, supplicant_network);
+                       }
+
                        if (bssid_list)
                                bssid_length = g_slist_length(bssid_list);
 
@@ -4414,6 +4603,15 @@ static void interface_removed(GSupplicantInterface *interface)
 {
        const char *ifname = g_supplicant_interface_get_ifname(interface);
        struct wifi_data *wifi;
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 
        DBG("ifname %s", ifname);
 
@@ -4482,6 +4680,15 @@ static void p2p_support(GSupplicantInterface *interface)
 {
        char dev_type[17] = {};
        const char *hostname;
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 
        DBG("");
 
@@ -4508,11 +4715,29 @@ static void p2p_support(GSupplicantInterface *interface)
 
 static void scan_started(GSupplicantInterface *interface)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        DBG("");
 }
 
 static void scan_finished(GSupplicantInterface *interface)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 #if defined TIZEN_EXT
        struct wifi_data *wifi;
        bool is_associating = false;
@@ -4549,6 +4774,15 @@ static void scan_finished(GSupplicantInterface *interface)
 
 static void ap_create_fail(GSupplicantInterface *interface)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
        int ret;
 
@@ -4693,6 +4927,10 @@ static void network_added(GSupplicantNetwork *supplicant_network)
        bool wps_advertizing;
 
 #if defined TIZEN_EXT
+       bool owe_transition_mode;
+       const unsigned char *transition_mode_ssid;
+       const unsigned char *transition_mode_bssid;
+       unsigned int transition_mode_ssid_len;
        GSList *vsie_list = NULL;
        const unsigned char *country_code;
        ieee80211_modes_e phy_mode;
@@ -4700,7 +4938,9 @@ static void network_added(GSupplicantNetwork *supplicant_network)
 
        mode = g_supplicant_network_get_mode(supplicant_network);
        identifier = g_supplicant_network_get_identifier(supplicant_network);
-
+#if defined TIZEN_EXT
+       if (!simplified_log)
+#endif
        DBG("%s", identifier);
 
        if (!g_strcmp0(mode, "adhoc"))
@@ -4714,6 +4954,15 @@ static void network_added(GSupplicantNetwork *supplicant_network)
 #endif
 
        interface = g_supplicant_network_get_interface(supplicant_network);
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        wifi = g_supplicant_interface_get_data(interface);
        name = g_supplicant_network_get_name(supplicant_network);
        security = g_supplicant_network_get_security(supplicant_network);
@@ -4788,6 +5037,15 @@ static void network_added(GSupplicantNetwork *supplicant_network)
 #if defined TIZEN_EXT
        connman_network_set_bssid(network,
                        g_supplicant_network_get_bssid(supplicant_network));
+       owe_transition_mode = (bool)g_supplicant_network_get_transition_mode(supplicant_network);
+       connman_network_set_bool(network, "WiFi.TRANSITION_MODE", owe_transition_mode);
+       if (owe_transition_mode) {
+               transition_mode_ssid = (unsigned char *)g_supplicant_network_get_transition_mode_ssid(supplicant_network, &transition_mode_ssid_len);
+               connman_network_set_blob(network, "WiFi.TRANSITION_MODE_SSID",
+                                                       transition_mode_ssid, transition_mode_ssid_len);
+               transition_mode_bssid = g_supplicant_network_get_transition_mode_bssid(supplicant_network);
+               connman_network_set_transition_mode_bssid(network, transition_mode_bssid);
+       }
        connman_network_set_maxrate(network,
                        g_supplicant_network_get_maxrate(supplicant_network));
        connman_network_set_enc_mode(network,
@@ -4800,6 +5058,10 @@ static void network_added(GSupplicantNetwork *supplicant_network)
                        g_supplicant_network_is_hs20AP(supplicant_network));
        connman_network_set_bssid_list(network,
                        (GSList *)g_supplicant_network_get_bssid_list(supplicant_network));
+       connman_network_set_last_connected_bssid(network,
+                       g_supplicant_network_get_last_connected_bssid(supplicant_network));
+       connman_network_set_assoc_reject_table(network,
+                       g_supplicant_network_get_assoc_reject_table(supplicant_network));
 #endif
        connman_network_set_available(network, true);
        connman_network_set_string(network, "WiFi.Mode", mode);
@@ -4812,6 +5074,11 @@ static void network_added(GSupplicantNetwork *supplicant_network)
                connman_network_set_group(network, group);
 
 #if defined TIZEN_EXT
+       g_supplicant_network_set_last_connected_bssid(supplicant_network,
+                       connman_network_get_last_connected_bssid(network));
+#endif
+
+#if defined TIZEN_EXT
        if (wifi_first_scan == true)
                found_with_first_scan = true;
 #endif
@@ -4853,6 +5120,15 @@ static void network_removed(GSupplicantNetwork *network)
 #endif
 
        interface = g_supplicant_network_get_interface(network);
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        wifi = g_supplicant_interface_get_data(interface);
        identifier = g_supplicant_network_get_identifier(network);
        name = g_supplicant_network_get_name(network);
@@ -4903,11 +5179,25 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
 #endif
 
        interface = g_supplicant_network_get_interface(network);
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        wifi = g_supplicant_interface_get_data(interface);
        identifier = g_supplicant_network_get_identifier(network);
        name = g_supplicant_network_get_name(network);
 
+#if defined TIZEN_EXT
+       if (!simplified_log)
+               DBG("name %s property %s", name, property);
+#else
        DBG("name %s", name);
+#endif
 
        if (!wifi)
                return;
@@ -4947,7 +5237,35 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
                connman_network_set_strength(connman_network,
                                        calculate_strength(network));
                update_needed = true;
-       } else
+       }
+#if defined TIZEN_EXT
+       else if (g_str_equal(property, "LastConnectedBSSID")) {
+               const char *ident, *group;
+               char *service_ident;
+               bool need_save;
+
+               ident = connman_device_get_ident(wifi->device);
+               group = connman_network_get_group(connman_network);
+               if (ident && group) {
+                       service_ident = g_strdup_printf("%s_%s_%s",
+                               __connman_network_get_type(connman_network), ident, group);
+
+                       need_save = connman_device_set_last_connected_ident(wifi->device, service_ident);
+                       if (need_save)
+                               connman_device_save_last_connected(wifi->device);
+               }
+
+               connman_network_set_last_connected_bssid(connman_network,
+                                       g_supplicant_network_get_last_connected_bssid(network));
+
+               update_needed = true;
+       } else if (g_str_equal(property, "UpdateAssocReject")) {
+               connman_network_set_assoc_reject_table(connman_network,
+                                       g_supplicant_network_get_assoc_reject_table(network));
+               update_needed = true;
+       }
+#endif
+       else
                update_needed = false;
 
        if (update_needed)
@@ -4988,6 +5306,15 @@ static void network_associated(GSupplicantNetwork *network)
        interface = g_supplicant_network_get_interface(network);
        if (!interface)
                return;
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 
        wifi = g_supplicant_interface_get_data(interface);
        if (!wifi)
@@ -5006,7 +5333,22 @@ static void network_associated(GSupplicantNetwork *network)
        if (wifi->network) {
                if (wifi->network == connman_network)
                        return;
-
+#if TIZEN_EXT
+               unsigned int ssid_len;
+               DBG("network1 ssid[%s] , OWE[%d],ssid[%s]",
+                       (char *)connman_network_get_blob(wifi->network,"WiFi.SSID", &ssid_len),
+                       connman_network_get_bool(wifi->network,"WiFi.TRANSITION_MODE"),
+                       (char *)connman_network_get_blob(wifi->network,"WiFi.TRANSITION_MODE_SSID", &ssid_len));
+
+               DBG("network1 ssid[%s], OWE[%d], ssid[%s]",
+                       (char *)connman_network_get_blob(connman_network,"WiFi.SSID",&ssid_len),
+                       connman_network_get_bool(connman_network,"WiFi.TRANSITION_MODE"),
+                       (char *)connman_network_get_blob(connman_network,"WiFi.TRANSITION_MODE_SSID", &ssid_len));
+               if (connman_network_check_transition_mode(wifi->network, connman_network)) {//OWE trasition mode check
+                       DBG("OWE transition mode is TRUE");
+                       return;
+               }
+#endif
                /*
                 * This should never happen, we got associated with
                 * a network different than the one we were expecting.
@@ -5034,6 +5376,15 @@ static void network_associated(GSupplicantNetwork *network)
 static void sta_authorized(GSupplicantInterface *interface,
                                        const char *addr)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
 
        DBG("wifi %p station %s authorized", wifi, addr);
@@ -5047,6 +5398,15 @@ static void sta_authorized(GSupplicantInterface *interface,
 static void sta_deauthorized(GSupplicantInterface *interface,
                                        const char *addr)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
 
        DBG("wifi %p station %s deauthorized", wifi, addr);
@@ -5282,6 +5642,15 @@ static void network_merged(GSupplicantNetwork *network)
        if (!interface)
                return;
 
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        state = g_supplicant_interface_get_state(interface);
        if (state < G_SUPPLICANT_STATE_AUTHENTICATING)
                return;
@@ -5339,17 +5708,60 @@ static void assoc_failed(void *user_data)
        struct connman_network *network = user_data;
        connman_network_set_associating(network, false);
 }
+
+static void scan_done(GSupplicantInterface *interface)
+{
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
+       GList *list;
+       int scan_type = CONNMAN_SCAN_TYPE_WPA_SUPPLICANT;
+       struct wifi_data *wifi;
+       bool scanning;
+
+       for (list = iface_list; list; list = list->next) {
+               wifi = list->data;
+
+               if (interface == wifi->interface) {
+                       scanning = connman_device_get_scanning(wifi->device,
+                                       CONNMAN_SERVICE_TYPE_WIFI);
+                       if (!scanning)
+                               __connman_technology_notify_scan_done(
+                                               connman_device_get_string(wifi->device, "Interface"), scan_type);
+                       break;
+               }
+       }
+}
 #endif
 
 static void debug(const char *str)
 {
+#if defined TIZEN_EXT
+       if (connman_setting_get_bool("ConnmanSupplicantDebug"))
+#else
        if (getenv("CONNMAN_SUPPLICANT_DEBUG"))
+#endif
                connman_debug("%s", str);
 }
 
 static void disconnect_reasoncode(GSupplicantInterface *interface,
                                int reasoncode)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
 
        if (wifi != NULL) {
@@ -5359,6 +5771,15 @@ static void disconnect_reasoncode(GSupplicantInterface *interface,
 
 static void assoc_status_code(GSupplicantInterface *interface, int status_code)
 {
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If supplicant interface's driver is wired then skip it,
+        * because it meanti only for ethernet not Wi-Fi.
+        */
+       if (!g_strcmp0("wired", g_supplicant_interface_get_driver(interface)))
+               return;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
 
        if (wifi != NULL) {
@@ -5366,7 +5787,11 @@ static void assoc_status_code(GSupplicantInterface *interface, int status_code)
        }
 }
 
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+static GSupplicantCallbacks callbacks = {
+#else /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
 static const GSupplicantCallbacks callbacks = {
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
        .system_ready           = system_ready,
        .system_killed          = system_killed,
        .interface_added        = interface_added,
@@ -5388,8 +5813,9 @@ static const GSupplicantCallbacks callbacks = {
        .peer_request           = peer_request,
 #if defined TIZEN_EXT
        .system_power_off       = system_power_off,
-       .network_merged = network_merged,
+       .network_merged         = network_merged,
        .assoc_failed           = assoc_failed,
+       .scan_done              = scan_done,
 #endif
        .debug                  = debug,
        .disconnect_reasoncode  = disconnect_reasoncode,
@@ -5703,6 +6129,33 @@ static int tech_set_regdom(struct connman_technology *technology, const char *al
        return g_supplicant_set_country(alpha2, regdom_callback, NULL);
 }
 
+#if defined TIZEN_EXT
+static void supp_ins_init(void)
+{
+       const char *string;
+       GSupplicantINSPreferredFreq preferred_freq;
+
+       string = connman_option_get_string("INSPreferredFreqBSSID");
+       if (g_strcmp0(string, "5GHz") == 0)
+               preferred_freq = G_SUPPLICANT_INS_PREFERRED_FREQ_5GHZ;
+       else if (g_strcmp0(string, "2.4GHz") == 0)
+               preferred_freq = G_SUPPLICANT_INS_PREFERRED_FREQ_24GHZ;
+       else
+               preferred_freq = G_SUPPLICANT_INS_PREFERRED_FREQ_UNKNOWN;
+
+       g_supplicant_set_ins_settings(preferred_freq,
+               connman_setting_get_bool("INSLastConnectedBSSID"),
+               connman_setting_get_bool("INSAssocReject"),
+               connman_setting_get_bool("INSSignalBSSID"),
+               connman_setting_get_uint("INSPreferredFreqBSSIDScore"),
+               connman_setting_get_uint("INSLastConnectedBSSIDScore"),
+               connman_setting_get_uint("INSAssocRejectScore"),
+               connman_setting_get_int("INSSignalLevel3_5GHz"),
+               connman_setting_get_int("INSSignalLevel3_24GHz")
+       );
+}
+#endif
+
 static struct connman_technology_driver tech_driver = {
        .name           = "wifi",
        .type           = CONNMAN_SERVICE_TYPE_WIFI,
@@ -5736,6 +6189,10 @@ static int wifi_init(void)
 #if defined TIZEN_EXT
        failed_bssids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
 #endif
+
+#if defined TIZEN_EXT
+       supp_ins_init();
+#endif
        return 0;
 }