From d306df7919e75a92850a0214f9791c8e5c5619de Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 28 Nov 2014 09:32:32 +0100 Subject: [PATCH] wext: Add very basic status command support Just to make the test framework happy, it uses the driver status command to obtain the interface MAC address. Signed-off-by: Johannes Berg --- src/drivers/driver_wext.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c index 50aa52081..428808d7c 100644 --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -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, };