use MACSTR and MAC2STR where appropriate

Replace capwap_printf_macaddress with MACSTR and MAC2STR
macro for all EUI48 MAC addresses. Save a text buffer in
the station structure and some buffers in functions.
This commit is contained in:
Andreas Schultz 2016-04-06 12:50:39 +02:00
parent f3fb11ac81
commit c132036914
9 changed files with 100 additions and 82 deletions

View File

@ -170,7 +170,8 @@ static void execute_ieee80211_station_configuration_response_addstation(struct a
station = ac_stations_get_station(session, station80211->radioid, wlan->address, addstation->address);
if (station) {
if (CAPWAP_RESULTCODE_OK(resultcode->code)) {
log_printf(LOG_INFO, "Authorized station: %s", station->addrtext);
log_printf(LOG_INFO, "Authorized station: " MACSTR,
MAC2STR(station->address));
/* */
station->flags |= AC_STATION_FLAGS_AUTHORIZED;
@ -198,7 +199,8 @@ static void execute_ieee80211_station_configuration_response_deletestation(struc
/* */
station = ac_stations_get_station(session, deletestation->radioid, NULL, deletestation->address);
if (station) {
log_printf(LOG_INFO, "Deauthorized station: %s with %d result code", station->addrtext, (int)resultcode->code);
log_printf(LOG_INFO, "Deauthorized station: " MACSTR " with %d result code",
MAC2STR(station->address), (int)resultcode->code);
/* */
ac_stations_delete_station(session, station);

View File

@ -42,7 +42,8 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
}
/* */
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request "
"from " MACSTR " station", MAC2STR(station->address));
/* A station is removed if the association does not complete within a given period of time */
station->timeoutaction = AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE;
@ -62,7 +63,8 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
/* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->authetication.ie[0], ielength)) {
log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request "
"from " MACSTR " station", MAC2STR(station->address));
return;
}
@ -95,14 +97,18 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
if (responselength > 0) {
/* Send authentication response */
if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) {
log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)responsestatuscode);
log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response "
"to " MACSTR " station with %d status code",
MAC2STR(station->address), (int)responsestatuscode);
station->flags |= AC_STATION_FLAGS_AUTHENTICATED;
} else {
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response "
"to " MACSTR " station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
}
} else {
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response "
"to " MACSTR " station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
}
}
@ -117,7 +123,9 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
statuscode = __le16_to_cpu(mgmt->authetication.statuscode);
/* */
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)statuscode);
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Response "
"to " MACSTR " station with %d status code",
MAC2STR(station->address), (int)statuscode);
if (statuscode == IEEE80211_STATUS_SUCCESS) {
algorithm = __le16_to_cpu(mgmt->authetication.algorithm);
@ -155,13 +163,15 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
}
/* */
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request "
"from " MACSTR " station", MAC2STR(station->address));
/* */
wlan = station->wlan;
if (!(station->flags & AC_STATION_FLAGS_AUTHENTICATED)) {
/* Invalid station, delete station */
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext);
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request "
"from " MACSTR " unauthorized station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
return;
}
@ -191,7 +201,8 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
/* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->associationrequest.ie[0], ielength)) {
log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request "
"from " MACSTR " station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
return;
}
@ -237,17 +248,21 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
if (responselength > 0) {
/* Send association response */
if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) {
log_printf(LOG_INFO, "Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode);
log_printf(LOG_INFO, "Sent IEEE802.11 Association Response "
"to " MACSTR " station with %d status code",
MAC2STR(station->address), (int)resultstatuscode);
/* Active Station */
station->flags |= AC_STATION_FLAGS_ASSOCIATE;
ac_stations_authorize_station(session, station);
} else {
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Association Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Association Response "
"to " MACSTR " station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
}
} else {
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Association Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Association Response "
"to " MACSTR " station", MAC2STR(station->address));
ac_stations_delete_station(session, station);
}
}
@ -271,7 +286,9 @@ static void ac_ieee80211_mgmt_association_response_packet(struct ac_session_t* s
if (!memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH) && memcmp(mgmt->bssid, mgmt->da, MACADDRESS_EUI48_LENGTH)) {
station = ac_stations_get_station(session, radioid, mgmt->bssid, mgmt->da);
if (station && station->wlan && (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL)) {
log_printf(LOG_INFO, "Receive IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)mgmt->associationresponse.statuscode);
log_printf(LOG_INFO, "Receive IEEE802.11 Association Response "
"to " MACSTR " station with %d status code",
MAC2STR(station->address), (int)mgmt->associationresponse.statuscode);
if (mgmt->associationresponse.statuscode == IEEE80211_STATUS_SUCCESS) {
/* Get Station Info */

View File

@ -45,7 +45,7 @@ static void ac_stations_destroy_station(struct ac_session_t* session, struct ac_
ASSERT(station != NULL);
/* */
log_printf(LOG_INFO, "Destroy station: %s", station->addrtext);
log_printf(LOG_INFO, "Destroy station: " MACSTR, MAC2STR(station->address));
/* Remove reference from Authoritative Stations List */
capwap_rwlock_wrlock(&g_ac.authstationslock);
@ -139,9 +139,8 @@ void ac_wlans_destroy(struct ac_session_t* session) {
}
/* */
int ac_wlans_assign_bssid(struct ac_session_t* session, struct ac_wlan* wlan) {
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
int ac_wlans_assign_bssid(struct ac_session_t* session, struct ac_wlan* wlan)
{
ASSERT(session != NULL);
ASSERT(session->wlans != NULL);
ASSERT(wlan != NULL);
@ -166,7 +165,8 @@ int ac_wlans_assign_bssid(struct ac_session_t* session, struct ac_wlan* wlan) {
capwap_itemlist_insert_after(session->wlans->devices[wlan->device->radioid - 1].wlans, NULL, wlan->wlanitem);
/* */
log_printf(LOG_INFO, "Added new wlan with radioid: %d, wlanid: %d, bssid: %s", (int)wlan->device->radioid, (int)wlan->wlanid, capwap_printf_macaddress(buffer, wlan->address, MACADDRESS_EUI48_LENGTH));
log_printf(LOG_INFO, "Added new wlan with radioid: %d, wlanid: %d, bssid: " MACSTR,
(int)wlan->device->radioid, (int)wlan->wlanid, MAC2STR(wlan->address));
return 0;
}
@ -325,9 +325,8 @@ struct ac_station* ac_stations_get_station(struct ac_session_t* session, uint8_t
}
/* */
struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint8_t radioid, const uint8_t* bssid, const uint8_t* address) {
char buffer1[CAPWAP_MACADDRESS_EUI48_BUFFER];
char buffer2[CAPWAP_MACADDRESS_EUI48_BUFFER];
struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint8_t radioid, const uint8_t* bssid, const uint8_t* address)
{
struct ac_wlan* wlan;
struct ac_station* authoritativestation;
struct ac_station* station = NULL;
@ -340,9 +339,8 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint
ASSERT(address != NULL);
/* */
capwap_printf_macaddress(buffer1, bssid, MACADDRESS_EUI48_LENGTH);
capwap_printf_macaddress(buffer2, address, MACADDRESS_EUI48_LENGTH);
log_printf(LOG_INFO, "Create station to radioid: %d, bssid: %s, station address: %s", (int)radioid, buffer1, buffer2);
log_printf(LOG_INFO, "Create station to radioid: %d, bssid: " MACSTR ", station address: " MACSTR,
(int)radioid, MAC2STR(bssid), MAC2STR(address));
/* */
wlan = ac_wlans_get_bssid(session, radioid, bssid);
@ -357,7 +355,6 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint
/* */
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;
station->session = session;
@ -392,7 +389,8 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint
}
}
} else {
log_printf(LOG_WARNING, "Unable to find radioid: %d, bssid: %s", (int)radioid, buffer1);
log_printf(LOG_WARNING, "Unable to find radioid: %d, bssid: " MACSTR,
(int)radioid, MAC2STR(bssid));
}
return station;
@ -479,7 +477,8 @@ void ac_stations_timeout(struct capwap_timeout* timeout, unsigned long index, vo
if (station->idtimeout == index) {
switch (station->timeoutaction) {
case AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE: {
log_printf(LOG_WARNING, "The %s station has not completed the association in time", station->addrtext);
log_printf(LOG_WARNING, "The " MACSTR " station has not completed "
"the association in time", MAC2STR(station->address));
ac_stations_delete_station((struct ac_session_t*)param, station);
break;
}

View File

@ -74,7 +74,6 @@ struct ac_wlans {
/* AC Station */
struct ac_station {
uint8_t address[MACADDRESS_EUI48_LENGTH];
char addrtext[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* */
unsigned long flags;

View File

@ -1,9 +1,6 @@
#ifndef __CAPWAP_DEBUG_HEADER__
#define __CAPWAP_DEBUG_HEADER__
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#ifdef DEBUG
#define ASSERT(expr) if (!(expr)) { log_printf(LOG_EMERG, "Assertion failed \'%s\': %s(%d)", #expr, __FILE__, __LINE__); capwap_exit(CAPWAP_ASSERT_CONDITION); }

View File

@ -1,6 +1,9 @@
#ifndef __CAPWAP_LOGGING_HEADER__
#define __CAPWAP_LOGGING_HEADER__
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#include <syslog.h>
#define LOG_TO_SYSLOG

View File

@ -201,7 +201,7 @@ static void wifi_hash_station_free(void* data) {
ASSERT(data != NULL);
/* */
log_printf(LOG_INFO, "Destroy station: %s", station->addrtext);
log_printf(LOG_INFO, "Destroy station: " MACSTR, MAC2STR(station->address));
capwap_free(station);
}
@ -284,7 +284,7 @@ static void wifi_station_delete(struct wifi_station* station)
ASSERT(station != NULL);
/* */
log_printf(LOG_INFO, "Delete station: %s", station->addrtext);
log_printf(LOG_INFO, "Delete station: " MACSTR, MAC2STR(station->address));
/* */
wifi_station_clean(station);
@ -299,28 +299,24 @@ static void wifi_station_delete(struct wifi_station* station)
/* */
static struct wifi_station* wifi_station_create(struct wifi_wlan* wlan, const uint8_t* address) {
struct wifi_station* station;
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
ASSERT(wlan != NULL);
ASSERT(address != NULL);
/* */
capwap_printf_macaddress(buffer, address, MACADDRESS_EUI48_LENGTH);
/* */
station = wifi_station_get(NULL, address);
if (station) {
wtp_kmod_del_station(wlan->radioid, address);
if (station->wlan && (station->wlan != wlan)) {
log_printf(LOG_INFO, "Roaming station: %s", buffer);
log_printf(LOG_INFO, "Roaming station: " MACSTR, MAC2STR(address));
if (station->flags & WIFI_STATION_FLAGS_AUTHENTICATED)
wifi_wlan_send_mgmt_deauthentication(station->wlan,
address,
IEEE80211_REASON_PREV_AUTH_NOT_VALID);
}
log_printf(LOG_INFO, "Reuse station: %s", buffer);
log_printf(LOG_INFO, "Reuse station: " MACSTR, MAC2STR(address));
wifi_station_clean(station);
}
@ -332,7 +328,7 @@ static struct wifi_station* wifi_station_create(struct wifi_wlan* wlan, const ui
/* Create new station */
if (!station) {
log_printf(LOG_INFO, "Create new station: %s", buffer);
log_printf(LOG_INFO, "Create new station: " MACSTR, MAC2STR(address));
/* */
station = (struct wifi_station*)capwap_alloc(sizeof(struct wifi_station));
@ -340,7 +336,6 @@ static struct wifi_station* wifi_station_create(struct wifi_wlan* wlan, const ui
/* Initialize station */
memcpy(station->address, address, MACADDRESS_EUI48_LENGTH);
capwap_printf_macaddress(station->addrtext, address, MACADDRESS_EUI48_LENGTH);
/* Add to pool */
capwap_hash_add(g_wifiglobal.stations, station);
@ -357,10 +352,6 @@ static struct wifi_station* wifi_station_create(struct wifi_wlan* wlan, const ui
static void wifi_wlan_send_mgmt_deauthentication(struct wifi_wlan* wlan, const uint8_t* station, uint16_t reasoncode) {
int responselength;
struct ieee80211_deauthentication_params ieee80211_params;
char stationaddress[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* */
capwap_printf_macaddress(stationaddress, station, MACADDRESS_EUI48_LENGTH);
/* Create deauthentication packet */
memset(&ieee80211_params, 0, sizeof(struct ieee80211_deauthentication_params));
@ -371,15 +362,18 @@ static void wifi_wlan_send_mgmt_deauthentication(struct wifi_wlan* wlan, const u
responselength = ieee80211_create_deauthentication(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), &ieee80211_params);
if (responselength > 0) {
if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) {
log_printf(LOG_INFO, "Sent IEEE802.11 Deuthentication to %s station", stationaddress);
log_printf(LOG_INFO, "Sent IEEE802.11 Deuthentication to " MACSTR " station",
MAC2STR(station));
/* Forwards the station deauthentication also to AC */
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
} else {
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Deuthentication to %s station", stationaddress);
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Deuthentication "
"to " MACSTR " station", MAC2STR(station));
}
} else {
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Deauthentication to %s station", stationaddress);
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Deauthentication "
"to " MACSTR " station", MAC2STR(station));
}
}
@ -417,8 +411,8 @@ static void wifi_station_timeout_deauth(EV_P_ ev_timer *w, int revents)
(((char *)w) - offsetof(struct wifi_station, timeout));
struct wifi_wlan* wlan = (struct wifi_wlan *)w->data;
log_printf(LOG_WARNING, "The %s station has not completed the association in time",
station->addrtext);
log_printf(LOG_WARNING, "The " MACSTR " station has not completed the association in time",
MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID);
}
@ -592,7 +586,6 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
int responselength;
struct ieee80211_authentication_params ieee80211_params;
struct wifi_station* station;
char stationaddress[CAPWAP_MACADDRESS_EUI48_BUFFER];
uint16_t responsestatuscode;
/* Information Elements packet length */
@ -608,24 +601,24 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
return;
}
/* */
capwap_printf_macaddress(stationaddress, frame->sa, MACADDRESS_EUI48_LENGTH);
/* Get ACL Station */
acl = wtp_radio_acl_station(frame->sa);
if (acl == WTP_RADIO_ACL_STATION_DENY) {
log_printf(LOG_INFO, "Denied IEEE802.11 Authentication Request from %s station", stationaddress);
log_printf(LOG_INFO, "Denied IEEE802.11 Authentication Request "
"from " MACSTR " station", MAC2STR(frame->sa));
return;
}
/* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &frame->authetication.ie[0], ielength)) {
log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request from %s station", stationaddress);
log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request "
"from " MACSTR " station", MAC2STR(frame->sa));
return;
}
/* */
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request from %s station", stationaddress);
log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request "
"from " MACSTR " station", MAC2STR(frame->sa));
/* Create station reference */
station = wifi_station_create(wlan, frame->sa);
@ -673,7 +666,9 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
if (responselength > 0) {
/* Send authentication response */
if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) {
log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response to %s station with %d status code", stationaddress, (int)responsestatuscode);
log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response "
"to " MACSTR " station with %d status code",
MAC2STR(frame->sa), (int)responsestatuscode);
/* Notify authentication request message also to AC */
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
@ -681,11 +676,13 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan
/* Forwards the authentication response message also to AC */
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
} else if (station) {
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response to %s station", stationaddress);
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response "
"to " MACSTR " station", MAC2STR(frame->sa));
wifi_station_delete(station);
}
} else if (station) {
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response to %s station", stationaddress);
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response "
"to " MACSTR " station", MAC2STR(frame->sa));
wifi_station_delete(station);
}
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
@ -712,10 +709,9 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
/* Get station reference */
station = wifi_station_get(wlan, frame->sa);
if (!station) {
char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* Invalid station, send deauthentication message */
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unknown station", capwap_printf_macaddress(buffer, frame->sa, MACADDRESS_EUI48_LENGTH));
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request "
"from " MACSTR " unknown station", MAC2STR(frame->sa));
wifi_wlan_send_mgmt_deauthentication(wlan, frame->sa, IEEE80211_REASON_CLASS2_FRAME_FROM_NONAUTH_STA);
return;
}
@ -723,20 +719,23 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
/* */
if (!(station->flags & WIFI_STATION_FLAGS_AUTHENTICATED)) {
/* Invalid station, send deauthentication message */
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext);
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request "
"from " MACSTR " unauthorized station", MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_CLASS2_FRAME_FROM_NONAUTH_STA);
return;
}
/* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &frame->associationrequest.ie[0], ielength)) {
log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request "
"from " MACSTR " station", MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID);
return;
}
/* */
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s station", station->addrtext);
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request "
"from " MACSTR " station", MAC2STR(station->address));
if (ieitems.wmm_ie != NULL && ieitems.wmm_ie->version == 1) {
station->flags |= WIFI_STATION_FLAGS_WMM;
@ -779,7 +778,9 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
responselength = ieee80211_create_associationresponse_response(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), &params);
if (responselength > 0) {
if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) {
log_printf(LOG_INFO, "Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode);
log_printf(LOG_INFO, "Sent IEEE802.11 Association Response "
"to " MACSTR " station with %d status code",
MAC2STR(station->address), (int)resultstatuscode);
/* Notify association request message also to AC */
wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate);
@ -787,11 +788,13 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan*
/* Forwards the association response message also to AC */
wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0);
} else {
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Association Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to send IEEE802.11 Association Response "
"to " MACSTR " station", MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID);
}
} else {
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Association Response to %s station", station->addrtext);
log_printf(LOG_WARNING, "Unable to create IEEE802.11 Association Response "
"to " MACSTR " station", MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID);
}
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {
@ -932,7 +935,8 @@ static void wifi_wlan_receive_station_mgmt_authentication_ack(struct wifi_wlan*
/* Check if authenticate */
if ((algorithm == IEEE80211_AUTHENTICATION_ALGORITHM_OPEN) && (transactionseqnumber == 2)) {
log_printf(LOG_INFO, "IEEE802.11 Authentication complete to %s station", station->addrtext);
log_printf(LOG_INFO, "IEEE802.11 Authentication complete "
"to " MACSTR " station", MAC2STR(station->address));
station->flags |= WIFI_STATION_FLAGS_AUTHENTICATED;
} else if ((algorithm == IEEE80211_AUTHENTICATION_ALGORITHM_SHARED_KEY) && (transactionseqnumber == 4)) {
/* TODO */
@ -959,7 +963,7 @@ static void wifi_wlan_receive_station_mgmt_association_response_ack(struct wifi_
/* */
statuscode = __le16_to_cpu(frame->associationresponse.statuscode);
if (statuscode == IEEE80211_STATUS_SUCCESS) {
log_printf(LOG_INFO, "IEEE802.11 Association complete to %s station", station->addrtext);
log_printf(LOG_INFO, "IEEE802.11 Association complete to " MACSTR " station", MAC2STR(station->address));
/* */
station->flags |= WIFI_STATION_FLAGS_ASSOCIATE;
@ -1047,7 +1051,8 @@ static int wifi_wlan_receive_ac_mgmt_association_response(struct wifi_wlan* wlan
if (station) {
if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) {
if (frame->associationresponse.statuscode != IEEE80211_STATUS_SUCCESS) {
log_printf(LOG_INFO, "AC request deauthentication of station: %s", station->addrtext);
log_printf(LOG_INFO, "AC request deauthentication of station: " MACSTR,
MAC2STR(station->address));
wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID);
}
} else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) {

View File

@ -343,7 +343,6 @@ struct wifi_wlan {
struct wifi_station {
uint8_t address[MACADDRESS_EUI48_LENGTH];
char addrtext[CAPWAP_MACADDRESS_EUI48_BUFFER];
/* */
struct wifi_wlan* wlan;

View File

@ -1097,9 +1097,8 @@ int nl80211_station_authorize(struct wifi_wlan* wlan, struct wifi_station* stati
}
/* */
if (!result) {
log_printf(LOG_INFO, "Authorized station: %s", station->addrtext);
}
if (!result)
log_printf(LOG_INFO, "Authorized station: " MACSTR, MAC2STR(station->address));
/* */
nlmsg_free(msg);
@ -1139,10 +1138,8 @@ int nl80211_station_deauthorize(struct wifi_wlan* wlan, const uint8_t* address)
}
/* */
if (!result) {
char addrtext[CAPWAP_MACADDRESS_EUI48_BUFFER];
log_printf(LOG_INFO, "Deauthorize station: %s", capwap_printf_macaddress(addrtext, address, MACADDRESS_EUI48_LENGTH));
}
if (!result)
log_printf(LOG_INFO, "Deauthorize station: " MACSTR, MAC2STR(address));
/* */
nlmsg_free(msg);