]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Add private function support
authorDmitry Shmidt <dimitrysh@google.com>
Thu, 7 Jul 2011 21:22:14 +0000 (14:22 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 24 Nov 2013 20:46:38 +0000 (22:46 +0200)
Change-Id: Iba9b2ac21f5c7760900c57826b7048ee58928338
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
src/drivers/driver_nl80211.c

index 64ab29a6356e7aacc6842fe1f1d701af784dfda2..258a792f65a1b76965b9f4e86d7e68990a50463b 100644 (file)
@@ -362,8 +362,6 @@ static int wpa_driver_nl80211_probe_req_report(struct i802_bss *bss,
 static int android_pno_start(struct i802_bss *bss,
                             struct wpa_driver_scan_params *params);
 static int android_pno_stop(struct i802_bss *bss);
-extern int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
-                                        size_t buf_len);
 #endif /* ANDROID */
 #ifdef ANDROID_P2P
 int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
@@ -10937,6 +10935,39 @@ static int android_pno_stop(struct i802_bss *bss)
        return android_priv_cmd(bss, "PNOFORCE 0");
 }
 
+
+static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
+                                        size_t buf_len)
+{
+       struct i802_bss *bss = priv;
+       struct wpa_driver_nl80211_data *drv = bss->drv;
+       int ret = 0;
+
+       if (os_strcasecmp(cmd, "STOP") == 0) {
+               linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
+               wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STOPPED");
+       } else if (os_strcasecmp(cmd, "START") == 0) {
+               linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1);
+               wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STARTED");
+       } else if (os_strcasecmp(cmd, "MACADDR") == 0) {
+               u8 macaddr[ETH_ALEN] = {};
+
+               ret = linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
+                                        macaddr);
+               if (!ret)
+                       ret = os_snprintf(buf, buf_len,
+                                         "Macaddr = " MACSTR "\n",
+                                         MAC2STR(macaddr));
+       } else if (os_strcasecmp(cmd, "RELOAD") == 0) {
+               wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
+       } else {
+               wpa_printf(MSG_ERROR, "Unsupported command: %s", cmd);
+               ret = -1;
+       }
+
+       return ret;
+}
+
 #endif /* ANDROID */