[Fix][src/service] Add 'fall through' comment when break statement is not needed
[platform/upstream/connman.git] / src / network.c
index f1183b3..636da18 100755 (executable)
@@ -140,6 +140,10 @@ struct connman_network {
 #if defined TIZEN_EXT
                unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX];
                GHashTable *assoc_reject_table;
+               bool owe_transition_mode;
+               void *transition_mode_ssid;
+               int transition_mode_ssid_len;
+               unsigned char transition_mode_bssid[WIFI_BSSID_LEN_MAX];
 #endif
        } wifi;
 
@@ -731,6 +735,10 @@ static int dhcpv6_set_addresses(struct connman_network *network)
        network->connecting = false;
 
        ipconfig_ipv6 = __connman_service_get_ip6config(service);
+#if defined TIZEN_EXT
+       if (!ipconfig_ipv6)
+               goto err;
+#endif
        err = __connman_ipconfig_address_add(ipconfig_ipv6);
        if (err < 0)
                goto err;
@@ -1730,6 +1738,13 @@ static gboolean __connman_network_clear_associating_delayed(gpointer user_data)
 }
 #endif
 
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+bool connman_network_check_validity(struct connman_network *network)
+{
+       return (NULL == g_slist_find(network_list, network)) ? false : true;
+}
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
 /**
  * connman_network_set_associating:
  * @network: network structure
@@ -2069,6 +2084,18 @@ int __connman_network_connect(struct connman_network *network)
                return err;
        }
 
+#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
+       /*
+        * Note: If EAP on Ethernet is ON, then network will be connected
+        * after EAP Success event is recieved, from plugin/ethernet.c
+        */
+       struct connman_service *service = connman_service_lookup_from_network(network);
+       if (service && __connman_service_get_use_eapol(service)) {
+               connman_network_set_associating(network, true);
+               return 0;
+       }
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
+
        set_connected(network);
 
        return err;
@@ -2330,6 +2357,41 @@ unsigned char *connman_network_get_bssid(struct connman_network *network)
        return (unsigned char *)network->wifi.bssid;
 }
 
+int connman_network_set_transition_mode_bssid(struct connman_network *network,
+                               const unsigned char *transition_mode_bssid)
+{
+       int i = 0;
+
+       if (transition_mode_bssid == NULL)
+               return -EINVAL;
+
+       for (;i < WIFI_BSSID_LEN_MAX;i++)
+               network->wifi.transition_mode_bssid[i] = transition_mode_bssid[i];
+
+       return 0;
+}
+
+unsigned char *connman_network_get_transition_mode_bssid(struct connman_network *network)
+{
+       return (unsigned char *)network->wifi.transition_mode_bssid;
+}
+
+bool connman_network_check_transition_mode(struct connman_network *network1, struct connman_network *network2)
+{
+
+       if (network1 == NULL || network2 == NULL)
+               return FALSE;
+
+       if (network1->wifi.owe_transition_mode == FALSE || network2->wifi.owe_transition_mode == FALSE)
+               return FALSE;
+
+       if ((memcmp(network1->wifi.bssid, network2->wifi.transition_mode_bssid, WIFI_BSSID_LEN_MAX) == 0)
+               && (memcmp(network1->wifi.transition_mode_bssid, network2->wifi.bssid, WIFI_BSSID_LEN_MAX) == 0))
+               return TRUE;
+       else
+               return FALSE;
+}
+
 int connman_network_set_maxspeed(struct connman_network *network,
                                 int maxspeed)
 {
@@ -2866,6 +2928,8 @@ int connman_network_set_bool(struct connman_network *network,
                network->default_internet = value;
        else if (g_strcmp0(key, "WiFi.HS20AP") == 0)
                network->wifi.isHS20AP = value;
+       else if (g_strcmp0(key, "WiFi.TRANSITION_MODE") == 0)
+               network->wifi.owe_transition_mode = value;
 #endif
 
        return -EINVAL;
@@ -2894,6 +2958,8 @@ bool connman_network_get_bool(struct connman_network *network,
                return network->default_internet;
        else if (g_str_equal(key, "WiFi.HS20AP"))
                return network->wifi.isHS20AP;
+       else if (g_strcmp0(key, "WiFi.TRANSITION_MODE"))
+               return network->wifi.owe_transition_mode;
 #endif
 
        return false;
@@ -2945,6 +3011,16 @@ int connman_network_set_blob(struct connman_network *network,
                        network->wifi.ssid_len = size;
                } else
                        network->wifi.ssid_len = 0;
+#ifdef TIZEN_EXT
+       } else if (g_str_equal(key, "WiFi.TRANSITION_MODE_SSID")) {
+               g_free(network->wifi.transition_mode_ssid);
+               network->wifi.transition_mode_ssid = g_try_malloc(size);
+               if (network->wifi.transition_mode_ssid) {
+                       memcpy(network->wifi.transition_mode_ssid, data, size);
+                       network->wifi.transition_mode_ssid_len = size;
+               } else
+                       network->wifi.transition_mode_ssid_len = 0;
+#endif
        } else {
                return -EINVAL;
        }
@@ -2967,8 +3043,13 @@ const void *connman_network_get_blob(struct connman_network *network,
                if (size)
                        *size = network->wifi.ssid_len;
                return network->wifi.ssid;
+#ifdef TIZEN_EXT
+       } else if (g_str_equal(key, "WiFi.TRANSITION_MODE_SSID")) {
+               if (size)
+                       *size = network->wifi.transition_mode_ssid_len;
+               return network->wifi.transition_mode_ssid;
+#endif
        }
-
        return NULL;
 }