]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wext: Add very basic status command support
authorJohannes Berg <johannes.berg@intel.com>
Fri, 28 Nov 2014 08:32:32 +0000 (09:32 +0100)
committerJouni Malinen <j@w1.fi>
Fri, 28 Nov 2014 21:02:29 +0000 (23:02 +0200)
Just to make the test framework happy, it uses the driver
status command to obtain the interface MAC address.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
src/drivers/driver_wext.c

index 50aa52081eeb865ce569efdcb8a212e5a5e9b002..428808d7cdbd1b4b560789c8996caf7804e2d0e2 100644 (file)
@@ -2353,6 +2353,33 @@ static int wpa_driver_wext_signal_poll(void *priv, struct wpa_signal_info *si)
 }
 
 
+static int wpa_driver_wext_status(void *priv, char *buf, size_t buflen)
+{
+       struct wpa_driver_wext_data *drv = priv;
+       int res;
+       char *pos, *end;
+       unsigned char addr[ETH_ALEN];
+
+       pos = buf;
+       end = buf + buflen;
+
+       if (linux_get_ifhwaddr(drv->ioctl_sock, drv->ifname, addr))
+               return -1;
+
+       res = os_snprintf(pos, end - pos,
+                         "ifindex=%d\n"
+                         "ifname=%s\n"
+                         "addr=" MACSTR "\n",
+                         drv->ifindex,
+                         drv->ifname,
+                         MAC2STR(addr));
+       if (res < 0 || res >= end - pos)
+               return pos - buf;
+       pos += res;
+
+       return pos - buf;
+}
+
 const struct wpa_driver_ops wpa_driver_wext_ops = {
        .name = "wext",
        .desc = "Linux wireless extensions (generic)",
@@ -2373,4 +2400,5 @@ const struct wpa_driver_ops wpa_driver_wext_ops = {
        .set_operstate = wpa_driver_wext_set_operstate,
        .get_radio_name = wext_get_radio_name,
        .signal_poll = wpa_driver_wext_signal_poll,
+       .status = wpa_driver_wext_status,
 };