• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Driver interaction with extended Linux CFG8021
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * Alternatively, this software may be distributed under the terms of BSD
9  * license.
10  */
11 
12 #include "includes.h"
13 
14 #include <stddef.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <netinet/in.h>
19 #include <linux/if.h>
20 
21 #include "common.h"
22 #include "wpa_supplicant_i.h"
23 #include "driver_nl80211.h"
24 #include "config.h"
25 #include "android_drv.h"
26 #include "linux_ioctl.h"
27 
28 #define UNUSED_ARG __attribute__((__unused__))
29 
wpa_driver_nl80211_driver_cmd(void * priv,char * cmd,char * buf,size_t buf_len)30 int wpa_driver_nl80211_driver_cmd(
31     void* priv, char* cmd, char* buf, size_t buf_len) {
32   struct i802_bss* bss = priv;
33   struct wpa_driver_nl80211_data* drv = bss->drv;
34   int ret = 0;
35 
36   if (os_strcasecmp(cmd, "STOP") == 0) {
37     linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
38     wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STOPPED");
39   } else if (os_strcasecmp(cmd, "START") == 0) {
40     linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1);
41     wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STARTED");
42   } else if (os_strcasecmp(cmd, "MACADDR") == 0) {
43     u8 macaddr[ETH_ALEN] = {};
44 
45     ret = linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, macaddr);
46     if (!ret)
47       ret = os_snprintf(
48           buf, buf_len, "Macaddr = " MACSTR "\n", MAC2STR(macaddr));
49   } else if (os_strcasecmp(cmd, "RELOAD") == 0) {
50     wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
51   } else {  // Use private command
52     return 0;
53   }
54   return ret;
55 }
56 
wpa_driver_set_p2p_noa(UNUSED_ARG void * priv,UNUSED_ARG u8 count,UNUSED_ARG int start,UNUSED_ARG int duration)57 int wpa_driver_set_p2p_noa(
58         UNUSED_ARG void* priv,
59         UNUSED_ARG u8 count,
60         UNUSED_ARG int start,
61         UNUSED_ARG int duration) {
62   return 0;
63 }
64 
wpa_driver_get_p2p_noa(UNUSED_ARG void * priv,UNUSED_ARG u8 * buf,UNUSED_ARG size_t len)65 int wpa_driver_get_p2p_noa(
66         UNUSED_ARG void* priv,
67         UNUSED_ARG u8* buf,
68         UNUSED_ARG size_t len) {
69   return 0;
70 }
71 
wpa_driver_set_p2p_ps(UNUSED_ARG void * priv,UNUSED_ARG int legacy_ps,UNUSED_ARG int opp_ps,UNUSED_ARG int ctwindow)72 int wpa_driver_set_p2p_ps(
73         UNUSED_ARG void* priv,
74         UNUSED_ARG int legacy_ps,
75         UNUSED_ARG int opp_ps,
76         UNUSED_ARG int ctwindow) {
77   return -1;
78 }
79 
wpa_driver_set_ap_wps_p2p_ie(UNUSED_ARG void * priv,UNUSED_ARG const struct wpabuf * beacon,UNUSED_ARG const struct wpabuf * proberesp,UNUSED_ARG const struct wpabuf * assocresp)80 int wpa_driver_set_ap_wps_p2p_ie(
81         UNUSED_ARG void* priv,
82         UNUSED_ARG const struct wpabuf* beacon,
83         UNUSED_ARG const struct wpabuf* proberesp,
84         UNUSED_ARG const struct wpabuf* assocresp) {
85   return 0;
86 }
87