Remove old files
This commit is contained in:
parent
bef31786ce
commit
938f73cd80
@ -1,58 +0,0 @@
|
||||
#ifndef __IEEE802_11_HEADER__
|
||||
#define __IEEE802_11_HEADER__
|
||||
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/* */
|
||||
typedef uint64_t u64;
|
||||
typedef uint32_t u32;
|
||||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
typedef int64_t s64;
|
||||
typedef int32_t s32;
|
||||
typedef int16_t s16;
|
||||
typedef int8_t s8;
|
||||
|
||||
/* */
|
||||
typedef u16 be16;
|
||||
typedef u16 le16;
|
||||
typedef u32 be32;
|
||||
typedef u32 le32;
|
||||
typedef u64 be64;
|
||||
typedef u64 le64;
|
||||
|
||||
/* */
|
||||
#define STRUCT_PACKED __attribute__ ((packed))
|
||||
|
||||
#ifndef ETH_ALEN
|
||||
#define ETH_ALEN 6
|
||||
#endif
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
#ifndef ETH_P_ALL
|
||||
#define ETH_P_ALL 0x0003
|
||||
#endif
|
||||
#ifndef ETH_P_80211_ENCAP
|
||||
#define ETH_P_80211_ENCAP 0x890d /* TDLS comes under this category */
|
||||
#endif
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif
|
||||
#ifndef ETH_P_EAPOL
|
||||
#define ETH_P_EAPOL ETH_P_PAE
|
||||
#endif
|
||||
#ifndef ETH_P_RSN_PREAUTH
|
||||
#define ETH_P_RSN_PREAUTH 0x88c7
|
||||
#endif
|
||||
#ifndef ETH_P_RRB
|
||||
#define ETH_P_RRB 0x890D
|
||||
#endif
|
||||
|
||||
/* */
|
||||
#include "ieee802_11_defs.h"
|
||||
#include "ieee802_11_common.h"
|
||||
|
||||
#endif /* __IEEE802_11_HEADER__ */
|
@ -1,483 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 Common routines
|
||||
* Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "ieee802_11.h"
|
||||
|
||||
static int ieee802_11_parse_vendor_specific(const u8 *pos, size_t elen,
|
||||
struct ieee802_11_elems *elems,
|
||||
int show_errors)
|
||||
{
|
||||
unsigned int oui;
|
||||
|
||||
/* first 3 bytes in vendor specific information element are the IEEE
|
||||
* OUI of the vendor. The following byte is used a vendor specific
|
||||
* sub-type. */
|
||||
if (elen < 4) {
|
||||
if (show_errors) {
|
||||
wpa_printf(MSG_MSGDUMP, "short vendor specific "
|
||||
"information element ignored (len=%lu)",
|
||||
(unsigned long) elen);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
oui = WPA_GET_BE24(pos);
|
||||
switch (oui) {
|
||||
case OUI_MICROSOFT:
|
||||
/* Microsoft/Wi-Fi information elements are further typed and
|
||||
* subtyped */
|
||||
switch (pos[3]) {
|
||||
case 1:
|
||||
/* Microsoft OUI (00:50:F2) with OUI Type 1:
|
||||
* real WPA information element */
|
||||
elems->wpa_ie = pos;
|
||||
elems->wpa_ie_len = elen;
|
||||
break;
|
||||
case WMM_OUI_TYPE:
|
||||
/* WMM information element */
|
||||
if (elen < 5) {
|
||||
wpa_printf(MSG_MSGDUMP, "short WMM "
|
||||
"information element ignored "
|
||||
"(len=%lu)",
|
||||
(unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
switch (pos[4]) {
|
||||
case WMM_OUI_SUBTYPE_INFORMATION_ELEMENT:
|
||||
case WMM_OUI_SUBTYPE_PARAMETER_ELEMENT:
|
||||
/*
|
||||
* Share same pointer since only one of these
|
||||
* is used and they start with same data.
|
||||
* Length field can be used to distinguish the
|
||||
* IEs.
|
||||
*/
|
||||
elems->wmm = pos;
|
||||
elems->wmm_len = elen;
|
||||
break;
|
||||
case WMM_OUI_SUBTYPE_TSPEC_ELEMENT:
|
||||
elems->wmm_tspec = pos;
|
||||
elems->wmm_tspec_len = elen;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_EXCESSIVE, "unknown WMM "
|
||||
"information element ignored "
|
||||
"(subtype=%d len=%lu)",
|
||||
pos[4], (unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
/* Wi-Fi Protected Setup (WPS) IE */
|
||||
elems->wps_ie = pos;
|
||||
elems->wps_ie_len = elen;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_EXCESSIVE, "Unknown Microsoft "
|
||||
"information element ignored "
|
||||
"(type=%d len=%lu)",
|
||||
pos[3], (unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OUI_WFA:
|
||||
switch (pos[3]) {
|
||||
case P2P_OUI_TYPE:
|
||||
/* Wi-Fi Alliance - P2P IE */
|
||||
elems->p2p = pos;
|
||||
elems->p2p_len = elen;
|
||||
break;
|
||||
case WFD_OUI_TYPE:
|
||||
/* Wi-Fi Alliance - WFD IE */
|
||||
elems->wfd = pos;
|
||||
elems->wfd_len = elen;
|
||||
break;
|
||||
case HS20_INDICATION_OUI_TYPE:
|
||||
/* Hotspot 2.0 */
|
||||
elems->hs20 = pos;
|
||||
elems->hs20_len = elen;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_MSGDUMP, "Unknown WFA "
|
||||
"information element ignored "
|
||||
"(type=%d len=%lu)\n",
|
||||
pos[3], (unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OUI_BROADCOM:
|
||||
switch (pos[3]) {
|
||||
case VENDOR_HT_CAPAB_OUI_TYPE:
|
||||
elems->vendor_ht_cap = pos;
|
||||
elems->vendor_ht_cap_len = elen;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_EXCESSIVE, "Unknown Broadcom "
|
||||
"information element ignored "
|
||||
"(type=%d len=%lu)",
|
||||
pos[3], (unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
wpa_printf(MSG_EXCESSIVE, "unknown vendor specific "
|
||||
"information element ignored (vendor OUI "
|
||||
"%02x:%02x:%02x len=%lu)",
|
||||
pos[0], pos[1], pos[2], (unsigned long) elen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ieee802_11_parse_elems - Parse information elements in management frames
|
||||
* @start: Pointer to the start of IEs
|
||||
* @len: Length of IE buffer in octets
|
||||
* @elems: Data structure for parsed elements
|
||||
* @show_errors: Whether to show parsing errors in debug log
|
||||
* Returns: Parsing result
|
||||
*/
|
||||
ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
|
||||
struct ieee802_11_elems *elems,
|
||||
int show_errors)
|
||||
{
|
||||
size_t left = len;
|
||||
const u8 *pos = start;
|
||||
int unknown = 0;
|
||||
|
||||
os_memset(elems, 0, sizeof(*elems));
|
||||
|
||||
while (left >= 2) {
|
||||
u8 id, elen;
|
||||
|
||||
id = *pos++;
|
||||
elen = *pos++;
|
||||
left -= 2;
|
||||
|
||||
if (elen > left) {
|
||||
if (show_errors) {
|
||||
wpa_printf(MSG_DEBUG, "IEEE 802.11 element "
|
||||
"parse failed (id=%d elen=%d "
|
||||
"left=%lu)",
|
||||
id, elen, (unsigned long) left);
|
||||
wpa_hexdump(MSG_MSGDUMP, "IEs", start, len);
|
||||
}
|
||||
return ParseFailed;
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
case WLAN_EID_SSID:
|
||||
elems->ssid = pos;
|
||||
elems->ssid_len = elen;
|
||||
break;
|
||||
case WLAN_EID_SUPP_RATES:
|
||||
elems->supp_rates = pos;
|
||||
elems->supp_rates_len = elen;
|
||||
break;
|
||||
case WLAN_EID_FH_PARAMS:
|
||||
elems->fh_params = pos;
|
||||
elems->fh_params_len = elen;
|
||||
break;
|
||||
case WLAN_EID_DS_PARAMS:
|
||||
elems->ds_params = pos;
|
||||
elems->ds_params_len = elen;
|
||||
break;
|
||||
case WLAN_EID_CF_PARAMS:
|
||||
elems->cf_params = pos;
|
||||
elems->cf_params_len = elen;
|
||||
break;
|
||||
case WLAN_EID_TIM:
|
||||
elems->tim = pos;
|
||||
elems->tim_len = elen;
|
||||
break;
|
||||
case WLAN_EID_IBSS_PARAMS:
|
||||
elems->ibss_params = pos;
|
||||
elems->ibss_params_len = elen;
|
||||
break;
|
||||
case WLAN_EID_CHALLENGE:
|
||||
elems->challenge = pos;
|
||||
elems->challenge_len = elen;
|
||||
break;
|
||||
case WLAN_EID_ERP_INFO:
|
||||
elems->erp_info = pos;
|
||||
elems->erp_info_len = elen;
|
||||
break;
|
||||
case WLAN_EID_EXT_SUPP_RATES:
|
||||
elems->ext_supp_rates = pos;
|
||||
elems->ext_supp_rates_len = elen;
|
||||
break;
|
||||
case WLAN_EID_VENDOR_SPECIFIC:
|
||||
if (ieee802_11_parse_vendor_specific(pos, elen,
|
||||
elems,
|
||||
show_errors))
|
||||
unknown++;
|
||||
break;
|
||||
case WLAN_EID_RSN:
|
||||
elems->rsn_ie = pos;
|
||||
elems->rsn_ie_len = elen;
|
||||
break;
|
||||
case WLAN_EID_PWR_CAPABILITY:
|
||||
elems->power_cap = pos;
|
||||
elems->power_cap_len = elen;
|
||||
break;
|
||||
case WLAN_EID_SUPPORTED_CHANNELS:
|
||||
elems->supp_channels = pos;
|
||||
elems->supp_channels_len = elen;
|
||||
break;
|
||||
case WLAN_EID_MOBILITY_DOMAIN:
|
||||
elems->mdie = pos;
|
||||
elems->mdie_len = elen;
|
||||
break;
|
||||
case WLAN_EID_FAST_BSS_TRANSITION:
|
||||
elems->ftie = pos;
|
||||
elems->ftie_len = elen;
|
||||
break;
|
||||
case WLAN_EID_TIMEOUT_INTERVAL:
|
||||
elems->timeout_int = pos;
|
||||
elems->timeout_int_len = elen;
|
||||
break;
|
||||
case WLAN_EID_HT_CAP:
|
||||
elems->ht_capabilities = pos;
|
||||
elems->ht_capabilities_len = elen;
|
||||
break;
|
||||
case WLAN_EID_HT_OPERATION:
|
||||
elems->ht_operation = pos;
|
||||
elems->ht_operation_len = elen;
|
||||
break;
|
||||
case WLAN_EID_VHT_CAP:
|
||||
elems->vht_capabilities = pos;
|
||||
elems->vht_capabilities_len = elen;
|
||||
break;
|
||||
case WLAN_EID_VHT_OPERATION:
|
||||
elems->vht_operation = pos;
|
||||
elems->vht_operation_len = elen;
|
||||
break;
|
||||
case WLAN_EID_LINK_ID:
|
||||
if (elen < 18)
|
||||
break;
|
||||
elems->link_id = pos;
|
||||
break;
|
||||
case WLAN_EID_INTERWORKING:
|
||||
elems->interworking = pos;
|
||||
elems->interworking_len = elen;
|
||||
break;
|
||||
case WLAN_EID_EXT_CAPAB:
|
||||
elems->ext_capab = pos;
|
||||
elems->ext_capab_len = elen;
|
||||
break;
|
||||
case WLAN_EID_BSS_MAX_IDLE_PERIOD:
|
||||
if (elen < 3)
|
||||
break;
|
||||
elems->bss_max_idle_period = pos;
|
||||
break;
|
||||
case WLAN_EID_SSID_LIST:
|
||||
elems->ssid_list = pos;
|
||||
elems->ssid_list_len = elen;
|
||||
break;
|
||||
default:
|
||||
unknown++;
|
||||
if (!show_errors)
|
||||
break;
|
||||
wpa_printf(MSG_MSGDUMP, "IEEE 802.11 element parse "
|
||||
"ignored unknown element (id=%d elen=%d)",
|
||||
id, elen);
|
||||
break;
|
||||
}
|
||||
|
||||
left -= elen;
|
||||
pos += elen;
|
||||
}
|
||||
|
||||
if (left)
|
||||
return ParseFailed;
|
||||
|
||||
return unknown ? ParseUnknown : ParseOK;
|
||||
}
|
||||
|
||||
|
||||
int ieee802_11_ie_count(const u8 *ies, size_t ies_len)
|
||||
{
|
||||
int count = 0;
|
||||
const u8 *pos, *end;
|
||||
|
||||
if (ies == NULL)
|
||||
return 0;
|
||||
|
||||
pos = ies;
|
||||
end = ies + ies_len;
|
||||
|
||||
while (pos + 2 <= end) {
|
||||
if (pos + 2 + pos[1] > end)
|
||||
break;
|
||||
count++;
|
||||
pos += 2 + pos[1];
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
|
||||
u32 oui_type)
|
||||
{
|
||||
struct wpabuf *buf;
|
||||
const u8 *end, *pos, *ie;
|
||||
|
||||
pos = ies;
|
||||
end = ies + ies_len;
|
||||
ie = NULL;
|
||||
|
||||
while (pos + 1 < end) {
|
||||
if (pos + 2 + pos[1] > end)
|
||||
return NULL;
|
||||
if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
|
||||
WPA_GET_BE32(&pos[2]) == oui_type) {
|
||||
ie = pos;
|
||||
break;
|
||||
}
|
||||
pos += 2 + pos[1];
|
||||
}
|
||||
|
||||
if (ie == NULL)
|
||||
return NULL; /* No specified vendor IE found */
|
||||
|
||||
buf = wpabuf_alloc(ies_len);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* There may be multiple vendor IEs in the message, so need to
|
||||
* concatenate their data fields.
|
||||
*/
|
||||
while (pos + 1 < end) {
|
||||
if (pos + 2 + pos[1] > end)
|
||||
break;
|
||||
if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
|
||||
WPA_GET_BE32(&pos[2]) == oui_type)
|
||||
wpabuf_put_data(buf, pos + 6, pos[1] - 4);
|
||||
pos += 2 + pos[1];
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len)
|
||||
{
|
||||
u16 fc, type, stype;
|
||||
|
||||
/*
|
||||
* PS-Poll frames are 16 bytes. All other frames are
|
||||
* 24 bytes or longer.
|
||||
*/
|
||||
if (len < 16)
|
||||
return NULL;
|
||||
|
||||
fc = le_to_host16(hdr->frame_control);
|
||||
type = WLAN_FC_GET_TYPE(fc);
|
||||
stype = WLAN_FC_GET_STYPE(fc);
|
||||
|
||||
switch (type) {
|
||||
case WLAN_FC_TYPE_DATA:
|
||||
if (len < 24)
|
||||
return NULL;
|
||||
switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) {
|
||||
case WLAN_FC_FROMDS | WLAN_FC_TODS:
|
||||
case WLAN_FC_TODS:
|
||||
return hdr->addr1;
|
||||
case WLAN_FC_FROMDS:
|
||||
return hdr->addr2;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
case WLAN_FC_TYPE_CTRL:
|
||||
if (stype != WLAN_FC_STYPE_PSPOLL)
|
||||
return NULL;
|
||||
return hdr->addr1;
|
||||
case WLAN_FC_TYPE_MGMT:
|
||||
return hdr->addr3;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
|
||||
const char *name, const char *val)
|
||||
{
|
||||
int num, v;
|
||||
const char *pos;
|
||||
struct hostapd_wmm_ac_params *ac;
|
||||
|
||||
/* skip 'wme_ac_' or 'wmm_ac_' prefix */
|
||||
pos = name + 7;
|
||||
if (os_strncmp(pos, "be_", 3) == 0) {
|
||||
num = 0;
|
||||
pos += 3;
|
||||
} else if (os_strncmp(pos, "bk_", 3) == 0) {
|
||||
num = 1;
|
||||
pos += 3;
|
||||
} else if (os_strncmp(pos, "vi_", 3) == 0) {
|
||||
num = 2;
|
||||
pos += 3;
|
||||
} else if (os_strncmp(pos, "vo_", 3) == 0) {
|
||||
num = 3;
|
||||
pos += 3;
|
||||
} else {
|
||||
wpa_printf(MSG_ERROR, "Unknown WMM name '%s'", pos);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ac = &wmm_ac_params[num];
|
||||
|
||||
if (os_strcmp(pos, "aifs") == 0) {
|
||||
v = atoi(val);
|
||||
if (v < 1 || v > 255) {
|
||||
wpa_printf(MSG_ERROR, "Invalid AIFS value %d", v);
|
||||
return -1;
|
||||
}
|
||||
ac->aifs = v;
|
||||
} else if (os_strcmp(pos, "cwmin") == 0) {
|
||||
v = atoi(val);
|
||||
if (v < 0 || v > 12) {
|
||||
wpa_printf(MSG_ERROR, "Invalid cwMin value %d", v);
|
||||
return -1;
|
||||
}
|
||||
ac->cwmin = v;
|
||||
} else if (os_strcmp(pos, "cwmax") == 0) {
|
||||
v = atoi(val);
|
||||
if (v < 0 || v > 12) {
|
||||
wpa_printf(MSG_ERROR, "Invalid cwMax value %d", v);
|
||||
return -1;
|
||||
}
|
||||
ac->cwmax = v;
|
||||
} else if (os_strcmp(pos, "txop_limit") == 0) {
|
||||
v = atoi(val);
|
||||
if (v < 0 || v > 0xffff) {
|
||||
wpa_printf(MSG_ERROR, "Invalid txop value %d", v);
|
||||
return -1;
|
||||
}
|
||||
ac->txop_limit = v;
|
||||
} else if (os_strcmp(pos, "acm") == 0) {
|
||||
v = atoi(val);
|
||||
if (v < 0 || v > 1) {
|
||||
wpa_printf(MSG_ERROR, "Invalid acm value %d", v);
|
||||
return -1;
|
||||
}
|
||||
ac->admission_control_mandatory = v;
|
||||
} else {
|
||||
wpa_printf(MSG_ERROR, "Unknown wmm_ac_ field '%s'", pos);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 Common routines
|
||||
* Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef IEEE802_11_COMMON_H
|
||||
#define IEEE802_11_COMMON_H
|
||||
|
||||
/* Parsed Information Elements */
|
||||
struct ieee802_11_elems {
|
||||
const u8 *ssid;
|
||||
const u8 *supp_rates;
|
||||
const u8 *fh_params;
|
||||
const u8 *ds_params;
|
||||
const u8 *cf_params;
|
||||
const u8 *tim;
|
||||
const u8 *ibss_params;
|
||||
const u8 *challenge;
|
||||
const u8 *erp_info;
|
||||
const u8 *ext_supp_rates;
|
||||
const u8 *wpa_ie;
|
||||
const u8 *rsn_ie;
|
||||
const u8 *wmm; /* WMM Information or Parameter Element */
|
||||
const u8 *wmm_tspec;
|
||||
const u8 *wps_ie;
|
||||
const u8 *power_cap;
|
||||
const u8 *supp_channels;
|
||||
const u8 *mdie;
|
||||
const u8 *ftie;
|
||||
const u8 *timeout_int;
|
||||
const u8 *ht_capabilities;
|
||||
const u8 *ht_operation;
|
||||
const u8 *vht_capabilities;
|
||||
const u8 *vht_operation;
|
||||
const u8 *vendor_ht_cap;
|
||||
const u8 *p2p;
|
||||
const u8 *wfd;
|
||||
const u8 *link_id;
|
||||
const u8 *interworking;
|
||||
const u8 *hs20;
|
||||
const u8 *ext_capab;
|
||||
const u8 *bss_max_idle_period;
|
||||
const u8 *ssid_list;
|
||||
|
||||
u8 ssid_len;
|
||||
u8 supp_rates_len;
|
||||
u8 fh_params_len;
|
||||
u8 ds_params_len;
|
||||
u8 cf_params_len;
|
||||
u8 tim_len;
|
||||
u8 ibss_params_len;
|
||||
u8 challenge_len;
|
||||
u8 erp_info_len;
|
||||
u8 ext_supp_rates_len;
|
||||
u8 wpa_ie_len;
|
||||
u8 rsn_ie_len;
|
||||
u8 wmm_len; /* 7 = WMM Information; 24 = WMM Parameter */
|
||||
u8 wmm_tspec_len;
|
||||
u8 wps_ie_len;
|
||||
u8 power_cap_len;
|
||||
u8 supp_channels_len;
|
||||
u8 mdie_len;
|
||||
u8 ftie_len;
|
||||
u8 timeout_int_len;
|
||||
u8 ht_capabilities_len;
|
||||
u8 ht_operation_len;
|
||||
u8 vht_capabilities_len;
|
||||
u8 vht_operation_len;
|
||||
u8 vendor_ht_cap_len;
|
||||
u8 p2p_len;
|
||||
u8 wfd_len;
|
||||
u8 interworking_len;
|
||||
u8 hs20_len;
|
||||
u8 ext_capab_len;
|
||||
u8 ssid_list_len;
|
||||
};
|
||||
|
||||
typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
|
||||
|
||||
ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
|
||||
struct ieee802_11_elems *elems,
|
||||
int show_errors);
|
||||
int ieee802_11_ie_count(const u8 *ies, size_t ies_len);
|
||||
struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
|
||||
u32 oui_type);
|
||||
struct ieee80211_hdr;
|
||||
const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len);
|
||||
|
||||
struct hostapd_wmm_ac_params {
|
||||
int cwmin;
|
||||
int cwmax;
|
||||
int aifs;
|
||||
int txop_limit; /* in units of 32us */
|
||||
int admission_control_mandatory;
|
||||
};
|
||||
|
||||
int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
|
||||
const char *name, const char *val);
|
||||
|
||||
#endif /* IEEE802_11_COMMON_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
init
|
||||
deinit
|
||||
getcapability
|
||||
setcountry
|
||||
setfrequency
|
||||
setrts
|
||||
setfragment
|
||||
settxqueue
|
||||
addap
|
||||
deleteap
|
||||
addstation
|
||||
removestation
|
||||
getstat
|
@ -1,175 +0,0 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_array.h"
|
||||
#include "wifi_drivers.h"
|
||||
|
||||
|
||||
/* Declare enable wifi driver */
|
||||
#ifdef ENABLE_WIFI_DRIVERS_NL80211
|
||||
extern struct wifi_driver_ops wifi_driver_nl80211_ops;
|
||||
#endif
|
||||
|
||||
static struct wifi_driver_instance wifi_driver[] = {
|
||||
#ifdef ENABLE_WIFI_DRIVERS_NL80211
|
||||
{ &wifi_driver_nl80211_ops },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* Radio instance */
|
||||
static struct capwap_array* wifi_device = NULL;
|
||||
|
||||
/* */
|
||||
int wifi_init_driver(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0; wifi_driver[i].ops != NULL; i++) {
|
||||
/* Initialize driver */
|
||||
ASSERT(wifi_driver[i].ops->global_init != NULL);
|
||||
wifi_driver[i].handle = wifi_driver[i].ops->global_init();
|
||||
}
|
||||
|
||||
/* Device handler */
|
||||
wifi_device = capwap_array_create(sizeof(struct wifi_device), 0, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* */
|
||||
void wifi_free_driver(void) {
|
||||
unsigned long i;
|
||||
|
||||
/* Free device */
|
||||
if (wifi_device) {
|
||||
for (i = 0; i < wifi_device->count; i++) {
|
||||
struct wifi_device* device = (struct wifi_device*)capwap_array_get_item_pointer(wifi_device, i);
|
||||
if (device->handle && device->instance->ops->device_deinit) {
|
||||
device->instance->ops->device_deinit(device->handle);
|
||||
}
|
||||
}
|
||||
|
||||
capwap_array_free(wifi_device);
|
||||
}
|
||||
|
||||
/* Free driver */
|
||||
for (i = 0; wifi_driver[i].ops != NULL; i++) {
|
||||
if (wifi_driver[i].ops->global_deinit) {
|
||||
wifi_driver[i].ops->global_deinit(wifi_driver[i].handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
int wifi_create_device(int radioid, const char* ifname, const char* driver) {
|
||||
int i;
|
||||
int length;
|
||||
int result = -1;
|
||||
|
||||
ASSERT(radioid > 0);
|
||||
ASSERT(ifname != NULL);
|
||||
ASSERT(driver != NULL);
|
||||
|
||||
/* Check */
|
||||
length = strlen(ifname);
|
||||
if ((length <= 0) || (length >= IFNAMSIZ)) {
|
||||
capwap_logging_warning("Wifi device name error: %s", ifname);
|
||||
return -1;
|
||||
} else if (wifi_device->count >= radioid) {
|
||||
capwap_logging_warning("Wifi device RadioID already used: %d", radioid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Search driver */
|
||||
for (i = 0; wifi_driver[i].ops != NULL; i++) {
|
||||
if (!strcmp(driver, wifi_driver[i].ops->name)) {
|
||||
wifi_device_handle devicehandle;
|
||||
struct device_init_params params = {
|
||||
.ifname = (char*)ifname
|
||||
};
|
||||
|
||||
/* Device init */
|
||||
ASSERT(wifi_driver[i].ops->device_init);
|
||||
devicehandle = wifi_driver[i].ops->device_init(wifi_driver[i].handle, ¶ms);
|
||||
if (devicehandle) {
|
||||
/* Register new device */
|
||||
struct wifi_device* device = (struct wifi_device*)capwap_array_get_item_pointer(wifi_device, radioid);
|
||||
device->handle = devicehandle;
|
||||
device->instance = &wifi_driver[i];
|
||||
|
||||
result = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct wifi_capability* wifi_get_capability_device(int radioid) {
|
||||
struct wifi_device* device;
|
||||
|
||||
ASSERT(radioid > 0);
|
||||
|
||||
if (wifi_device->count <= radioid) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Retrieve capability */
|
||||
device = (struct wifi_device*)capwap_array_get_item_pointer(wifi_device, radioid);
|
||||
if (device->handle && device->instance->ops->device_deinit) {
|
||||
return device->instance->ops->get_capability(device->handle);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
void wifi_iface_updown(int sock, const char* ifname, int up) {
|
||||
int localsock = -1;
|
||||
struct ifreq ifreq;
|
||||
|
||||
ASSERT(ifname != NULL);
|
||||
ASSERT(*ifname != 0);
|
||||
|
||||
/* Check if build local socket */
|
||||
if (sock < 0) {
|
||||
localsock = socket(AF_PACKET, SOCK_RAW, 0);
|
||||
if (localsock < 0) {
|
||||
return;
|
||||
} else {
|
||||
sock = localsock;
|
||||
}
|
||||
}
|
||||
|
||||
/* Change link state of interface */
|
||||
memset(&ifreq, 0, sizeof(ifreq));
|
||||
strcpy(ifreq.ifr_name, ifname);
|
||||
if (!ioctl(sock, SIOCGIFFLAGS, &ifreq)) {
|
||||
if (up) {
|
||||
ifreq.ifr_flags |= IFF_UP;
|
||||
} else {
|
||||
ifreq.ifr_flags &= ~IFF_UP;
|
||||
}
|
||||
|
||||
ioctl(sock, SIOCSIFFLAGS, &ifreq);
|
||||
}
|
||||
|
||||
/* Free local socket */
|
||||
if (localsock >= 0) {
|
||||
close(localsock);
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
unsigned long wifi_frequency_to_channel(unsigned long freq) {
|
||||
if ((freq >= 2412) && (freq <= 2472)) {
|
||||
return (freq - 2407) / 5;
|
||||
} else if (freq == 2484) {
|
||||
return 14;
|
||||
} else if ((freq >= 5035) && (freq <= 5825)) {
|
||||
return freq / 5 - 1000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
#ifndef __WIFI_DRIVERS_HEADER__
|
||||
#define __WIFI_DRIVERS_HEADER__
|
||||
|
||||
/* */
|
||||
#define WIFI_DRIVER_NAME_SIZE 16
|
||||
|
||||
/* */
|
||||
#define IS_IEEE80211_FREQ_BG(x) ((x >= 2412) && (x <= 2484) ? 1 : 0)
|
||||
#define IS_IEEE80211_FREQ_A(x) ((x >= 5035) && (x <= 5825) ? 1 : 0)
|
||||
|
||||
/* */
|
||||
#define WIFI_CAPABILITY_AP_SUPPORTED 0x00000001
|
||||
#define WIFI_CAPABILITY_AP_VLAN_SUPPORTED 0x00000002
|
||||
#define WIFI_CAPABILITY_ADHOC_SUPPORTED 0x00000004
|
||||
#define WIFI_CAPABILITY_MONITOR_SUPPORTED 0x00000008
|
||||
#define WIFI_CAPABILITY_WDS_SUPPORTED 0x00000010
|
||||
|
||||
#define FREQ_CAPABILITY_DISABLED 0x00000001
|
||||
#define FREQ_CAPABILITY_PASSIVE_SCAN 0x00000002
|
||||
#define FREQ_CAPABILITY_NO_IBBS 0x00000004
|
||||
#define FREQ_CAPABILITY_RADAR 0x00000008
|
||||
#define FREQ_CAPABILITY_DFS_STATE 0x00000010
|
||||
#define FREQ_CAPABILITY_DFS_TIME 0x00000020
|
||||
|
||||
#define RATE_CAPABILITY_SHORTPREAMBLE 0x00000001
|
||||
|
||||
#define CIPHER_CAPABILITY_UNKNOWN 0
|
||||
#define CIPHER_CAPABILITY_WEP40 1
|
||||
#define CIPHER_CAPABILITY_WEP104 2
|
||||
#define CIPHER_CAPABILITY_TKIP 3
|
||||
#define CIPHER_CAPABILITY_CCMP 4
|
||||
#define CIPHER_CAPABILITY_CMAC 5
|
||||
#define CIPHER_CAPABILITY_GCMP 6
|
||||
#define CIPHER_CAPABILITY_WPI_SMS4 7
|
||||
|
||||
#define IEEE80211_DFS_USABLE 0
|
||||
#define IEEE80211_DFS_UNAVAILABLE 1
|
||||
#define IEEE80211_DFS_AVAILABLE 2
|
||||
|
||||
/* */
|
||||
typedef void* wifi_global_handle;
|
||||
typedef void* wifi_device_handle;
|
||||
|
||||
/* */
|
||||
struct device_init_params {
|
||||
char* ifname;
|
||||
};
|
||||
|
||||
/* Interface capability */
|
||||
struct wifi_freq_capability {
|
||||
unsigned long flags;
|
||||
|
||||
unsigned long frequency; /* MHz */
|
||||
unsigned long channel;
|
||||
|
||||
unsigned long maxtxpower; /* mBm = 100 * dBm */
|
||||
|
||||
unsigned long dfsstate;
|
||||
unsigned long dfstime; /* ms */
|
||||
};
|
||||
|
||||
struct wifi_rate_capability {
|
||||
unsigned long flags;
|
||||
|
||||
unsigned long bitrate; /* Kbps */
|
||||
};
|
||||
|
||||
struct wifi_band_capability {
|
||||
unsigned long htcapability;
|
||||
struct capwap_array* freq;
|
||||
struct capwap_array* rate;
|
||||
};
|
||||
|
||||
struct wifi_cipher_capability {
|
||||
unsigned long cipher;
|
||||
};
|
||||
|
||||
struct wifi_capability {
|
||||
unsigned long radiosupported;
|
||||
|
||||
unsigned long radiotype;
|
||||
|
||||
struct capwap_array* bands;
|
||||
struct capwap_array* ciphers;
|
||||
};
|
||||
|
||||
/* */
|
||||
struct wifi_driver_ops {
|
||||
const char* name; /* Name of wifi driver */
|
||||
const char* description; /* Description of wifi driver */
|
||||
|
||||
/* Global initialize driver */
|
||||
wifi_global_handle (*global_init)(void);
|
||||
void (*global_deinit)(wifi_global_handle handle);
|
||||
|
||||
/* Initialize device */
|
||||
wifi_device_handle (*device_init)(wifi_global_handle handle, struct device_init_params* params);
|
||||
void (*device_deinit)(wifi_device_handle handle);
|
||||
|
||||
/* Capability */
|
||||
struct wifi_capability* (*get_capability)(wifi_device_handle handle);
|
||||
};
|
||||
|
||||
/* */
|
||||
struct wifi_driver_instance {
|
||||
struct wifi_driver_ops* ops; /* Driver functions */
|
||||
wifi_global_handle handle; /* Global instance handle */
|
||||
};
|
||||
|
||||
/* */
|
||||
struct wifi_device {
|
||||
wifi_device_handle handle; /* Device handle */
|
||||
struct wifi_driver_instance* instance; /* Driver instance */
|
||||
};
|
||||
|
||||
/* Initialize wifi driver engine */
|
||||
int wifi_init_driver(void);
|
||||
void wifi_free_driver(void);
|
||||
|
||||
/* */
|
||||
int wifi_create_device(int radioid, const char* ifname, const char* driver);
|
||||
struct wifi_capability* wifi_get_capability_device(int radioid);
|
||||
|
||||
/* Util functions */
|
||||
void wifi_iface_updown(int sock, const char* ifname, int up);
|
||||
unsigned long wifi_frequency_to_channel(unsigned long freq);
|
||||
|
||||
#endif /* __WIFI_DRIVERS_HEADER__ */
|
@ -1,730 +0,0 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_array.h"
|
||||
#include "capwap_list.h"
|
||||
#include "capwap_element.h"
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/genl/family.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
|
||||
/* Local version of nl80211 with all feature to remove the problem of frag version of nl80211 */
|
||||
#include "nl80211_v3_10.h"
|
||||
|
||||
#include "wifi_drivers.h"
|
||||
#include "wifi_nl80211.h"
|
||||
|
||||
/* Compatibility functions */
|
||||
#if !defined(HAVE_LIBNL20) && !defined(HAVE_LIBNL30)
|
||||
static uint32_t port_bitmap[32] = { 0 };
|
||||
|
||||
static struct nl_sock* nl_socket_alloc_cb(void* cb) {
|
||||
int i;
|
||||
struct nl_sock* handle;
|
||||
uint32_t pid = getpid() & 0x3FFFFF;
|
||||
|
||||
handle = nl_handle_alloc_cb(cb);
|
||||
for (i = 0; i < 1024; i++) {
|
||||
if (port_bitmap[i / 32] & (1 << (i % 32))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
port_bitmap[i / 32] |= 1 << (i % 32);
|
||||
pid += i << 22;
|
||||
break;
|
||||
}
|
||||
|
||||
nl_socket_set_local_port(handle, pid);
|
||||
return handle;
|
||||
}
|
||||
|
||||
static void nl_socket_free(struct nl_sock* handle) {
|
||||
uint32_t port = nl_socket_get_local_port(handle);
|
||||
|
||||
port >>= 22;
|
||||
port_bitmap[port / 32] &= ~(1 << (port % 32));
|
||||
|
||||
nl_handle_destroy(handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* */
|
||||
static struct nl_sock* nl_create_handle(struct nl_cb* cb) {
|
||||
struct nl_sock* handle;
|
||||
|
||||
handle = nl_socket_alloc_cb(cb);
|
||||
if (!handle) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (genl_connect(handle)) {
|
||||
nl_socket_free(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_no_seq_check(struct nl_msg* msg, void* arg) {
|
||||
return NL_OK;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_error_handler(struct sockaddr_nl* nla, struct nlmsgerr* err, void* arg) {
|
||||
*((int*)arg) = err->error;
|
||||
return NL_STOP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_finish_handler(struct nl_msg* msg, void* arg) {
|
||||
*((int*)arg) = 0;
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_ack_handler(struct nl_msg* msg, void* arg) {
|
||||
*((int*)arg) = 0;
|
||||
return NL_STOP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_send_and_recv(struct nl_sock* nl, struct nl_cb* nl_cb, struct nl_msg* msg, nl_valid_cb valid_cb, void* data) {
|
||||
int result;
|
||||
struct nl_cb* cb;
|
||||
|
||||
/* Clone netlink callback */
|
||||
cb = nl_cb_clone(nl_cb);
|
||||
if (!cb) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Complete send message */
|
||||
result = nl_send_auto_complete(nl, msg);
|
||||
if (result < 0) {
|
||||
nl_cb_put(cb);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Customize message callback */
|
||||
nl_cb_err(cb, NL_CB_CUSTOM, nl80211_error_handler, &result);
|
||||
nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, nl80211_finish_handler, &result);
|
||||
nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, nl80211_ack_handler, &result);
|
||||
|
||||
if (valid_cb) {
|
||||
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_cb, data);
|
||||
}
|
||||
|
||||
result = 1;
|
||||
while (result > 0) {
|
||||
nl_recvmsgs(nl, cb);
|
||||
}
|
||||
|
||||
nl_cb_put(cb);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_send_and_recv_msg(struct nl80211_global_handle* globalhandle, struct nl_msg* msg, nl_valid_cb valid_cb, void* data) {
|
||||
return nl80211_send_and_recv(globalhandle->nl, globalhandle->nl_cb, msg, valid_cb, data);
|
||||
}
|
||||
|
||||
/* */
|
||||
static unsigned long nl80211_get_cipher(uint32_t chiper) {
|
||||
switch (chiper) {
|
||||
case 0x000fac01: {
|
||||
return CIPHER_CAPABILITY_WEP40;
|
||||
}
|
||||
|
||||
case 0x000fac05: {
|
||||
return CIPHER_CAPABILITY_WEP104;
|
||||
}
|
||||
|
||||
case 0x000fac02: {
|
||||
return CIPHER_CAPABILITY_TKIP;
|
||||
}
|
||||
|
||||
case 0x000fac04: {
|
||||
return CIPHER_CAPABILITY_CCMP;
|
||||
}
|
||||
|
||||
case 0x000fac06: {
|
||||
return CIPHER_CAPABILITY_CMAC;
|
||||
}
|
||||
|
||||
case 0x000fac08: {
|
||||
return CIPHER_CAPABILITY_GCMP;
|
||||
}
|
||||
|
||||
case 0x00147201: {
|
||||
return CIPHER_CAPABILITY_WPI_SMS4;
|
||||
}
|
||||
}
|
||||
|
||||
return CIPHER_CAPABILITY_UNKNOWN;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int cb_get_virtdevice_list(struct nl_msg* msg, void* data) {
|
||||
struct nlattr* tb_msg[NL80211_ATTR_MAX + 1];
|
||||
struct genlmsghdr* gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||
struct capwap_list* list = (struct capwap_list*)data;
|
||||
|
||||
nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
|
||||
|
||||
if (tb_msg[NL80211_ATTR_WIPHY] && tb_msg[NL80211_ATTR_IFNAME] && tb_msg[NL80211_ATTR_IFINDEX]) {
|
||||
struct capwap_list_item* item = capwap_itemlist_create(sizeof(struct nl80211_virtdevice_item));
|
||||
struct nl80211_virtdevice_item* virtitem = (struct nl80211_virtdevice_item*)item->item;
|
||||
|
||||
/* Add virtual device info */
|
||||
virtitem->phyindex = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]);
|
||||
virtitem->virtindex = nla_get_u32(tb_msg[NL80211_ATTR_IFINDEX]);
|
||||
strcpy(virtitem->virtname, nla_get_string(tb_msg[NL80211_ATTR_IFNAME]));
|
||||
capwap_itemlist_insert_after(list, NULL, item);
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_get_virtdevice_list(struct nl80211_global_handle* globalhandle, struct capwap_list* list) {
|
||||
int result;
|
||||
struct nl_msg* msg;
|
||||
|
||||
ASSERT(globalhandle != NULL);
|
||||
ASSERT(list != NULL);
|
||||
|
||||
/* */
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, 0, 0, globalhandle->nl80211_id, 0, NLM_F_DUMP, NL80211_CMD_GET_INTERFACE, 0);
|
||||
|
||||
/* Retrieve all virtual interface */
|
||||
result = nl80211_send_and_recv_msg(globalhandle, msg, cb_get_virtdevice_list, list);
|
||||
|
||||
/* */
|
||||
nlmsg_free(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int cb_get_phydevice_list(struct nl_msg* msg, void* data) {
|
||||
struct nlattr* tb_msg[NL80211_ATTR_MAX + 1];
|
||||
struct genlmsghdr* gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||
struct capwap_list* list = (struct capwap_list*)data;
|
||||
|
||||
nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
|
||||
|
||||
if (tb_msg[NL80211_ATTR_WIPHY_NAME] && tb_msg[NL80211_ATTR_WIPHY]) {
|
||||
struct capwap_list_item* item = capwap_itemlist_create(sizeof(struct nl80211_phydevice_item));
|
||||
struct nl80211_phydevice_item* phyitem = (struct nl80211_phydevice_item*)item->item;
|
||||
|
||||
/* Add physical device info */
|
||||
phyitem->index = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]);
|
||||
strcpy(phyitem->name, nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME]));
|
||||
capwap_itemlist_insert_after(list, NULL, item);
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_get_phydevice_list(struct nl80211_global_handle* globalhandle, struct capwap_list* list) {
|
||||
int result;
|
||||
struct nl_msg* msg;
|
||||
|
||||
ASSERT(globalhandle != NULL);
|
||||
ASSERT(list != NULL);
|
||||
|
||||
/* */
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, 0, 0, globalhandle->nl80211_id, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0);
|
||||
|
||||
/* Retrieve all physical interface */
|
||||
result = nl80211_send_and_recv_msg(globalhandle, msg, cb_get_phydevice_list, list);
|
||||
|
||||
/* */
|
||||
nlmsg_free(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int cb_get_phydevice_capability(struct nl_msg* msg, void* data) {
|
||||
int i, j;
|
||||
struct nlattr* tb_msg[NL80211_ATTR_MAX + 1];
|
||||
struct genlmsghdr* gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||
struct nl80211_device_handle* devicehandle = (struct nl80211_device_handle*)data;
|
||||
int radio80211bg = 0;
|
||||
int radio80211a = 0;
|
||||
|
||||
nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
|
||||
|
||||
if (tb_msg[NL80211_ATTR_WIPHY] && (nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]) == devicehandle->phyindex)) {
|
||||
/* Interface supported */
|
||||
if (tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]) {
|
||||
struct nlattr* nl_mode;
|
||||
|
||||
nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], i) {
|
||||
switch (nla_type(nl_mode)) {
|
||||
case NL80211_IFTYPE_AP: {
|
||||
devicehandle->capability.radiosupported |= WIFI_CAPABILITY_AP_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
case NL80211_IFTYPE_AP_VLAN: {
|
||||
devicehandle->capability.radiosupported |= WIFI_CAPABILITY_AP_VLAN_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
case NL80211_IFTYPE_ADHOC: {
|
||||
devicehandle->capability.radiosupported |= WIFI_CAPABILITY_ADHOC_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
case NL80211_IFTYPE_WDS: {
|
||||
devicehandle->capability.radiosupported |= WIFI_CAPABILITY_WDS_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
case NL80211_IFTYPE_MONITOR: {
|
||||
devicehandle->capability.radiosupported |= WIFI_CAPABILITY_MONITOR_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Cipher supported */
|
||||
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
|
||||
int count;
|
||||
uint32_t* ciphers;
|
||||
struct wifi_cipher_capability* ciphercap;
|
||||
|
||||
/* */
|
||||
count = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(uint32_t);
|
||||
if (count > 0) {
|
||||
ciphers = (uint32_t*)nla_data(tb_msg[NL80211_ATTR_CIPHER_SUITES]);
|
||||
for (j = 0; j < count; j++) {
|
||||
ciphercap = (struct wifi_cipher_capability*)capwap_array_get_item_pointer(devicehandle->capability.ciphers, devicehandle->capability.ciphers->count);
|
||||
ciphercap->cipher = nl80211_get_cipher(ciphers[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Band and datarate supported */
|
||||
if (tb_msg[NL80211_ATTR_WIPHY_BANDS]) {
|
||||
struct nlattr* nl_band;
|
||||
struct nlattr* tb_band[NL80211_BAND_ATTR_MAX + 1];
|
||||
|
||||
nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], i) {
|
||||
struct wifi_band_capability* bandcap;
|
||||
|
||||
nla_parse(tb_band, NL80211_BAND_ATTR_MAX, nla_data(nl_band), nla_len(nl_band), NULL);
|
||||
|
||||
/* Init band */
|
||||
bandcap = (struct wifi_band_capability*)capwap_array_get_item_pointer(devicehandle->capability.bands, devicehandle->capability.bands->count);
|
||||
bandcap->freq = capwap_array_create(sizeof(struct wifi_freq_capability), 0, 1);
|
||||
bandcap->rate = capwap_array_create(sizeof(struct wifi_rate_capability), 0, 1);
|
||||
|
||||
/* Check High Throughput capability */
|
||||
if (tb_band[NL80211_BAND_ATTR_HT_CAPA]) {
|
||||
bandcap->htcapability = (unsigned long)nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
|
||||
devicehandle->capability.radiotype |= CAPWAP_RADIO_TYPE_80211N;
|
||||
}
|
||||
|
||||
/* Frequency */
|
||||
if (tb_band[NL80211_BAND_ATTR_FREQS]) {
|
||||
struct nlattr* nl_freq;
|
||||
struct nlattr* tb_freq[NL80211_FREQUENCY_ATTR_MAX + 1];
|
||||
struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
|
||||
[NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
|
||||
[NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
|
||||
};
|
||||
|
||||
nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], j) {
|
||||
nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq), nla_len(nl_freq), freq_policy);
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_FREQ]) {
|
||||
struct wifi_freq_capability* freq = (struct wifi_freq_capability*)capwap_array_get_item_pointer(bandcap->freq, bandcap->freq->count);
|
||||
|
||||
/* Retrieve frequency and channel */
|
||||
freq->frequency = (unsigned long)nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
|
||||
freq->channel = wifi_frequency_to_channel(freq->frequency);
|
||||
|
||||
if (!radio80211bg && IS_IEEE80211_FREQ_BG(freq->frequency)) {
|
||||
radio80211bg = 1;
|
||||
devicehandle->capability.radiotype |= (CAPWAP_RADIO_TYPE_80211B | CAPWAP_RADIO_TYPE_80211G);
|
||||
} else if (!radio80211a && IS_IEEE80211_FREQ_A(freq->frequency)) {
|
||||
radio80211a = 1;
|
||||
devicehandle->capability.radiotype |= CAPWAP_RADIO_TYPE_80211A;
|
||||
}
|
||||
|
||||
/* Get max tx power */
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]) {
|
||||
freq->maxtxpower = (unsigned long)nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]);
|
||||
}
|
||||
|
||||
/* Get flags */
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) {
|
||||
freq->flags |= FREQ_CAPABILITY_DISABLED;
|
||||
} else {
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN]) {
|
||||
freq->flags |= FREQ_CAPABILITY_PASSIVE_SCAN;
|
||||
}
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS]) {
|
||||
freq->flags |= FREQ_CAPABILITY_NO_IBBS;
|
||||
}
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR]) {
|
||||
freq->flags |= FREQ_CAPABILITY_RADAR;
|
||||
}
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]) {
|
||||
freq->flags |= FREQ_CAPABILITY_DFS_STATE;
|
||||
freq->dfsstate = (unsigned long)nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]);
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]) {
|
||||
freq->flags |= FREQ_CAPABILITY_DFS_TIME;
|
||||
freq->dfstime = (unsigned long)nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Rate */
|
||||
if (tb_band[NL80211_BAND_ATTR_RATES]) {
|
||||
struct nlattr* nl_rate;
|
||||
struct nlattr* tb_rate[NL80211_FREQUENCY_ATTR_MAX + 1];
|
||||
struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = {
|
||||
[NL80211_BITRATE_ATTR_RATE] = { .type = NLA_U32 },
|
||||
[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG },
|
||||
};
|
||||
|
||||
nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], j) {
|
||||
nla_parse(tb_rate, NL80211_BITRATE_ATTR_MAX, nla_data(nl_rate), nla_len(nl_rate), rate_policy);
|
||||
|
||||
if (tb_rate[NL80211_BITRATE_ATTR_RATE]) {
|
||||
struct wifi_rate_capability* rate = (struct wifi_rate_capability*)capwap_array_get_item_pointer(bandcap->rate, bandcap->rate->count);
|
||||
|
||||
rate->bitrate = (unsigned long)nla_get_u32(tb_rate[NL80211_BITRATE_ATTR_RATE]) * 100;
|
||||
|
||||
if (tb_rate[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE]) {
|
||||
rate->flags |= RATE_CAPABILITY_SHORTPREAMBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_get_phydevice_capability(struct nl80211_device_handle* devicehandle) {
|
||||
int result;
|
||||
struct nl_msg* msg;
|
||||
|
||||
ASSERT(devicehandle != NULL);
|
||||
|
||||
/* */
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, 0, 0, devicehandle->globalhandle->nl80211_id, 0, 0, NL80211_CMD_GET_WIPHY, 0);
|
||||
nla_put_u32(msg, NL80211_ATTR_WIPHY, devicehandle->phyindex);
|
||||
|
||||
/* Retrieve physical device capability */
|
||||
result = nl80211_send_and_recv_msg(devicehandle->globalhandle, msg, cb_get_phydevice_capability, devicehandle);
|
||||
|
||||
/* */
|
||||
nlmsg_free(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
static int nl80211_destroy_virtdevice(struct nl80211_global_handle* globalhandle, uint32_t virtindex) {
|
||||
int result;
|
||||
struct nl_msg* msg;
|
||||
|
||||
ASSERT(globalhandle != NULL);
|
||||
|
||||
/* */
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, 0, 0, globalhandle->nl80211_id, 0, 0, NL80211_CMD_DEL_INTERFACE, 0);
|
||||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, virtindex);
|
||||
|
||||
/* Destroy virtual device */
|
||||
result = nl80211_send_and_recv_msg(globalhandle, msg, NULL, NULL);
|
||||
|
||||
/* */
|
||||
nlmsg_free(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void nl80211_destroy_all_virtdevice(struct nl80211_global_handle* globalhandle, uint32_t phyindex) {
|
||||
int result;
|
||||
struct capwap_list* list;
|
||||
|
||||
/* Retrieve all virtual device */
|
||||
list = capwap_list_create();
|
||||
result = nl80211_get_virtdevice_list(globalhandle, list);
|
||||
if (!result) {
|
||||
struct capwap_list_item* item = list->first;
|
||||
|
||||
/* Search virtual device by physical device */
|
||||
while (item) {
|
||||
struct nl80211_virtdevice_item* virtitem = (struct nl80211_virtdevice_item*)item->item;
|
||||
|
||||
/* Destroy virtual device */
|
||||
if (virtitem->phyindex == phyindex) {
|
||||
wifi_iface_updown(globalhandle->sock_util, virtitem->virtname, 0);
|
||||
result = nl80211_destroy_virtdevice(globalhandle, virtitem->virtindex);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to destroy virtual device, error code: %d", result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Next */
|
||||
item = item->next;
|
||||
}
|
||||
} else {
|
||||
/* Error get virtual devices */
|
||||
capwap_logging_error("Unable retrieve virtual device info, error code: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_list_free(list);
|
||||
}
|
||||
|
||||
/* */
|
||||
static wifi_device_handle nl80211_device_init(wifi_global_handle handle, struct device_init_params* params) {
|
||||
int result;
|
||||
struct capwap_list* list;
|
||||
struct capwap_list_item* item;
|
||||
struct nl80211_device_handle* devicehandle = NULL;
|
||||
struct nl80211_global_handle* globalhandle = (struct nl80211_global_handle*)handle;
|
||||
|
||||
ASSERT(params != NULL);
|
||||
|
||||
if (!handle) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Retrieve physical device info */
|
||||
list = capwap_list_create();
|
||||
result = nl80211_get_phydevice_list(globalhandle, list);
|
||||
if (!result) {
|
||||
item = list->first;
|
||||
while (item) {
|
||||
struct nl80211_phydevice_item* phyitem = (struct nl80211_phydevice_item*)item->item;
|
||||
|
||||
if (!strcmp(phyitem->name, params->ifname)) {
|
||||
/* Create device */
|
||||
devicehandle = (struct nl80211_device_handle*)capwap_alloc(sizeof(struct nl80211_device_handle));
|
||||
memset(devicehandle, 0, sizeof(struct nl80211_device_handle));
|
||||
|
||||
/* */
|
||||
strcpy(devicehandle->phyname, phyitem->name);
|
||||
devicehandle->phyindex = phyitem->index;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Next */
|
||||
item = item->next;
|
||||
}
|
||||
} else {
|
||||
/* Error get physical devices */
|
||||
capwap_logging_error("Unable retrieve physical device info, error code: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_list_free(list);
|
||||
if (!devicehandle) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
devicehandle->globalhandle = globalhandle;
|
||||
|
||||
/* Remove all virtual adapter from wifi device */
|
||||
nl80211_destroy_all_virtdevice(globalhandle, devicehandle->phyindex);
|
||||
|
||||
/* Retrieve wifi device capability */
|
||||
devicehandle->capability.bands = capwap_array_create(sizeof(struct wifi_band_capability), 0, 1);
|
||||
devicehandle->capability.ciphers = capwap_array_create(sizeof(struct wifi_cipher_capability), 0, 1);
|
||||
|
||||
result = nl80211_get_phydevice_capability(devicehandle);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable retrieve physical device capability, error code: %d", result);
|
||||
}
|
||||
|
||||
/* Save device handle into global handle */
|
||||
item = capwap_itemlist_create_with_item(devicehandle, sizeof(struct nl80211_device_handle));
|
||||
item->autodelete = 0;
|
||||
capwap_itemlist_insert_after(globalhandle->devicelist, NULL, item);
|
||||
|
||||
return devicehandle;
|
||||
}
|
||||
|
||||
/* */
|
||||
static struct wifi_capability* nl80211_get_capability(wifi_device_handle handle) {
|
||||
struct nl80211_device_handle* devicehandle = (struct nl80211_device_handle*)handle;
|
||||
|
||||
return &devicehandle->capability;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void nl80211_device_deinit(wifi_device_handle handle) {
|
||||
int i;
|
||||
struct nl80211_device_handle* devicehandle = (struct nl80211_device_handle*)handle;
|
||||
|
||||
if (devicehandle) {
|
||||
struct capwap_list_item* search;
|
||||
|
||||
/* Remove device handle from global handle*/
|
||||
search = devicehandle->globalhandle->devicelist->first;
|
||||
while (search) {
|
||||
if ((struct nl80211_device_handle*)search->item == devicehandle) {
|
||||
/* Remove all virtual adapter from wifi device */
|
||||
nl80211_destroy_all_virtdevice(devicehandle->globalhandle, devicehandle->phyindex);
|
||||
|
||||
/* Remove item from list */
|
||||
capwap_itemlist_free(capwap_itemlist_remove(devicehandle->globalhandle->devicelist, search));
|
||||
break;
|
||||
}
|
||||
|
||||
search = search->next;
|
||||
}
|
||||
|
||||
/* Free memory */
|
||||
if (devicehandle->capability.bands) {
|
||||
for (i = 0; i < devicehandle->capability.bands->count; i++) {
|
||||
struct wifi_band_capability* bandcap = (struct wifi_band_capability*)capwap_array_get_item_pointer(devicehandle->capability.bands, i);
|
||||
|
||||
if (bandcap->freq) {
|
||||
capwap_array_free(bandcap->freq);
|
||||
}
|
||||
|
||||
if (bandcap->rate) {
|
||||
capwap_array_free(bandcap->rate);
|
||||
}
|
||||
}
|
||||
|
||||
capwap_array_free(devicehandle->capability.bands);
|
||||
}
|
||||
|
||||
if (devicehandle->capability.ciphers) {
|
||||
capwap_array_free(devicehandle->capability.ciphers);
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_free(devicehandle);
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
static void nl80211_global_deinit(wifi_global_handle handle) {
|
||||
struct nl80211_global_handle* globalhandle = (struct nl80211_global_handle*)handle;
|
||||
|
||||
if (globalhandle) {
|
||||
if (globalhandle->nl) {
|
||||
nl_socket_free(globalhandle->nl);
|
||||
}
|
||||
|
||||
if (globalhandle->nl_cb) {
|
||||
nl_cb_put(globalhandle->nl_cb);
|
||||
}
|
||||
|
||||
if (globalhandle->devicelist) {
|
||||
ASSERT(globalhandle->devicelist->count == 0);
|
||||
capwap_list_free(globalhandle->devicelist);
|
||||
}
|
||||
|
||||
if (globalhandle->sock_util >= 0) {
|
||||
close(globalhandle->sock_util);
|
||||
}
|
||||
|
||||
capwap_free(globalhandle);
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
static wifi_global_handle nl80211_global_init(void) {
|
||||
struct nl80211_global_handle* globalhandle;
|
||||
|
||||
/* */
|
||||
globalhandle = (struct nl80211_global_handle*)capwap_alloc(sizeof(struct nl80211_global_handle));
|
||||
memset(globalhandle, 0, sizeof(struct nl80211_global_handle));
|
||||
globalhandle->sock_util = -1;
|
||||
|
||||
/* Configure global netlink callback */
|
||||
globalhandle->nl_cb = nl_cb_alloc(NL_CB_DEFAULT);
|
||||
if (!globalhandle->nl_cb) {
|
||||
nl80211_global_deinit((wifi_global_handle)globalhandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create netlink socket */
|
||||
globalhandle->nl = nl_create_handle(globalhandle->nl_cb);
|
||||
if (!globalhandle->nl) {
|
||||
nl80211_global_deinit((wifi_global_handle)globalhandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get nl80211 netlink family */
|
||||
globalhandle->nl80211_id = genl_ctrl_resolve(globalhandle->nl, "nl80211");
|
||||
if (globalhandle->nl80211_id < 0) {
|
||||
capwap_logging_warning("Unable to found mac80211 kernel module: %s", nl_geterror());
|
||||
nl80211_global_deinit((wifi_global_handle)globalhandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Configure global callback function */
|
||||
nl_cb_set(globalhandle->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, nl80211_no_seq_check, NULL);
|
||||
/* TODO */
|
||||
|
||||
/* Device list */
|
||||
globalhandle->devicelist = capwap_list_create();
|
||||
|
||||
/* Socket utils */
|
||||
globalhandle->sock_util = socket(AF_PACKET, SOCK_RAW, 0);
|
||||
if (globalhandle->sock_util < 0) {
|
||||
nl80211_global_deinit((wifi_global_handle)globalhandle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (wifi_global_handle)globalhandle;
|
||||
}
|
||||
|
||||
/* Driver function */
|
||||
const struct wifi_driver_ops wifi_driver_nl80211_ops = {
|
||||
.name = "nl80211",
|
||||
.description = "Linux nl80211/cfg80211",
|
||||
.global_init = nl80211_global_init,
|
||||
.global_deinit = nl80211_global_deinit,
|
||||
.device_init = nl80211_device_init,
|
||||
.device_deinit = nl80211_device_deinit,
|
||||
.get_capability = nl80211_get_capability
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
#ifndef __WIFI_NL80211_HEADER__
|
||||
#define __WIFI_NL80211_HEADER__
|
||||
|
||||
/* Compatibility functions */
|
||||
#if !defined(HAVE_LIBNL20) && !defined(HAVE_LIBNL30)
|
||||
#define nl_sock nl_handle
|
||||
#endif
|
||||
|
||||
/* */
|
||||
typedef int (*nl_valid_cb)(struct nl_msg* msg, void* data);
|
||||
|
||||
/* Global handle */
|
||||
struct nl80211_global_handle {
|
||||
struct nl_sock* nl;
|
||||
struct nl_cb* nl_cb;
|
||||
int nl80211_id;
|
||||
|
||||
int sock_util;
|
||||
|
||||
struct capwap_list* devicelist;
|
||||
};
|
||||
|
||||
/* Device handle */
|
||||
struct nl80211_device_handle {
|
||||
struct nl80211_global_handle* globalhandle;
|
||||
|
||||
uint32_t phyindex;
|
||||
char phyname[IFNAMSIZ];
|
||||
|
||||
/* Capability */
|
||||
struct wifi_capability capability;
|
||||
};
|
||||
|
||||
/* Physical device info */
|
||||
struct nl80211_phydevice_item {
|
||||
uint32_t index;
|
||||
char name[IFNAMSIZ];
|
||||
};
|
||||
|
||||
/* Virtual device info */
|
||||
struct nl80211_virtdevice_item {
|
||||
uint32_t phyindex;
|
||||
uint32_t virtindex;
|
||||
char virtname[IFNAMSIZ];
|
||||
};
|
||||
|
||||
#endif /* __WIFI_NL80211_HEADER__ */
|
Loading…
Reference in New Issue
Block a user