From 1b1d534babf1e9d26d8936f6f547e918b63ff1c4 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 22 Feb 2011 16:52:41 +0100 Subject: [PATCH] network: Remove address field The address network field holds the WiFi BSSID but is unused. --- include/network.h | 2 -- plugins/wifi.c | 44 -------------------------------------------- src/network.c | 46 ++-------------------------------------------- 3 files changed, 2 insertions(+), 90 deletions(-) diff --git a/include/network.h b/include/network.h index 6b93f16..a077fde 100644 --- a/include/network.h +++ b/include/network.h @@ -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, diff --git a/plugins/wifi.c b/plugins/wifi.c index b943a25..8374506 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -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; diff --git a/src/network.c b/src/network.c index adeba79..58cb5a8 100644 --- a/src/network.c +++ b/src/network.c @@ -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; @@ -1192,38 +1190,6 @@ int __connman_network_set_ipconfig(struct connman_network *network, } /** - * 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 * @name: name value @@ -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); -- 2.7.4