Fix disconnect station in local mac.
Fix management of AC IEEE802.11 management packet to station.
This commit is contained in:
parent
ebb4eb0c98
commit
1c810c2d72
@ -430,19 +430,16 @@ void ac_stations_deauthorize_station(struct ac_session_data_t* sessiondata, stru
|
|||||||
ASSERT(sessiondata->wlans != NULL);
|
ASSERT(sessiondata->wlans != NULL);
|
||||||
ASSERT(station != NULL);
|
ASSERT(station != NULL);
|
||||||
|
|
||||||
/* Deauthorize station */
|
|
||||||
if (station->flags & AC_STATION_FLAGS_AUTHORIZED) {
|
if (station->flags & AC_STATION_FLAGS_AUTHORIZED) {
|
||||||
|
/* Deauthorize station */
|
||||||
memset(¬ify, 0, sizeof(struct ac_notify_station_configuration_ieee8011_delete_station));
|
memset(¬ify, 0, sizeof(struct ac_notify_station_configuration_ieee8011_delete_station));
|
||||||
notify.radioid = station->wlan->radioid;
|
notify.radioid = station->wlan->radioid;
|
||||||
memcpy(notify.address, station->address, MACADDRESS_EUI48_LENGTH);
|
memcpy(notify.address, station->address, MACADDRESS_EUI48_LENGTH);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
station->flags &= ~AC_STATION_FLAGS_AUTHORIZED;
|
station->flags &= ~(AC_STATION_FLAGS_AUTHENTICATED | AC_STATION_FLAGS_ASSOCIATE | AC_STATION_FLAGS_AUTHORIZED);
|
||||||
ac_session_send_action(sessiondata->session, AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_DELETE_STATION, 0, ¬ify, sizeof(struct ac_notify_station_configuration_ieee8011_delete_station));
|
ac_session_send_action(sessiondata->session, AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_DELETE_STATION, 0, ¬ify, sizeof(struct ac_notify_station_configuration_ieee8011_delete_station));
|
||||||
}
|
} else if (station->flags & AC_STATION_FLAGS_AUTHENTICATED) {
|
||||||
|
|
||||||
/* Deauthenticate station */
|
|
||||||
if (station->flags & AC_STATION_FLAGS_AUTHENTICATED) {
|
|
||||||
/* Create deauthentication packet */
|
/* Create deauthentication packet */
|
||||||
memset(&ieee80211_params, 0, sizeof(struct ieee80211_deauthentication_params));
|
memset(&ieee80211_params, 0, sizeof(struct ieee80211_deauthentication_params));
|
||||||
memcpy(ieee80211_params.bssid, station->wlan->bssid, MACADDRESS_EUI48_LENGTH);
|
memcpy(ieee80211_params.bssid, station->wlan->bssid, MACADDRESS_EUI48_LENGTH);
|
||||||
|
@ -902,21 +902,16 @@ static void wifi_wlan_receive_station_mgmt_ackframe(struct wifi_wlan* wlan, cons
|
|||||||
static int wifi_wlan_receive_ac_mgmt_authentication(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
static int wifi_wlan_receive_ac_mgmt_authentication(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
||||||
int ielength;
|
int ielength;
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
int forwardframe = 1;
|
int forwardframe = 0;
|
||||||
|
|
||||||
/* Information Elements packet length */
|
/* Information Elements packet length */
|
||||||
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->authetication));
|
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->authetication));
|
||||||
if (ielength < 0) {
|
if (ielength >= 0) {
|
||||||
return 0;
|
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
}
|
station = wifi_station_get(wlan, frame->da);
|
||||||
|
if (station) {
|
||||||
/* */
|
/* TODO */
|
||||||
station = wifi_station_get(wlan, frame->da);
|
}
|
||||||
if (station) {
|
|
||||||
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
|
||||||
forwardframe = 0;
|
|
||||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
|
||||||
/* TODO */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,30 +922,23 @@ static int wifi_wlan_receive_ac_mgmt_authentication(struct wifi_wlan* wlan, cons
|
|||||||
static int wifi_wlan_receive_ac_mgmt_association_response(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
static int wifi_wlan_receive_ac_mgmt_association_response(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
||||||
int ielength;
|
int ielength;
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
int forwardframe = 1;
|
int forwardframe = 0;
|
||||||
|
|
||||||
/* Information Elements packet length */
|
/* Information Elements packet length */
|
||||||
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->associationresponse));
|
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->associationresponse));
|
||||||
if (ielength < 0) {
|
if (ielength >= 0) {
|
||||||
return 0;
|
station = wifi_station_get(wlan, frame->da);
|
||||||
}
|
if (station) {
|
||||||
|
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
||||||
|
if (frame->associationresponse.statuscode != IEEE80211_STATUS_SUCCESS) {
|
||||||
|
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
|
||||||
|
|
||||||
/* */
|
capwap_logging_info("AC request deauthentication of station: %s", capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH));
|
||||||
station = wifi_station_get(wlan, frame->da);
|
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||||
if (station) {
|
}
|
||||||
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
|
/* TODO */
|
||||||
|
|
||||||
/* */
|
|
||||||
forwardframe = 0;
|
|
||||||
|
|
||||||
/* */
|
|
||||||
if (frame->associationresponse.statuscode != IEEE80211_STATUS_SUCCESS) {
|
|
||||||
capwap_logging_info("AC request deauthentication of station: %s", capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH));
|
|
||||||
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
|
||||||
}
|
}
|
||||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
|
||||||
/* TODO */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -961,21 +949,16 @@ static int wifi_wlan_receive_ac_mgmt_association_response(struct wifi_wlan* wlan
|
|||||||
static int wifi_wlan_receive_ac_mgmt_reassociation_response(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
static int wifi_wlan_receive_ac_mgmt_reassociation_response(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
||||||
int ielength;
|
int ielength;
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
int forwardframe = 1;
|
int forwardframe = 0;
|
||||||
|
|
||||||
/* Information Elements packet length */
|
/* Information Elements packet length */
|
||||||
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->reassociationresponse));
|
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->reassociationresponse));
|
||||||
if (ielength < 0) {
|
if (ielength >= 0) {
|
||||||
return 0;
|
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
}
|
station = wifi_station_get(wlan, frame->da);
|
||||||
|
if (station) {
|
||||||
/* */
|
/* TODO */
|
||||||
station = wifi_station_get(wlan, frame->da);
|
}
|
||||||
if (station) {
|
|
||||||
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
|
||||||
forwardframe = 0;
|
|
||||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
|
||||||
/* TODO */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,7 +969,6 @@ static int wifi_wlan_receive_ac_mgmt_reassociation_response(struct wifi_wlan* wl
|
|||||||
static int wifi_wlan_receive_ac_mgmt_disassociation(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
static int wifi_wlan_receive_ac_mgmt_disassociation(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
||||||
int ielength;
|
int ielength;
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
int forwardframe = 1;
|
|
||||||
|
|
||||||
/* Information Elements packet length */
|
/* Information Elements packet length */
|
||||||
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->disassociation));
|
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->disassociation));
|
||||||
@ -997,21 +979,23 @@ static int wifi_wlan_receive_ac_mgmt_disassociation(struct wifi_wlan* wlan, cons
|
|||||||
/* */
|
/* */
|
||||||
station = wifi_station_get(wlan, frame->da);
|
station = wifi_station_get(wlan, frame->da);
|
||||||
if (station) {
|
if (station) {
|
||||||
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
/* Deautherize station */
|
||||||
/* TODO */
|
if (station->flags & WIFI_STATION_FLAGS_AUTHORIZED) {
|
||||||
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
station->flags &= ~WIFI_STATION_FLAGS_AUTHORIZED;
|
||||||
/* TODO */
|
wlan->device->instance->ops->station_deauthorize(wlan, station->address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deassociate station */
|
||||||
|
station->flags &= ~WIFI_STATION_FLAGS_ASSOCIATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return forwardframe;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static int wifi_wlan_receive_ac_mgmt_deauthentication(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
static int wifi_wlan_receive_ac_mgmt_deauthentication(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length) {
|
||||||
int ielength;
|
int ielength;
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
int forwardframe = 1;
|
|
||||||
|
|
||||||
/* Information Elements packet length */
|
/* Information Elements packet length */
|
||||||
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->deauthetication));
|
ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->deauthetication));
|
||||||
@ -1019,18 +1003,18 @@ static int wifi_wlan_receive_ac_mgmt_deauthentication(struct wifi_wlan* wlan, co
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean station */
|
/* Delete station */
|
||||||
station = wifi_station_get(wlan, frame->da);
|
station = wifi_station_get(wlan, frame->da);
|
||||||
if (station) {
|
if (station) {
|
||||||
wifi_station_delete(station);
|
wifi_station_delete(station);
|
||||||
}
|
}
|
||||||
|
|
||||||
return forwardframe;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static int wifi_wlan_receive_ac_mgmt_frame(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length, uint16_t framecontrol_subtype) {
|
static int wifi_wlan_receive_ac_mgmt_frame(struct wifi_wlan* wlan, const struct ieee80211_header_mgmt* frame, int length, uint16_t framecontrol_subtype) {
|
||||||
int forwardframe = 1;
|
int forwardframe = 0;
|
||||||
|
|
||||||
switch (framecontrol_subtype) {
|
switch (framecontrol_subtype) {
|
||||||
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_AUTHENTICATION: {
|
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_AUTHENTICATION: {
|
||||||
@ -1665,27 +1649,24 @@ int wifi_station_authorize(struct wifi_wlan* wlan, struct station_add_params* pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
int wifi_station_deauthorize(struct wifi_device* device, struct station_delete_params* params) {
|
int wifi_station_deauthorize(struct wifi_device* device, const uint8_t* address) {
|
||||||
struct wifi_station* station;
|
struct wifi_station* station;
|
||||||
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
|
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
|
||||||
|
|
||||||
ASSERT(device != NULL);
|
ASSERT(device != NULL);
|
||||||
ASSERT(params != NULL);
|
ASSERT(address != NULL);
|
||||||
|
|
||||||
/* Get station */
|
/* Get station */
|
||||||
station = wifi_station_get(NULL, params->address);
|
station = wifi_station_get(NULL, address);
|
||||||
if (!station || !station->wlan) {
|
if (!station || !station->wlan) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!(station->flags & WIFI_STATION_FLAGS_AUTHORIZED)) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
|
||||||
capwap_logging_info("Deauthorize station: %s", capwap_printf_macaddress(buffer, params->address, MACADDRESS_EUI48_LENGTH));
|
|
||||||
|
|
||||||
/* Station deauthorized */
|
/* Station deauthorized */
|
||||||
station->flags &= ~WIFI_STATION_FLAGS_AUTHORIZED;
|
capwap_logging_info("Deauthorize station: %s", capwap_printf_macaddress(buffer, address, MACADDRESS_EUI48_LENGTH));
|
||||||
return device->instance->ops->station_deauthorize(station->wlan, station->address);
|
wifi_wlan_deauthentication_station(station->wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -123,11 +123,6 @@ struct station_add_params {
|
|||||||
uint8_t* address;
|
uint8_t* address;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* */
|
|
||||||
struct station_delete_params {
|
|
||||||
uint8_t* address;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Interface capability */
|
/* Interface capability */
|
||||||
struct wifi_freq_capability {
|
struct wifi_freq_capability {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -423,7 +418,7 @@ void wifi_wlan_receive_ac_frame(struct wifi_wlan* wlan, const struct ieee80211_h
|
|||||||
|
|
||||||
/* Station management */
|
/* Station management */
|
||||||
int wifi_station_authorize(struct wifi_wlan* wlan, struct station_add_params* params);
|
int wifi_station_authorize(struct wifi_wlan* wlan, struct station_add_params* params);
|
||||||
int wifi_station_deauthorize(struct wifi_device* device, struct station_delete_params* params);
|
int wifi_station_deauthorize(struct wifi_device* device, const uint8_t* address);
|
||||||
|
|
||||||
/* Util functions */
|
/* Util functions */
|
||||||
uint32_t wifi_iface_index(const char* ifname);
|
uint32_t wifi_iface_index(const char* ifname);
|
||||||
|
@ -767,7 +767,6 @@ uint32_t wtp_radio_add_station(struct capwap_parsed_packet* packet) {
|
|||||||
/* */
|
/* */
|
||||||
uint32_t wtp_radio_delete_station(struct capwap_parsed_packet* packet) {
|
uint32_t wtp_radio_delete_station(struct capwap_parsed_packet* packet) {
|
||||||
struct wtp_radio* radio;
|
struct wtp_radio* radio;
|
||||||
struct station_delete_params stationparams;
|
|
||||||
struct capwap_deletestation_element* deletestation;
|
struct capwap_deletestation_element* deletestation;
|
||||||
|
|
||||||
/* Get message elements */
|
/* Get message elements */
|
||||||
@ -779,11 +778,7 @@ uint32_t wtp_radio_delete_station(struct capwap_parsed_packet* packet) {
|
|||||||
return CAPWAP_RESULTCODE_FAILURE;
|
return CAPWAP_RESULTCODE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Authorize station */
|
if (wifi_station_deauthorize(radio->devicehandle, deletestation->address)) {
|
||||||
memset(&stationparams, 0, sizeof(struct station_delete_params));
|
|
||||||
stationparams.address = deletestation->address;
|
|
||||||
|
|
||||||
if (wifi_station_deauthorize(radio->devicehandle, &stationparams)) {
|
|
||||||
return CAPWAP_RESULTCODE_FAILURE;
|
return CAPWAP_RESULTCODE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user