extern void connman_iface_indicate_configured(struct connman_iface *iface);
extern void connman_iface_indicate_station(struct connman_iface *iface,
- const char *name, int strength);
+ const char *name, int strength, int security);
extern int connman_iface_get_ipv4(struct connman_iface *iface,
struct connman_ipv4 *ipv4);
int wpa_ie_len;
unsigned char rsn_ie[40];
int rsn_ie_len;
+
+ int has_wep;
+ int has_wpa;
+ int has_rsn;
};
struct iface_data {
static void report_station(struct connman_iface *iface,
struct station_data *station)
{
+ int security = 0;
+
if (station == NULL)
return;
if (station->name == NULL)
return;
- connman_iface_indicate_station(iface, station->name, station->qual);
+ if (station->has_wep)
+ security |= 0x01;
+ if (station->has_wpa)
+ security |= 0x02;
+ if (station->has_rsn)
+ security |= 0x04;
+
+ connman_iface_indicate_station(iface, station->name,
+ station->qual, security);
}
static struct station_data *create_station(struct iface_data *iface,
// station->address, station->mode,
// station->name, station->qual);
+ if (station->name == NULL)
+ continue;
+
g_key_file_set_string(keyfile, station->address,
"Name", station->name);
switch (data[offset]) {
case 0xdd: /* WPA1 (and other) */
+ station->has_wpa = 1;
break;
case 0x30: /* WPA2 (RSN) */
+ station->has_rsn = 1;
break;
default:
break;
break;
case SIOCGIWENCODE:
if (station != NULL) {
- if (!(event->u.data.flags & IW_ENCODE_DISABLED)) {
- /* privacy */
- }
+ if (!(event->u.data.flags & IW_ENCODE_DISABLED))
+ station->has_wep = 1;
}
break;
case SIOCGIWRATE:
}
}
-static void append_station(DBusMessage *reply, const char *name, int signal)
+static void append_station(DBusMessage *reply, const char *name,
+ int signal, int security)
{
DBusMessageIter array, dict;
+ const char *wpa = "WPA";
dbus_message_iter_init_append(reply, &array);
append_entry(&dict, "ESSID", DBUS_TYPE_STRING, &name);
append_entry(&dict, "Signal", DBUS_TYPE_UINT16, &signal);
+ if (security > 0)
+ append_entry(&dict, "Security", DBUS_TYPE_STRING, &wpa);
+
dbus_message_iter_close_container(&array, &dict);
}
void connman_iface_indicate_station(struct connman_iface *iface,
- const char *name, int strength)
+ const char *name, int strength, int security)
{
DBusMessage *signal;
- DBG("iface %p name %s", iface, name);
+ DBG("iface %p security %d name %s", iface, security, name);
+
+ if (name == NULL || strlen(name) == 0)
+ return;
signal = dbus_message_new_signal(iface->path,
CONNMAN_IFACE_INTERFACE, "NetworkFound");
if (signal == NULL)
return;
- append_station(signal, name, strength);
+ append_station(signal, name, strength, security);
dbus_connection_send(connection, signal, NULL);
dbus_message_unref(signal);