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;
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);
/* 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;
connman_uint8_t strength;
connman_uint16_t frequency;
char *identifier;
- char *address;
char *name;
char *node;
char *group;
g_free(network->group);
g_free(network->node);
g_free(network->name);
- g_free(network->address);
g_free(network->identifier);
network->device = NULL;
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
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) {
{
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;
{
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);