Removed the necessity of having to calculate each time the string of

macaddress stations.
This commit is contained in:
vemax78
2014-04-23 22:39:19 +02:00
parent 1c810c2d72
commit d4d7649f3b
8 changed files with 32 additions and 50 deletions

View File

@ -26,7 +26,6 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_data_t* se
int ielength;
struct ieee80211_ie_items ieitems;
struct ac_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* Parsing Information Elements */
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->authetication));
@ -39,8 +38,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_data_t* se
station = ac_stations_create_station(sessiondata, radioid, mgmt->bssid, mgmt->sa);
/* */
capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH);
capwap_logging_info("Receive IEEE802.11 Authentication Request from %s station", buffer);
capwap_logging_info("Receive IEEE802.11 Authentication Request from %s station", station->addrtext);
/* A station is removed if the association does not complete within a given period of time */
station->timeoutaction = AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE;
@ -63,8 +61,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_data_t* se
statuscode = __le16_to_cpu(mgmt->authetication.statuscode);
/* */
capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH);
capwap_logging_info("Receive IEEE802.11 Authentication Response to %s station with %d status code", buffer, (int)statuscode);
capwap_logging_info("Receive IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)statuscode);
if (statuscode == IEEE80211_STATUS_SUCCESS) {
algorithm = __le16_to_cpu(mgmt->authetication.algorithm);
@ -86,7 +83,6 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_data_
int ielength;
struct ieee80211_ie_items ieitems;
struct ac_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* Parsing Information Elements */
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->associationrequest));
@ -99,8 +95,7 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_data_
station = ac_stations_get_station(sessiondata, radioid, mgmt->bssid, mgmt->sa);
/* */
capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH);
capwap_logging_info("Receive IEEE802.11 Association Request from %s station", buffer);
capwap_logging_info("Receive IEEE802.11 Association Request from %s station", station->addrtext);
/* Get Station Info */
station->capability = __le16_to_cpu(mgmt->associationrequest.capability);
@ -133,7 +128,6 @@ static void ac_ieee80211_mgmt_association_response_packet(struct ac_session_data
int ielength;
struct ieee80211_ie_items ieitems;
struct ac_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* Parsing Information Elements */
ielength = mgmtlength - (sizeof(struct ieee80211_header) + sizeof(mgmt->associationresponse));
@ -145,8 +139,7 @@ static void ac_ieee80211_mgmt_association_response_packet(struct ac_session_data
if (!memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH) && memcmp(mgmt->bssid, mgmt->da, MACADDRESS_EUI48_LENGTH)) {
station = ac_stations_get_station(sessiondata, radioid, mgmt->bssid, mgmt->da);
if (station && (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL)) {
capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH);
capwap_logging_info("Receive IEEE802.11 Association Response to %s station with %d status code", buffer, (int)mgmt->associationresponse.statuscode);
capwap_logging_info("Receive IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)mgmt->associationresponse.statuscode);
if (mgmt->associationresponse.statuscode == IEEE80211_STATUS_SUCCESS) {
/* Get Station Info */

View File

@ -14,14 +14,13 @@
static int ac_session_data_action_add_station_status(struct ac_session_data_t* sessiondata, struct ac_notify_add_station_status* notify) {
struct ac_wlan* wlan;
struct ac_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
wlan = ac_wlans_get_bssid_with_wlanid(sessiondata, notify->radioid, notify->wlanid);
if (wlan) {
station = ac_stations_get_station(sessiondata, notify->radioid, wlan->bssid, notify->address);
if (station) {
if (CAPWAP_RESULTCODE_OK(notify->statuscode)) {
capwap_logging_info("Authorized station: %s", capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH));
capwap_logging_info("Authorized station: %s", station->addrtext);
/* */
station->flags |= AC_STATION_FLAGS_AUTHORIZED;
@ -39,11 +38,10 @@ static int ac_session_data_action_add_station_status(struct ac_session_data_t* s
/* */
static int ac_session_data_action_delete_station_status(struct ac_session_data_t* sessiondata, struct ac_notify_delete_station_status* notify) {
struct ac_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
station = ac_stations_get_station(sessiondata, notify->radioid, NULL, notify->address);
if (station) {
capwap_logging_info("Deauthorized station: %s with %d result code", capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH), (int)notify->statuscode);
capwap_logging_info("Deauthorized station: %s with %d result code", station->addrtext, (int)notify->statuscode);
/* */
ac_stations_delete_station(sessiondata, station);

View File

@ -50,13 +50,11 @@ static void ac_stations_reset_station(struct ac_session_data_t* sessiondata, str
/* */
static void ac_stations_destroy_station(struct ac_session_data_t* sessiondata, struct ac_station* station) {
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
ASSERT(sessiondata != NULL);
ASSERT(station != NULL);
/* */
capwap_logging_info("Destroy station: %s", capwap_printf_macaddress(buffer, station->address, MACADDRESS_EUI48_LENGTH));
capwap_logging_info("Destroy station: %s", station->addrtext);
/* Remove reference from Global Cache Stations List */
ac_stations_delete_station_from_global_cache(sessiondata, station->address);
@ -370,6 +368,7 @@ struct ac_station* ac_stations_create_station(struct ac_session_data_t* sessiond
/* */
station->idtimeout = CAPWAP_TIMEOUT_INDEX_NO_SET;
memcpy(station->address, address, MACADDRESS_EUI48_LENGTH);
capwap_printf_macaddress(station->addrtext, address, MACADDRESS_EUI48_LENGTH);
station->wlanitem = stationitem;
/* */
@ -457,18 +456,14 @@ void ac_stations_deauthorize_station(struct ac_session_data_t* sessiondata, stru
/* */
void ac_stations_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
char stationaddress[CAPWAP_MACADDRESS_EUI48_BUFFER];
struct ac_station* station = (struct ac_station*)context;
ASSERT(station != NULL);
/* */
capwap_printf_macaddress(stationaddress, station->address, MACADDRESS_EUI48_LENGTH);
if (station->idtimeout == index) {
switch (station->timeoutaction) {
case AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE: {
capwap_logging_warning("The %s station has not completed the association in time", stationaddress);
capwap_logging_warning("The %s station has not completed the association in time", station->addrtext);
ac_stations_delete_station((struct ac_session_data_t*)param, station);
break;
}

View File

@ -55,6 +55,9 @@ struct ac_wlan {
/* AC Station */
struct ac_station {
uint8_t address[MACADDRESS_EUI48_LENGTH];
char addrtext[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* */
unsigned long flags;
/* Reference of WLAN */