network: Remove address field
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 22 Feb 2011 15:52:41 +0000 (16:52 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 23 Feb 2011 17:37:07 +0000 (18:37 +0100)
The address network field holds the WiFi BSSID but is unused.

include/network.h
plugins/wifi.c
src/network.c

index 6b93f1695bee6038f8d9777470af30871b440352..a077fde9e70a3b2f899abacd534caed3ddad6c31 100644 (file)
@@ -96,8 +96,6 @@ void connman_network_set_ipv4_method(struct connman_network *network,
 void connman_network_set_ipv6_method(struct connman_network *network,
                                        enum connman_ipconfig_method method);
 
-int connman_network_set_address(struct connman_network *network,
-                               const void *address, unsigned int size);
 int connman_network_set_name(struct connman_network *network,
                                                        const char *name);
 int connman_network_set_strength(struct connman_network *network,
index b943a2584c6ad12b8cede9a9fdec5036caab0630..83745064ff48cd1efad8a34710642c6e21845041 100644 (file)
@@ -73,45 +73,6 @@ struct wifi_data {
 
 static GList *iface_list = NULL;
 
-static int get_bssid(struct connman_device *device,
-                               unsigned char *bssid, unsigned int *bssid_len)
-{
-       struct iwreq wrq;
-       char *ifname;
-       int ifindex;
-       int fd, err;
-
-       ifindex = connman_device_get_index(device);
-       if (ifindex < 0)
-               return -EINVAL;
-
-       ifname = connman_inet_ifname(ifindex);
-       if (ifname == NULL)
-               return -EINVAL;
-
-       fd = socket(PF_INET, SOCK_DGRAM, 0);
-       if (fd < 0) {
-               g_free(ifname);
-               return -EINVAL;
-       }
-
-       memset(&wrq, 0, sizeof(wrq));
-       strncpy(wrq.ifr_name, ifname, IFNAMSIZ);
-
-       err = ioctl(fd, SIOCGIWAP, &wrq);
-
-       g_free(ifname);
-       close(fd);
-
-       if (err < 0)
-               return -EIO;
-
-       memcpy(bssid, wrq.u.ap_addr.sa_data, ETH_ALEN);
-       *bssid_len = ETH_ALEN;
-
-       return 0;
-}
-
 static void wifi_newlink(unsigned flags, unsigned change, void *user_data)
 {
        struct connman_device *device = user_data;
@@ -640,8 +601,6 @@ static void interface_state(GSupplicantInterface *interface)
        struct connman_device *device;
        struct wifi_data *wifi;
        GSupplicantState state = g_supplicant_interface_get_state(interface);
-       unsigned char bssid[ETH_ALEN];
-       unsigned int bssid_len;
        connman_bool_t wps;
 
        wifi = g_supplicant_interface_get_data(interface);
@@ -674,9 +633,6 @@ static void interface_state(GSupplicantInterface *interface)
                /* reset scan trigger and schedule background scan */
                connman_device_schedule_scan(device);
 
-               if (get_bssid(device, bssid, &bssid_len) == 0)
-                       connman_network_set_address(network,
-                                                       bssid, bssid_len);
                connman_network_set_connected(network, TRUE);
                break;
 
index adeba7929cc931bf91911e49b157dbe32f1fa46e..58cb5a846af7d12d8ed612fab9c820afa8ed8c72 100644 (file)
@@ -40,7 +40,6 @@ struct connman_network {
        connman_uint8_t strength;
        connman_uint16_t frequency;
        char *identifier;
-       char *address;
        char *name;
        char *node;
        char *group;
@@ -176,7 +175,6 @@ static void network_destruct(struct connman_element *element)
        g_free(network->group);
        g_free(network->node);
        g_free(network->name);
-       g_free(network->address);
        g_free(network->identifier);
 
        network->device = NULL;
@@ -1191,38 +1189,6 @@ int __connman_network_set_ipconfig(struct connman_network *network,
        return 0;
 }
 
-/**
- * connman_network_set_address:
- * @network: network structure
- * @address: binary address value
- * @size: binary address length
- *
- * Set unique address value for network
- */
-int connman_network_set_address(struct connman_network *network,
-                               const void *address, unsigned int size)
-{
-       const unsigned char *addr_octet = address;
-       char *str;
-
-       DBG("network %p size %d", network, size);
-
-       if (size != 6)
-               return -EINVAL;
-
-       str = g_strdup_printf("%02X:%02X:%02X:%02X:%02X:%02X",
-                               addr_octet[0], addr_octet[1], addr_octet[2],
-                               addr_octet[3], addr_octet[4], addr_octet[5]);
-       if (str == NULL)
-               return -ENOMEM;
-
-       g_free(network->address);
-       network->address = str;
-
-       return connman_element_set_string(&network->element,
-                                               "Address", network->address);
-}
-
 /**
  * connman_network_set_name:
  * @network: network structure
@@ -1295,10 +1261,7 @@ int connman_network_set_string(struct connman_network *network,
        if (g_strcmp0(key, "Name") == 0)
                return connman_network_set_name(network, value);
 
-       if (g_str_equal(key, "Address") == TRUE) {
-               g_free(network->address);
-               network->address = g_strdup(value);
-       } else if (g_str_equal(key, "Node") == TRUE) {
+       if (g_str_equal(key, "Node") == TRUE) {
                g_free(network->node);
                network->node = g_strdup(value);
        } else if (g_str_equal(key, "WiFi.Mode") == TRUE) {
@@ -1361,9 +1324,7 @@ const char *connman_network_get_string(struct connman_network *network,
 {
        DBG("network %p key %s", network, key);
 
-       if (g_str_equal(key, "Address") == TRUE)
-               return network->address;
-       else if (g_str_equal(key, "Name") == TRUE)
+       if (g_str_equal(key, "Name") == TRUE)
                return network->name;
        else if (g_str_equal(key, "Node") == TRUE)
                return network->node;
@@ -1530,9 +1491,6 @@ int connman_network_set_blob(struct connman_network *network,
 {
        DBG("network %p key %s size %d", network, key, size);
 
-       if (g_strcmp0(key, "Address") == 0)
-               return connman_network_set_address(network, data, size);
-
        if (g_str_equal(key, "WiFi.SSID") == TRUE) {
                g_free(network->wifi.ssid);
                network->wifi.ssid = g_try_malloc(size);