The capwap data channel migrated from userspace to kernalspace
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include "capwap_element.h"
|
||||
#include "wifi_drivers.h"
|
||||
#include "wtp_radio.h"
|
||||
#include "wtp_kmod.h"
|
||||
|
||||
/* Declare enable wifi driver */
|
||||
#ifdef ENABLE_WIFI_DRIVERS_NL80211
|
||||
@ -314,7 +315,7 @@ static void wifi_wlan_send_mgmt_deauthentication(struct wifi_wlan* wlan, const u
|
||||
capwap_logging_info("Sent IEEE802.11 Deuthentication to %s station", stationaddress);
|
||||
|
||||
/* Forwards the station deauthentication also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 1, 0, 0, 0);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
|
||||
} else {
|
||||
capwap_logging_warning("Unable to send IEEE802.11 Deuthentication to %s station", stationaddress);
|
||||
}
|
||||
@ -419,7 +420,7 @@ static void wifi_wlan_receive_station_mgmt_probe_request(struct wifi_wlan* wlan,
|
||||
if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, nowaitack)) {
|
||||
/* If enable Split Mac send the probe request message to AC */
|
||||
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
}
|
||||
} else {
|
||||
capwap_logging_warning("Unable to send IEEE802.11 Probe Response");
|
||||
@ -583,10 +584,10 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
|
||||
capwap_logging_info("Sent IEEE802.11 Authentication Response to %s station with %d status code", stationaddress, (int)responsestatuscode);
|
||||
|
||||
/* Notify authentication request message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
|
||||
/* Forwards the authentication response message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 1, 0, 0, 0);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
|
||||
} else if (station) {
|
||||
capwap_logging_warning("Unable to send IEEE802.11 Authentication Response to %s station", stationaddress);
|
||||
wifi_station_delete(station);
|
||||
@ -596,7 +597,7 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
|
||||
wifi_station_delete(station);
|
||||
}
|
||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -682,10 +683,10 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
|
||||
capwap_logging_info("Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode);
|
||||
|
||||
/* Notify association request message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
|
||||
/* Forwards the association response message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 1, 0, 0, 0);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
|
||||
} else {
|
||||
capwap_logging_warning("Unable to send IEEE802.11 Association Response to %s station", station->addrtext);
|
||||
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||
@ -695,7 +696,7 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
|
||||
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||
}
|
||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
|
||||
/* Station information */
|
||||
station->capability = __le16_to_cpu(frame->associationresponse.capability);
|
||||
@ -729,7 +730,7 @@ static void wifi_wlan_receive_station_mgmt_disassociation(struct wifi_wlan* wlan
|
||||
/* TODO */
|
||||
|
||||
/* Notify disassociation message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -750,7 +751,7 @@ static void wifi_wlan_receive_station_mgmt_deauthentication(struct wifi_wlan* wl
|
||||
}
|
||||
|
||||
/* Notify deauthentication message also to AC */
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, 1, rssi, snr, rate);
|
||||
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -1479,8 +1480,8 @@ int wifi_wlan_startap(struct wifi_wlan* wlan, struct wlan_startap_params* params
|
||||
wlan->authmode = params->authmode;
|
||||
wlan->macmode = params->macmode;
|
||||
wlan->tunnelmode = params->tunnelmode;
|
||||
wlan->send_frame = params->send_frame;
|
||||
wlan->send_frame_to_ac_cbparam = params->send_frame_to_ac_cbparam;
|
||||
wlan->radioid = params->radioid;
|
||||
wlan->wlanid = params->wlanid;
|
||||
|
||||
/* Start AP */
|
||||
result = wlan->device->instance->ops->wlan_startap(wlan);
|
||||
@ -1655,16 +1656,23 @@ void wifi_wlan_receive_ac_frame(struct wifi_wlan* wlan, struct ieee80211_header*
|
||||
}
|
||||
|
||||
/* */
|
||||
int wifi_wlan_send_frame(struct wifi_wlan* wlan, const uint8_t* data, int length, int nativeframe, uint8_t rssi, uint8_t snr, uint16_t rate) {
|
||||
int wifi_wlan_send_frame(struct wifi_wlan* wlan, const uint8_t* data, int length, uint8_t rssi, uint8_t snr, uint16_t rate) {
|
||||
int result;
|
||||
|
||||
ASSERT(wlan != NULL);
|
||||
ASSERT(wlan->handle != NULL);
|
||||
|
||||
if (!data || (length <= 0) || !wlan->send_frame) {
|
||||
if (!data || (length <= 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* */
|
||||
return wlan->send_frame(wlan->send_frame_to_ac_cbparam, data, length, nativeframe, rssi, snr, rate, wlan->address, MACADDRESS_EUI48_LENGTH);
|
||||
/* Send packet to AC */
|
||||
result = wtp_kmod_send_data(wlan->radioid, data, length, rssi, snr, rate);
|
||||
if (result) {
|
||||
capwap_logging_warning("Unable to sent packet to AC: %d error code", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -1704,23 +1712,17 @@ int wifi_station_authorize(struct wifi_wlan* wlan, struct station_add_params* pa
|
||||
}
|
||||
|
||||
/* */
|
||||
int wifi_station_deauthorize(struct wifi_device* device, const uint8_t* address) {
|
||||
void wifi_station_deauthorize(struct wifi_device* device, const uint8_t* address) {
|
||||
struct wifi_station* station;
|
||||
|
||||
ASSERT(device != NULL);
|
||||
ASSERT(address != NULL);
|
||||
|
||||
/* Get station */
|
||||
/* */
|
||||
station = wifi_station_get(NULL, address);
|
||||
if (!station || !station->wlan) {
|
||||
return -1;
|
||||
if (station && station->wlan) {
|
||||
wifi_wlan_deauthentication_station(station->wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||
}
|
||||
|
||||
/* Station deauthorized */
|
||||
capwap_logging_info("Deauthorize station: %s", station->addrtext);
|
||||
wifi_wlan_deauthentication_station(station->wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
Reference in New Issue
Block a user