add VSA to report supported ciphers per radio
This commit is contained in:
@ -1665,7 +1665,7 @@ void wifi_driver_free(void)
|
||||
}
|
||||
|
||||
if (device->capability->ciphers)
|
||||
capwap_array_free(device->capability->ciphers);
|
||||
capwap_free(device->capability->ciphers);
|
||||
|
||||
capwap_free(device->capability);
|
||||
}
|
||||
@ -1761,7 +1761,6 @@ struct wifi_device* wifi_device_connect(const char* ifname, const char* driver)
|
||||
device->capability = (struct wifi_capability*)capwap_alloc(sizeof(struct wifi_capability));
|
||||
memset(device->capability, 0, sizeof(struct wifi_capability));
|
||||
device->capability->bands = capwap_array_create(sizeof(struct wifi_band_capability), 0, 1);
|
||||
device->capability->ciphers = capwap_array_create(sizeof(struct wifi_cipher_capability), 0, 1);
|
||||
|
||||
/* Retrieve device capability */
|
||||
device_getcapability(device, device->capability);
|
||||
|
@ -50,15 +50,6 @@
|
||||
|
||||
#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
|
||||
@ -189,11 +180,6 @@ struct wifi_commands_capability {
|
||||
unsigned int poll_command_supported:1;
|
||||
};
|
||||
|
||||
/* */
|
||||
struct wifi_cipher_capability {
|
||||
unsigned long cipher;
|
||||
};
|
||||
|
||||
/* */
|
||||
struct wifi_capability {
|
||||
struct wifi_device* device;
|
||||
@ -217,7 +203,8 @@ struct wifi_capability {
|
||||
struct wifi_commands_capability supp_cmds;
|
||||
|
||||
/* WIFI_CAPABILITY_CIPHERS */
|
||||
struct capwap_array* ciphers;
|
||||
int ciphers_count;
|
||||
uint32_t *ciphers;
|
||||
|
||||
/* WIFI_CAPABILITY_MAX_SCAN_SSIDS */
|
||||
uint8_t maxscanssids;
|
||||
|
@ -1768,49 +1768,21 @@ static void phydevice_capability_supp_cmds(struct wifi_commands_capability *cmd_
|
||||
static void phydevice_capability_cipher_suites(struct wifi_capability *capability,
|
||||
struct nlattr *tb)
|
||||
{
|
||||
int count, i;
|
||||
uint32_t *ciphers;
|
||||
size_t size;
|
||||
|
||||
if (tb == NULL)
|
||||
return;
|
||||
|
||||
/* */
|
||||
count = nla_len(tb) / sizeof(uint32_t);
|
||||
if (count == 0)
|
||||
size = nla_len(tb);
|
||||
if (size == 0 || (size % sizeof(uint32_t)) != 0)
|
||||
return;
|
||||
|
||||
capability->ciphers = capwap_clone(nla_data(tb), size);
|
||||
if (!capability->ciphers)
|
||||
return;
|
||||
|
||||
capability->ciphers_count = size / sizeof(uint32_t);
|
||||
capability->flags |= WIFI_CAPABILITY_CIPHERS;
|
||||
ciphers = (uint32_t *)nla_data(tb);
|
||||
for (i = 0; i < count; i++) {
|
||||
struct wifi_cipher_capability *ciphercap = (struct wifi_cipher_capability *)
|
||||
capwap_array_get_item_pointer(capability->ciphers, capability->ciphers->count);
|
||||
|
||||
switch (ciphers[i]) {
|
||||
case 0x000fac01:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_WEP40;
|
||||
|
||||
case 0x000fac05:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_WEP104;
|
||||
|
||||
case 0x000fac02:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_TKIP;
|
||||
|
||||
case 0x000fac04:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_CCMP;
|
||||
|
||||
case 0x000fac06:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_CMAC;
|
||||
|
||||
case 0x000fac08:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_GCMP;
|
||||
|
||||
case 0x00147201:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_WPI_SMS4;
|
||||
|
||||
default:
|
||||
ciphercap->cipher = CIPHER_CAPABILITY_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void phydevice_capability_freq(struct wifi_capability *capability,
|
||||
|
@ -172,5 +172,11 @@ int wtp_update_radio_in_use();
|
||||
void wtp_create_radioadmstate_element(struct capwap_packet_txmng* txmngpacket);
|
||||
void wtp_create_radioopsstate_element(struct capwap_packet_txmng* txmngpacket);
|
||||
void wtp_create_80211_wtpradioinformation_element(struct capwap_packet_txmng* txmngpacket);
|
||||
void wtp_create_80211_encryption_capability_elements(struct capwap_packet_txmng *txmngpacket);
|
||||
|
||||
struct wtp_radio;
|
||||
|
||||
void wtp_create_80211_encryption_capability_element(struct capwap_packet_txmng *txmngpacket,
|
||||
struct wtp_radio *radio);
|
||||
|
||||
#endif /* __CAPWAP_WTP_HEADER__ */
|
||||
|
@ -28,6 +28,8 @@ static void cfg_binding_add_ieee80211(struct capwap_packet_txmng* txmngpacket)
|
||||
CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION,
|
||||
&radio->radioinformation);
|
||||
|
||||
wtp_create_80211_encryption_capability_element(txmngpacket, radio);
|
||||
|
||||
if (radio->radioid == radio->radioinformation.radioid)
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_80211_ANTENNA, &radio->antenna);
|
||||
|
||||
|
@ -50,6 +50,7 @@ static void wtp_send_discovery_request()
|
||||
|
||||
if (g_wtp.binding == CAPWAP_WIRELESS_BINDING_IEEE80211) {
|
||||
wtp_create_80211_wtpradioinformation_element(txmngpacket);
|
||||
wtp_create_80211_encryption_capability_elements(txmngpacket);
|
||||
}
|
||||
|
||||
/* CAPWAP_ELEMENT_MTUDISCOVERY */ /* TODO */
|
||||
|
@ -45,8 +45,10 @@ void wtp_dfa_state_join_enter(void)
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_WTPFRAMETUNNELMODE, &g_wtp.mactunnel);
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_WTPMACTYPE, &g_wtp.mactype);
|
||||
|
||||
if (g_wtp.binding == CAPWAP_WIRELESS_BINDING_IEEE80211)
|
||||
if (g_wtp.binding == CAPWAP_WIRELESS_BINDING_IEEE80211) {
|
||||
wtp_create_80211_wtpradioinformation_element(txmngpacket);
|
||||
wtp_create_80211_encryption_capability_elements(txmngpacket);
|
||||
}
|
||||
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_ECNSUPPORT, &g_wtp.ecn);
|
||||
|
||||
|
@ -63,3 +63,39 @@ void wtp_create_80211_wtpradioinformation_element(struct capwap_packet_txmng* tx
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION, &element);
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
void wtp_create_80211_encryption_capability_element(struct capwap_packet_txmng *txmngpacket,
|
||||
struct wtp_radio *radio)
|
||||
{
|
||||
struct capwap_vendor_travelping_80211_encryption_capability_element *element;
|
||||
|
||||
if (!radio->devicehandle->capability->ciphers ||
|
||||
radio->devicehandle->capability->ciphers_count == 0)
|
||||
return;
|
||||
|
||||
element = alloca(sizeof(struct capwap_vendor_travelping_80211_encryption_capability_element) +
|
||||
32 * sizeof(uint32_t));
|
||||
|
||||
/* Set message element */
|
||||
element->radioid = radio->radioid;
|
||||
element->suites_count = radio->devicehandle->capability->ciphers_count;
|
||||
memcpy(element->suites, radio->devicehandle->capability->ciphers,
|
||||
radio->devicehandle->capability->ciphers_count * sizeof(uint32_t));
|
||||
|
||||
capwap_packet_txmng_add_message_element(txmngpacket,
|
||||
CAPWAP_ELEMENT_VENDOR_TRAVELPING_80211_ENCRYPTION_CAPABILITY, element);
|
||||
}
|
||||
|
||||
/* */
|
||||
void wtp_create_80211_encryption_capability_elements(struct capwap_packet_txmng *txmngpacket)
|
||||
{
|
||||
int i;
|
||||
struct wtp_radio* radio;
|
||||
|
||||
for (i = 0; i < g_wtp.radios->count; i++) {
|
||||
radio = (struct wtp_radio*)capwap_array_get_item_pointer(g_wtp.radios, i);
|
||||
|
||||
wtp_create_80211_encryption_capability_element(txmngpacket, radio);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user