Prepare for add station configuration message
This commit is contained in:
parent
127d2f944c
commit
2ec98ac74d
@ -29,6 +29,19 @@ struct ac_notify_addwlan_t {
|
|||||||
char ssid[CAPWAP_ADD_WLAN_SSID_LENGTH + 1];
|
char ssid[CAPWAP_ADD_WLAN_SSID_LENGTH + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Station Configuration IEEE802.11 add station notification */
|
||||||
|
struct ac_notify_station_configuration_ieee8011_add_station {
|
||||||
|
uint8_t radioid;
|
||||||
|
uint8_t address[MACADDRESS_EUI48_LENGTH];
|
||||||
|
uint8_t vlan[CAPWAP_ADDSTATION_VLAN_MAX_LENGTH];
|
||||||
|
|
||||||
|
uint8_t wlanid;
|
||||||
|
uint16_t associationid;
|
||||||
|
uint16_t capabilities;
|
||||||
|
uint8_t supportedratescount;
|
||||||
|
uint8_t supportedrates[CAPWAP_STATION_RATES_MAXLENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
int ac_backend_start(void);
|
int ac_backend_start(void);
|
||||||
void ac_backend_stop(void);
|
void ac_backend_stop(void);
|
||||||
|
@ -7,6 +7,11 @@ static void ac_ieee80211_mgmt_probe_request_packet(struct ac_session_data_t* ses
|
|||||||
int ielength;
|
int ielength;
|
||||||
struct ieee80211_ie_items ieitems;
|
struct ieee80211_ie_items ieitems;
|
||||||
|
|
||||||
|
/* Accept probe request only if not sent by WTP */
|
||||||
|
if (!memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parsing Information Elements */
|
/* Parsing Information Elements */
|
||||||
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->proberequest));
|
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->proberequest));
|
||||||
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->proberequest.ie[0], ielength)) {
|
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->proberequest.ie[0], ielength)) {
|
||||||
@ -28,7 +33,8 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_data_t* se
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create station */
|
/* Create station if sent by station */
|
||||||
|
if (memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH)) {
|
||||||
station = ac_stations_create_station(sessiondata->session, radioid, mgmt->bssid, mgmt->sa);
|
station = ac_stations_create_station(sessiondata->session, radioid, mgmt->bssid, mgmt->sa);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -37,6 +43,16 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_data_t* se
|
|||||||
} else if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
} else if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
station = ac_stations_get_station(sessiondata->session, radioid, mgmt->bssid, mgmt->da);
|
||||||
|
if (station) {
|
||||||
|
if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
||||||
|
/* TODO */
|
||||||
|
} else if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -51,6 +67,40 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_data_
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get station */
|
||||||
|
if (memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH)) {
|
||||||
|
station = ac_stations_get_station(sessiondata->session, radioid, mgmt->bssid, mgmt->sa);
|
||||||
|
|
||||||
|
/* */
|
||||||
|
if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
||||||
|
/* TODO */
|
||||||
|
} else if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
station = ac_stations_get_station(sessiondata->session, radioid, mgmt->bssid, mgmt->da);
|
||||||
|
if (station) {
|
||||||
|
if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
||||||
|
/* TODO */
|
||||||
|
} else if (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
static void ac_ieee80211_mgmt_association_response_packet(struct ac_session_data_t* sessiondata, uint8_t radioid, const struct ieee80211_header_mgmt* mgmt, int mgmtlength) {
|
||||||
|
int ielength;
|
||||||
|
struct ieee80211_ie_items ieitems;
|
||||||
|
struct ac_station* station;
|
||||||
|
|
||||||
|
/* Parsing Information Elements */
|
||||||
|
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->associationresponse));
|
||||||
|
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->associationresponse.ie[0], ielength)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get station */
|
/* Get station */
|
||||||
station = ac_stations_get_station(sessiondata->session, radioid, mgmt->bssid, mgmt->sa);
|
station = ac_stations_get_station(sessiondata->session, radioid, mgmt->bssid, mgmt->sa);
|
||||||
|
|
||||||
@ -76,6 +126,20 @@ static void ac_ieee80211_mgmt_reassociation_request_packet(struct ac_session_dat
|
|||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
static void ac_ieee80211_mgmt_reassociation_response_packet(struct ac_session_data_t* sessiondata, uint8_t radioid, const struct ieee80211_header_mgmt* mgmt, int mgmtlength) {
|
||||||
|
int ielength;
|
||||||
|
struct ieee80211_ie_items ieitems;
|
||||||
|
|
||||||
|
/* Parsing Information Elements */
|
||||||
|
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->reassociationresponse));
|
||||||
|
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->reassociationresponse.ie[0], ielength)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_ieee80211_mgmt_disassociation_packet(struct ac_session_data_t* sessiondata, uint8_t radioid, const struct ieee80211_header_mgmt* mgmt, int mgmtlength) {
|
static void ac_ieee80211_mgmt_disassociation_packet(struct ac_session_data_t* sessiondata, uint8_t radioid, const struct ieee80211_header_mgmt* mgmt, int mgmtlength) {
|
||||||
int ielength;
|
int ielength;
|
||||||
@ -136,6 +200,14 @@ static void ac_ieee80211_mgmt_packet(struct ac_session_data_t* sessiondata, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_ASSOCIATION_RESPONSE: {
|
||||||
|
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->associationresponse))) {
|
||||||
|
ac_ieee80211_mgmt_association_response_packet(sessiondata, radioid, mgmt, mgmtlength);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_REASSOCIATION_REQUEST: {
|
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_REASSOCIATION_REQUEST: {
|
||||||
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->reassociationrequest))) {
|
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->reassociationrequest))) {
|
||||||
ac_ieee80211_mgmt_reassociation_request_packet(sessiondata, radioid, mgmt, mgmtlength);
|
ac_ieee80211_mgmt_reassociation_request_packet(sessiondata, radioid, mgmt, mgmtlength);
|
||||||
@ -144,6 +216,14 @@ static void ac_ieee80211_mgmt_packet(struct ac_session_data_t* sessiondata, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_REASSOCIATION_RESPONSE: {
|
||||||
|
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->reassociationresponse))) {
|
||||||
|
ac_ieee80211_mgmt_reassociation_response_packet(sessiondata, radioid, mgmt, mgmtlength);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_DISASSOCIATION: {
|
case IEEE80211_FRAMECONTROL_MGMT_SUBTYPE_DISASSOCIATION: {
|
||||||
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->disassociation))) {
|
if (mgmtlength >= (sizeof(struct ieee80211_header) + sizeof(mgmt->disassociation))) {
|
||||||
ac_ieee80211_mgmt_disassociation_packet(sessiondata, radioid, mgmt, mgmtlength);
|
ac_ieee80211_mgmt_disassociation_packet(sessiondata, radioid, mgmt, mgmtlength);
|
||||||
|
@ -112,6 +112,13 @@ static int ac_session_action_addwlan(struct ac_session_t* session, struct ac_not
|
|||||||
return AC_ERROR_ACTION_SESSION;
|
return AC_ERROR_ACTION_SESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
static int ac_session_action_station_configuration_ieee8011_add_station(struct ac_session_t* session, struct ac_notify_station_configuration_ieee8011_add_station* notify) {
|
||||||
|
ASSERT(session->requestfragmentpacket->count == 0);
|
||||||
|
|
||||||
|
return AC_ERROR_ACTION_SESSION;
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static int ac_session_action_execute(struct ac_session_t* session, struct ac_session_action* action) {
|
static int ac_session_action_execute(struct ac_session_t* session, struct ac_session_action* action) {
|
||||||
int result = AC_ERROR_ACTION_SESSION;
|
int result = AC_ERROR_ACTION_SESSION;
|
||||||
@ -164,6 +171,15 @@ static int ac_session_action_execute(struct ac_session_t* session, struct ac_ses
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_ADD_STATION: {
|
||||||
|
result = ac_session_action_station_configuration_ieee8011_add_station(session, (struct ac_notify_station_configuration_ieee8011_add_station*)action->data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_DELETE_STATION: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AC_SESSION_ACTION_ROAMING_STATION: {
|
case AC_SESSION_ACTION_ROAMING_STATION: {
|
||||||
/* Delete station */
|
/* Delete station */
|
||||||
ac_stations_delete_station(session, (uint8_t*)action->data);
|
ac_stations_delete_station(session, (uint8_t*)action->data);
|
||||||
|
@ -24,6 +24,8 @@ struct ac_session_control {
|
|||||||
#define AC_SESSION_ACTION_ESTABLISHED_SESSION_DATA 2
|
#define AC_SESSION_ACTION_ESTABLISHED_SESSION_DATA 2
|
||||||
#define AC_SESSION_ACTION_NOTIFY_EVENT 3
|
#define AC_SESSION_ACTION_NOTIFY_EVENT 3
|
||||||
#define AC_SESSION_ACTION_ADDWLAN 4
|
#define AC_SESSION_ACTION_ADDWLAN 4
|
||||||
|
#define AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_ADD_STATION 5
|
||||||
|
#define AC_SESSION_ACTION_STATION_CONFIGURATION_IEEE80211_DELETE_STATION 6
|
||||||
|
|
||||||
#define AC_SESSION_ACTION_ROAMING_STATION 10
|
#define AC_SESSION_ACTION_ROAMING_STATION 10
|
||||||
|
|
||||||
|
@ -978,8 +978,11 @@ static void nl80211_do_mgmt_authentication_event(struct nl80211_wlan_handle* wla
|
|||||||
station->timeoutaction = NL80211_STATION_TIMEOUT_ACTION_DEAUTHENTICATE;
|
station->timeoutaction = NL80211_STATION_TIMEOUT_ACTION_DEAUTHENTICATE;
|
||||||
station->idtimeout = capwap_timeout_set(station->globalhandle->timeout, station->idtimeout, NL80211_STATION_TIMEOUT_ASSOCIATION_COMPLETE, nl80211_station_timeout, station, wlanhandle);
|
station->idtimeout = capwap_timeout_set(station->globalhandle->timeout, station->idtimeout, NL80211_STATION_TIMEOUT_ASSOCIATION_COMPLETE, nl80211_station_timeout, station, wlanhandle);
|
||||||
|
|
||||||
/* Notify authentication message also to AC */
|
/* Notify authentication request message also to AC */
|
||||||
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, mgmt, mgmtlength);
|
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, mgmt, mgmtlength);
|
||||||
|
|
||||||
|
/* Forwards the authentication response message also to AC */
|
||||||
|
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, (struct ieee80211_header_mgmt*)g_bufferIEEE80211, responselength);
|
||||||
} else {
|
} else {
|
||||||
capwap_logging_warning("Unable to send IEEE802.11 Authentication Response to %s station", stationaddress);
|
capwap_logging_warning("Unable to send IEEE802.11 Authentication Response to %s station", stationaddress);
|
||||||
nl80211_station_delete(station);
|
nl80211_station_delete(station);
|
||||||
@ -1148,10 +1151,9 @@ static void nl80211_do_mgmt_association_request_event(struct nl80211_wlan_handle
|
|||||||
capwap_logging_info("Receive IEEE802.11 Association Request from %s station", stationaddress);
|
capwap_logging_info("Receive IEEE802.11 Association Request from %s station", stationaddress);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
if (wlanhandle->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
||||||
resultstatuscode = nl80211_set_station_information(wlanhandle, mgmt, &ieitems, station);
|
resultstatuscode = nl80211_set_station_information(wlanhandle, mgmt, &ieitems, station);
|
||||||
|
|
||||||
/* */
|
|
||||||
if (wlanhandle->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
|
|
||||||
/* Create association response packet */
|
/* Create association response packet */
|
||||||
memset(&ieee80211_params, 0, sizeof(struct ieee80211_authentication_params));
|
memset(&ieee80211_params, 0, sizeof(struct ieee80211_authentication_params));
|
||||||
memcpy(ieee80211_params.bssid, wlanhandle->address, ETH_ALEN);
|
memcpy(ieee80211_params.bssid, wlanhandle->address, ETH_ALEN);
|
||||||
@ -1176,6 +1178,9 @@ static void nl80211_do_mgmt_association_request_event(struct nl80211_wlan_handle
|
|||||||
|
|
||||||
/* Notify association request message also to AC */
|
/* Notify association request message also to AC */
|
||||||
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, mgmt, mgmtlength);
|
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, mgmt, mgmtlength);
|
||||||
|
|
||||||
|
/* Forwards the association response message also to AC */
|
||||||
|
wlanhandle->send_mgmtframe(wlanhandle->send_mgmtframe_to_ac_cbparam, (struct ieee80211_header_mgmt*)g_bufferIEEE80211, responselength);
|
||||||
} else {
|
} else {
|
||||||
capwap_logging_warning("Unable to send IEEE802.11 Association Response to %s station", stationaddress);
|
capwap_logging_warning("Unable to send IEEE802.11 Association Response to %s station", stationaddress);
|
||||||
nl80211_wlan_deauthentication_station(wlanhandle, mgmt->sa, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
nl80211_wlan_deauthentication_station(wlanhandle, mgmt->sa, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user