switch everything to new log API and drop old one
This commit is contained in:
74
src/ac/ac.c
74
src/ac/ac.c
@ -229,7 +229,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configString, "debug")) {
|
||||
capwap_logging_verboselevel(LOG_DEBUG);
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown logging.level value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown logging.level value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configString, "stderr")) {
|
||||
capwap_logging_enable_console(1);
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown logging.output value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown logging.output value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
/* Set name of AC */
|
||||
if (config_lookup_string(config, "application.name", &configString) == CONFIG_TRUE) {
|
||||
if (strlen(configString) > CAPWAP_ACNAME_MAXLENGTH) {
|
||||
capwap_logging_error("Invalid configuration file, application.name string length exceeded");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, application.name string length exceeded");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(bindingName, "EPCGlobal")) {
|
||||
*binding = CAPWAP_WIRELESS_BINDING_EPCGLOBAL;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.binding value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.binding value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -303,7 +303,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt > 0) && (configInt < 65536)) {
|
||||
g_ac.descriptor.stationlimit = (unsigned short)configInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.descriptor.maxstations value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.maxstations value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt > 0) && (configInt < 65536)) {
|
||||
g_ac.descriptor.maxwtp = (unsigned short)configInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.descriptor.maxwtp value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.maxwtp value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -379,7 +379,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configType, "software")) {
|
||||
type = CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.descriptor.info.type value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.info.type value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -392,19 +392,19 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
strcpy((char*)desc->data, configValue);
|
||||
desc->data[desc->length] = 0;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, application.descriptor.info.value string length exceeded");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, application.descriptor.info.value string length exceeded");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, element application.descriptor.info.value not found");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.value not found");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, element application.descriptor.info.type not found");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.type not found");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, element application.descriptor.info.idvendor not found");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.idvendor not found");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -418,7 +418,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configString, "limited")) {
|
||||
g_ac.dfa.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.ecn value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.ecn value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -429,7 +429,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt >= AC_MIN_DISCOVERY_INTERVAL) && (configInt <= AC_MAX_DISCOVERY_INTERVAL)) {
|
||||
g_ac.dfa.timers.discovery = (unsigned char)(configInt / 1000);
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.timer.discovery value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.discovery value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt >= AC_MIN_ECHO_INTERVAL) && (configInt <= AC_MAX_ECHO_INTERVAL)) {
|
||||
g_ac.dfa.timers.echorequest = (unsigned char)(configInt / 1000);
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.timer.echorequest value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.echorequest value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -448,7 +448,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt > 0) && (configInt < 65536)) {
|
||||
g_ac.dfa.decrypterrorreport_interval = (unsigned short)configInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.timer.decrypterrorreport value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.decrypterrorreport value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -457,7 +457,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if (configInt > 0) {
|
||||
g_ac.dfa.idletimeout.timeout = (unsigned long)configInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.timer.idletimeout value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.idletimeout value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -483,7 +483,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configString, "presharedkey")) {
|
||||
dtlsparam.mode = CAPWAP_DTLS_MODE_PRESHAREDKEY;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.dtls.type value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.dtls.type value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -576,7 +576,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
/* Set interface binding of AC */
|
||||
if (config_lookup_string(config, "application.network.binding", &configString) == CONFIG_TRUE) {
|
||||
if (strlen(configString) > (IFNAMSIZ - 1)) {
|
||||
capwap_logging_error("Invalid configuration file, application.network.binding string length exceeded");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, application.network.binding string length exceeded");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if ((configInt > 0) && (configInt < 65536)) {
|
||||
g_ac.mtu = (unsigned short)configInt;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid application.network.mtu value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid application.network.mtu value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
} else if (!strcmp(configString, "udplite")) {
|
||||
g_ac.dfa.transport.type = CAPWAP_UDPLITE_TRANSPORT;
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unknown application.network.transport value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unknown application.network.transport value");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -633,7 +633,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
/* */
|
||||
server = ac_soapclient_create_server(configString);
|
||||
if (!server) {
|
||||
capwap_logging_error("Invalid configuration file, invalid backend.server value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
/* */
|
||||
configSSL = config_setting_get_member(configServer, "x509");
|
||||
if (!configSSL) {
|
||||
capwap_logging_error("Invalid configuration file, invalid backend.server.x509 value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server.x509 value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -673,11 +673,11 @@ static int ac_parsing_configuration_1_0(config_t* config) {
|
||||
if (calist && certificate && privatekey) {
|
||||
server->sslcontext = capwap_socket_crypto_createcontext(calist, certificate, privatekey);
|
||||
if (!server->sslcontext) {
|
||||
capwap_logging_error("Invalid configuration file, unable to initialize crypto library");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unable to initialize crypto library");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, invalid backend.server.x509 value");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server.x509 value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -707,9 +707,9 @@ static int ac_parsing_configuration(config_t* config) {
|
||||
return ac_parsing_configuration_1_0(config);
|
||||
}
|
||||
|
||||
capwap_logging_error("Invalid configuration file, '%s' is not supported", configString);
|
||||
log_printf(LOG_ERR, "Invalid configuration file, '%s' is not supported", configString);
|
||||
} else {
|
||||
capwap_logging_error("Invalid configuration file, unable to found version tag");
|
||||
log_printf(LOG_ERR, "Invalid configuration file, unable to found version tag");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -738,7 +738,7 @@ static int ac_load_configuration(int argc, char** argv) {
|
||||
if (strlen(optarg) < sizeof(g_configurationfile)) {
|
||||
strcpy(g_configurationfile, optarg);
|
||||
} else {
|
||||
capwap_logging_error("Invalid -%c argument", optopt);
|
||||
log_printf(LOG_ERR, "Invalid -%c argument", optopt);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -747,9 +747,9 @@ static int ac_load_configuration(int argc, char** argv) {
|
||||
|
||||
case '?': {
|
||||
if (optopt == 'c') {
|
||||
capwap_logging_error("Option -%c requires an argument", optopt);
|
||||
log_printf(LOG_ERR, "Option -%c requires an argument", optopt);
|
||||
} else {
|
||||
capwap_logging_error("Unknown option character `\\x%x'", optopt);
|
||||
log_printf(LOG_ERR, "Unknown option character `\\x%x'", optopt);
|
||||
}
|
||||
|
||||
ac_print_usage();
|
||||
@ -766,7 +766,7 @@ static int ac_load_configuration(int argc, char** argv) {
|
||||
result = ac_parsing_configuration(&config);
|
||||
} else {
|
||||
result = -1;
|
||||
capwap_logging_error("Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config));
|
||||
log_printf(LOG_ERR, "Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config));
|
||||
}
|
||||
|
||||
/* Free libconfig */
|
||||
@ -778,7 +778,7 @@ static int ac_load_configuration(int argc, char** argv) {
|
||||
static int ac_configure(void) {
|
||||
/* Bind control channel to any address */
|
||||
if (capwap_bind_sockets(&g_ac.net)) {
|
||||
capwap_logging_fatal("Cannot bind address");
|
||||
log_printf(LOG_EMERG, "Cannot bind address");
|
||||
return AC_ERROR_NETWORK;
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
/* Init capwap */
|
||||
if (geteuid() != 0) {
|
||||
capwap_logging_fatal("Request root privileges");
|
||||
log_printf(LOG_EMERG, "Request root privileges");
|
||||
return CAPWAP_REQUEST_ROOT;
|
||||
}
|
||||
|
||||
@ -830,7 +830,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
/* Init crypt */
|
||||
if (capwap_crypt_init()) {
|
||||
capwap_logging_fatal("Error to init crypt engine");
|
||||
log_printf(LOG_EMERG, "Error to init crypt engine");
|
||||
return CAPWAP_CRYPT_ERROR;
|
||||
}
|
||||
|
||||
@ -852,7 +852,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
/* Console logging is disabled in daemon mode */
|
||||
capwap_logging_disable_console();
|
||||
capwap_logging_info("Running AC in daemon mode");
|
||||
log_printf(LOG_INFO, "Running AC in daemon mode");
|
||||
}
|
||||
|
||||
/* Complete configuration AC */
|
||||
@ -862,18 +862,18 @@ int main(int argc, char** argv) {
|
||||
if (!ac_kmod_init()) {
|
||||
/* Bind data channel */
|
||||
if (!ac_kmod_createdatachannel(g_ac.net.localaddr.ss.ss_family, CAPWAP_GET_NETWORK_PORT(&g_ac.net.localaddr) + 1)) {
|
||||
capwap_logging_info("SmartCAPWAP kernel module connected");
|
||||
log_printf(LOG_INFO, "SmartCAPWAP kernel module connected");
|
||||
|
||||
/* Running AC */
|
||||
result = ac_execute();
|
||||
} else {
|
||||
capwap_logging_fatal("Unable to create kernel data channel");
|
||||
log_printf(LOG_EMERG, "Unable to create kernel data channel");
|
||||
}
|
||||
|
||||
/* Disconnect kernel module */
|
||||
ac_kmod_free();
|
||||
} else {
|
||||
capwap_logging_fatal("Unable to connect to kernel module");
|
||||
log_printf(LOG_EMERG, "Unable to connect to kernel module");
|
||||
}
|
||||
|
||||
/* Close connection */
|
||||
|
@ -66,7 +66,7 @@ static int ac_backend_parsing_closewtpsession_event(const char* idevent, struct
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t));
|
||||
|
||||
/* Async close session */
|
||||
capwap_logging_debug("Receive close wtp session for WTP %s", session->wtpid);
|
||||
log_printf(LOG_DEBUG, "Receive close wtp session for WTP %s", session->wtpid);
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_CLOSE, 0, NULL, 0);
|
||||
|
||||
/* */
|
||||
@ -138,7 +138,7 @@ static int ac_backend_parsing_resetwtp_event(const char* idevent, struct json_ob
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t));
|
||||
|
||||
/* Notify Action */
|
||||
capwap_logging_debug("Receive reset request for WTP %s", session->wtpid);
|
||||
log_printf(LOG_DEBUG, "Receive reset request for WTP %s", session->wtpid);
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_RESET_WTP, 0, (void*)reset, length);
|
||||
result = 0;
|
||||
|
||||
@ -289,7 +289,7 @@ static int ac_backend_parsing_addwlan_event(const char* idevent, struct json_obj
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t));
|
||||
|
||||
/* Notify Action */
|
||||
capwap_logging_debug("Receive AddWLAN request for WTP %s with SSID: %s", session->wtpid, addwlan->ssid);
|
||||
log_printf(LOG_DEBUG, "Receive AddWLAN request for WTP %s with SSID: %s", session->wtpid, addwlan->ssid);
|
||||
ac_session_send_action(session, AC_SESSION_ACTION_ADDWLAN, 0, (void*)addwlan, length);
|
||||
|
||||
/* */
|
||||
@ -506,7 +506,7 @@ static int ac_backend_soap_join(int forcereset) {
|
||||
/* Retrieve AC configuration */
|
||||
if (g_ac_backend.backendsessionid && forcereset) {
|
||||
if (ac_backend_soap_getconfiguration()) {
|
||||
capwap_logging_error("Unable to get AC configuration from Backend Server");
|
||||
log_printf(LOG_ERR, "Unable to get AC configuration from Backend Server");
|
||||
capwap_free(g_ac_backend.backendsessionid);
|
||||
g_ac_backend.backendsessionid = NULL;
|
||||
}
|
||||
@ -725,7 +725,7 @@ static void ac_backend_run(void) {
|
||||
|
||||
/* Connection error, change Backend Server */
|
||||
connected = 0;
|
||||
capwap_logging_debug("Lost connection with Backend Server");
|
||||
log_printf(LOG_DEBUG, "Lost connection with Backend Server");
|
||||
capwap_lock_enter(&g_ac_backend.backendlock);
|
||||
|
||||
/* Lost session id */
|
||||
@ -738,7 +738,7 @@ static void ac_backend_run(void) {
|
||||
} else {
|
||||
/* Join with a Backend Server */
|
||||
if (!ac_backend_soap_join(forcereset)) {
|
||||
capwap_logging_debug("Joined with Backend Server");
|
||||
log_printf(LOG_DEBUG, "Joined with Backend Server");
|
||||
|
||||
/* Join Complete */
|
||||
connected = 1;
|
||||
@ -753,7 +753,7 @@ static void ac_backend_run(void) {
|
||||
|
||||
/* Wait timeout before continue */
|
||||
if (g_ac_backend.errorjoinbackend >= g_ac.availablebackends->count) {
|
||||
capwap_logging_debug("Unable to join with Backend Server");
|
||||
log_printf(LOG_DEBUG, "Unable to join with Backend Server");
|
||||
|
||||
/* */
|
||||
forcereset = 1;
|
||||
@ -792,9 +792,9 @@ static void ac_backend_run(void) {
|
||||
|
||||
/* */
|
||||
static void* ac_backend_thread(void* param) {
|
||||
capwap_logging_debug("Backend start");
|
||||
log_printf(LOG_DEBUG, "Backend start");
|
||||
ac_backend_run();
|
||||
capwap_logging_debug("Backend stop");
|
||||
log_printf(LOG_DEBUG, "Backend stop");
|
||||
|
||||
/* Thread exit */
|
||||
pthread_exit(NULL);
|
||||
@ -843,13 +843,13 @@ int ac_backend_start(void) {
|
||||
|
||||
/* */
|
||||
if (!g_ac.backendacid) {
|
||||
capwap_logging_error("AC Backend ID isn't set");
|
||||
log_printf(LOG_ERR, "AC Backend ID isn't set");
|
||||
return 0;
|
||||
} else if (!g_ac.backendversion) {
|
||||
capwap_logging_error("Backend Protocol Version isn't set");
|
||||
log_printf(LOG_ERR, "Backend Protocol Version isn't set");
|
||||
return 0;
|
||||
} else if (!g_ac.availablebackends->count) {
|
||||
capwap_logging_error("List of available backends is empty");
|
||||
log_printf(LOG_ERR, "List of available backends is empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -861,7 +861,7 @@ int ac_backend_start(void) {
|
||||
/* Create thread */
|
||||
result = pthread_create(&g_ac_backend.threadid, NULL, ac_backend_thread, NULL);
|
||||
if (result) {
|
||||
capwap_logging_debug("Unable create backend thread");
|
||||
log_printf(LOG_DEBUG, "Unable create backend thread");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,7 @@ void ac_dfa_state_configure(struct ac_session_t* session, struct capwap_parsed_p
|
||||
/* Send Configure response to WTP */
|
||||
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
|
||||
/* Response is already created and saved. When receive a re-request, DFA autoresponse */
|
||||
capwap_logging_debug("Warning: error to send configuration status response packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send configuration status response packet");
|
||||
}
|
||||
|
||||
/* Change state */
|
||||
|
@ -205,7 +205,7 @@ void ac_dfa_state_datacheck(struct ac_session_t* session, struct capwap_parsed_p
|
||||
/* Send Change event response to WTP */
|
||||
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
|
||||
/* Response is already created and saved. When receive a re-request, DFA autoresponse */
|
||||
capwap_logging_debug("Warning: error to send change event response packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send change event response packet");
|
||||
}
|
||||
|
||||
/* Change state */
|
||||
|
@ -590,7 +590,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet
|
||||
resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_UNKNOWN_SOURCE;
|
||||
}
|
||||
} else {
|
||||
capwap_logging_info("WTP Id %s already used in another session", wtpid);
|
||||
log_printf(LOG_INFO, "WTP Id %s already used in another session", wtpid);
|
||||
resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_UNKNOWN_SOURCE;
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet
|
||||
char sessionname[33];
|
||||
|
||||
capwap_sessionid_printf(sessionid, sessionname);
|
||||
capwap_logging_info("Session Id %s already used in another session", sessionname);
|
||||
log_printf(LOG_INFO, "Session Id %s already used in another session", sessionname);
|
||||
|
||||
resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_ID_ALREADY_IN_USE;
|
||||
}
|
||||
@ -657,7 +657,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet
|
||||
}
|
||||
} else {
|
||||
/* Error to send packets */
|
||||
capwap_logging_debug("Warning: error to send join response packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send join response packet");
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void ac_dfa_state_reset(struct ac_session_t* session, struct capwap_parsed_packe
|
||||
/* Check the success of the Request */
|
||||
resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE);
|
||||
if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) {
|
||||
capwap_logging_warning("Receive Reset Response with error: %d", (int)resultcode->code);
|
||||
log_printf(LOG_WARNING, "Receive Reset Response with error: %d", (int)resultcode->code);
|
||||
}
|
||||
|
||||
/* */
|
||||
|
@ -58,14 +58,14 @@ static int receive_echo_request(struct ac_session_t* session, struct capwap_pars
|
||||
{
|
||||
char sessionname[33];
|
||||
capwap_sessionid_printf(&session->sessionid, sessionname);
|
||||
capwap_logging_debug("Send Echo Response to %s", sessionname);
|
||||
log_printf(LOG_DEBUG, "Send Echo Response to %s", sessionname);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Send Configure response to WTP */
|
||||
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
|
||||
/* Response is already created and saved. When receive a re-request, DFA autoresponse */
|
||||
capwap_logging_debug("Warning: error to send echo response packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send echo response packet");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -88,7 +88,7 @@ static void execute_ieee80211_wlan_configuration_addwlan(struct ac_session_t* se
|
||||
|
||||
/* Assign BSSID to session */
|
||||
if (ac_wlans_assign_bssid(session, wlan)) {
|
||||
capwap_logging_warning("Unable to add new wlan with radioid: %d, wlanid: %d", (int)assignbssid->radioid, (int)assignbssid->wlanid);
|
||||
log_printf(LOG_WARNING, "Unable to add new wlan with radioid: %d, wlanid: %d", (int)assignbssid->radioid, (int)assignbssid->wlanid);
|
||||
ac_wlans_free_bssid(wlan);
|
||||
|
||||
/* TODO: add remove wlan from wtp */
|
||||
@ -142,7 +142,7 @@ static void receive_ieee80211_wlan_configuration_response(struct ac_session_t* s
|
||||
capwap_packet_rxmng_free(rxmngrequestpacket);
|
||||
}
|
||||
} else {
|
||||
capwap_logging_warning("Receive IEEE802.11 WLAN Configuration Response with error: %d", (int)resultcode->code);
|
||||
log_printf(LOG_WARNING, "Receive IEEE802.11 WLAN Configuration Response with error: %d", (int)resultcode->code);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -170,7 +170,7 @@ 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)) {
|
||||
capwap_logging_info("Authorized station: %s", station->addrtext);
|
||||
log_printf(LOG_INFO, "Authorized station: %s", station->addrtext);
|
||||
|
||||
/* */
|
||||
station->flags |= AC_STATION_FLAGS_AUTHORIZED;
|
||||
@ -198,7 +198,7 @@ static void execute_ieee80211_station_configuration_response_deletestation(struc
|
||||
/* */
|
||||
station = ac_stations_get_station(session, deletestation->radioid, NULL, deletestation->address);
|
||||
if (station) {
|
||||
capwap_logging_info("Deauthorized station: %s with %d result code", station->addrtext, (int)resultcode->code);
|
||||
log_printf(LOG_INFO, "Deauthorized station: %s with %d result code", station->addrtext, (int)resultcode->code);
|
||||
|
||||
/* */
|
||||
ac_stations_delete_station(session, station);
|
||||
@ -258,7 +258,7 @@ void ac_dfa_state_run(struct ac_session_t* session, struct capwap_parsed_packet*
|
||||
{
|
||||
char sessionname[33];
|
||||
capwap_sessionid_printf(&session->sessionid, sessionname);
|
||||
capwap_logging_debug("Receive Echo Request from %s", sessionname);
|
||||
log_printf(LOG_DEBUG, "Receive Echo Request from %s", sessionname);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -167,7 +167,7 @@ static void ac_discovery_run(void) {
|
||||
struct capwap_packet_txmng* txmngpacket;
|
||||
|
||||
/* */
|
||||
capwap_logging_debug("Receive discovery request packet");
|
||||
log_printf(LOG_DEBUG, "Receive discovery request packet");
|
||||
|
||||
/* Creare discovery response */
|
||||
txmngpacket = ac_create_discovery_response(&packet);
|
||||
@ -186,7 +186,7 @@ static void ac_discovery_run(void) {
|
||||
|
||||
/* Send discovery response to WTP */
|
||||
if (!capwap_sendto_fragmentpacket(acpacket->sendsock, responsefragmentpacket, &acpacket->sender)) {
|
||||
capwap_logging_debug("Warning: error to send discovery response packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send discovery response packet");
|
||||
}
|
||||
|
||||
/* Don't buffering a packets sent */
|
||||
@ -211,9 +211,9 @@ static void ac_discovery_run(void) {
|
||||
/* */
|
||||
static void* ac_discovery_thread(void* param) {
|
||||
|
||||
capwap_logging_debug("Discovery start");
|
||||
log_printf(LOG_DEBUG, "Discovery start");
|
||||
ac_discovery_run();
|
||||
capwap_logging_debug("Discovery stop");
|
||||
log_printf(LOG_DEBUG, "Discovery stop");
|
||||
|
||||
/* Thread exit */
|
||||
pthread_exit(NULL);
|
||||
@ -234,7 +234,7 @@ int ac_discovery_start(void) {
|
||||
/* Create thread */
|
||||
result = pthread_create(&g_ac_discovery.threadid, NULL, ac_discovery_thread, NULL);
|
||||
if (result) {
|
||||
capwap_logging_debug("Unable create discovery thread");
|
||||
log_printf(LOG_DEBUG, "Unable create discovery thread");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void ac_session_msgqueue_parsing_item(struct ac_session_msgqueue_item_t*
|
||||
}
|
||||
|
||||
default: {
|
||||
capwap_logging_debug("Unknown message queue item: %lu", item->message);
|
||||
log_printf(LOG_DEBUG, "Unknown message queue item: %lu", item->message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -215,11 +215,11 @@ static void ac_wait_terminate_allsessions(void) {
|
||||
|
||||
/* Wait that list is empty */
|
||||
while (g_ac.sessionsthread->count > 0) {
|
||||
capwap_logging_debug("Waiting for %d session terminate", g_ac.sessionsthread->count);
|
||||
log_printf(LOG_DEBUG, "Waiting for %d session terminate", g_ac.sessionsthread->count);
|
||||
|
||||
/* Receive message queue packet */
|
||||
if (!ac_recvmsgqueue(g_ac.fdmsgsessions[1], &item)) {
|
||||
capwap_logging_debug("Unable to receive message queue");
|
||||
log_printf(LOG_DEBUG, "Unable to receive message queue");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ static void ac_wait_terminate_allsessions(void) {
|
||||
}
|
||||
}
|
||||
|
||||
capwap_logging_debug("Close all sessions");
|
||||
log_printf(LOG_DEBUG, "Close all sessions");
|
||||
}
|
||||
|
||||
/* Initialize message queue */
|
||||
@ -682,7 +682,7 @@ static struct ac_session_t* ac_create_session(int sock, union sockaddr_capwap* f
|
||||
/* */
|
||||
capwap_itemlist_insert_after(g_ac.sessionsthread, NULL, itemlist);
|
||||
} else {
|
||||
capwap_logging_fatal("Unable create session thread, error code %d", result);
|
||||
log_printf(LOG_EMERG, "Unable create session thread, error code %d", result);
|
||||
capwap_exit(CAPWAP_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
@ -828,7 +828,7 @@ int ac_execute(void) {
|
||||
|
||||
/* Set file descriptor pool */
|
||||
if (ac_execute_init_fdspool(&fds, &g_ac.net, g_ac.fdmsgsessions[1]) <= 0) {
|
||||
capwap_logging_debug("Unable to initialize file descriptor pool");
|
||||
log_printf(LOG_DEBUG, "Unable to initialize file descriptor pool");
|
||||
return AC_ERROR_SYSTEM_FAILER;
|
||||
}
|
||||
|
||||
@ -841,7 +841,7 @@ int ac_execute(void) {
|
||||
/* Start discovery thread */
|
||||
if (!ac_discovery_start()) {
|
||||
ac_execute_free_fdspool(&fds);
|
||||
capwap_logging_debug("Unable to start discovery thread");
|
||||
log_printf(LOG_DEBUG, "Unable to start discovery thread");
|
||||
return AC_ERROR_SYSTEM_FAILER;
|
||||
}
|
||||
|
||||
@ -849,7 +849,7 @@ int ac_execute(void) {
|
||||
if (!ac_backend_start()) {
|
||||
ac_execute_free_fdspool(&fds);
|
||||
ac_discovery_stop();
|
||||
capwap_logging_error("Unable start backend management");
|
||||
log_printf(LOG_ERR, "Unable start backend management");
|
||||
return AC_ERROR_SYSTEM_FAILER;
|
||||
}
|
||||
|
||||
@ -859,7 +859,7 @@ int ac_execute(void) {
|
||||
buffersize = sizeof(buffer);
|
||||
index = ac_recvfrom(&fds, buffer, &buffersize, &fromaddr, &toaddr);
|
||||
if (!g_ac.running) {
|
||||
capwap_logging_debug("Closing AC");
|
||||
log_printf(LOG_DEBUG, "Closing AC");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_logging_info("Receive IEEE802.11 Authentication Request from %s station", station->addrtext);
|
||||
log_printf(LOG_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;
|
||||
@ -62,7 +62,7 @@ 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)) {
|
||||
capwap_logging_info("Invalid IEEE802.11 Authentication Request from %s station", station->addrtext);
|
||||
log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request from %s station", station->addrtext);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,14 +95,14 @@ 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)) {
|
||||
capwap_logging_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 %s station with %d status code", station->addrtext, (int)responsestatuscode);
|
||||
station->flags |= AC_STATION_FLAGS_AUTHENTICATED;
|
||||
} else {
|
||||
capwap_logging_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 %s station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
}
|
||||
} else {
|
||||
capwap_logging_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 %s station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
|
||||
statuscode = __le16_to_cpu(mgmt->authetication.statuscode);
|
||||
|
||||
/* */
|
||||
capwap_logging_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 %s station with %d status code", station->addrtext, (int)statuscode);
|
||||
|
||||
if (statuscode == IEEE80211_STATUS_SUCCESS) {
|
||||
algorithm = __le16_to_cpu(mgmt->authetication.algorithm);
|
||||
@ -155,13 +155,13 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
|
||||
}
|
||||
|
||||
/* */
|
||||
capwap_logging_info("Receive IEEE802.11 Association Request from %s station", station->addrtext);
|
||||
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s station", station->addrtext);
|
||||
|
||||
/* */
|
||||
wlan = station->wlan;
|
||||
if (!(station->flags & AC_STATION_FLAGS_AUTHENTICATED)) {
|
||||
/* Invalid station, delete station */
|
||||
capwap_logging_info("Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext);
|
||||
log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
return;
|
||||
}
|
||||
@ -191,7 +191,7 @@ 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)) {
|
||||
capwap_logging_info("Invalid IEEE802.11 Association Request from %s station", station->addrtext);
|
||||
log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request from %s station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
return;
|
||||
}
|
||||
@ -237,17 +237,17 @@ 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)) {
|
||||
capwap_logging_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 %s station with %d status code", station->addrtext, (int)resultstatuscode);
|
||||
|
||||
/* Active Station */
|
||||
station->flags |= AC_STATION_FLAGS_ASSOCIATE;
|
||||
ac_stations_authorize_station(session, station);
|
||||
} else {
|
||||
capwap_logging_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 %s station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
}
|
||||
} else {
|
||||
capwap_logging_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 %s station", station->addrtext);
|
||||
ac_stations_delete_station(session, station);
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ 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)) {
|
||||
capwap_logging_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 %s station with %d status code", station->addrtext, (int)mgmt->associationresponse.statuscode);
|
||||
|
||||
if (mgmt->associationresponse.statuscode == IEEE80211_STATUS_SUCCESS) {
|
||||
/* Get Station Info */
|
||||
|
@ -191,7 +191,7 @@ static int ac_kmod_link(void) {
|
||||
if (result == -EALREADY) {
|
||||
result = 0;
|
||||
} else {
|
||||
capwap_logging_warning("Unable to connect kernel module, error code: %d", result);
|
||||
log_printf(LOG_WARNING, "Unable to connect kernel module, error code: %d", result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ static void ac_kmod_event_receive(int fd, void** params, int paramscount) {
|
||||
/* */
|
||||
res = nl_recvmsgs((struct nl_sock*)params[0], (struct nl_cb*)params[1]);
|
||||
if (res) {
|
||||
capwap_logging_warning("Receive kernel module message failed: %d", res);
|
||||
log_printf(LOG_WARNING, "Receive kernel module message failed: %d", res);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,12 +233,12 @@ int ac_kmod_send_keepalive(struct capwap_sessionid_element* sessionid) {
|
||||
nla_put(msg, NLSMARTCAPWAP_ATTR_SESSION_ID, sizeof(struct capwap_sessionid_element), sessionid);
|
||||
|
||||
/* */
|
||||
capwap_logging_debug("Prepare to send keep-alive");
|
||||
log_printf(LOG_DEBUG, "Prepare to send keep-alive");
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to send keep-alive: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to send keep-alive: %d", result);
|
||||
}
|
||||
capwap_logging_debug("Sent keep-alive");
|
||||
log_printf(LOG_DEBUG, "Sent keep-alive");
|
||||
|
||||
/* */
|
||||
nlmsg_free(msg);
|
||||
@ -270,7 +270,7 @@ int ac_kmod_send_data(struct capwap_sessionid_element* sessionid, uint8_t radioi
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to send data: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to send data: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -342,7 +342,7 @@ int ac_kmod_createdatachannel(int family, unsigned short port) {
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to bind kernel socket: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to bind kernel socket: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -372,7 +372,7 @@ int ac_kmod_new_datasession(struct capwap_sessionid_element* sessionid, uint8_t
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to create data session: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to create data session: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -400,7 +400,7 @@ int ac_kmod_delete_datasession(struct capwap_sessionid_element* sessionid) {
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result && (result != ENOENT)) {
|
||||
capwap_logging_error("Unable to delete data session: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to delete data session: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -436,7 +436,7 @@ int ac_kmod_addwlan(struct capwap_sessionid_element* sessionid, uint8_t radioid,
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to add wlan: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to add wlan: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -464,7 +464,7 @@ int ac_kmod_removewlan(struct capwap_sessionid_element* sessionid) {
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result && (result != ENOENT)) {
|
||||
capwap_logging_error("Unable to remove wlan: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to remove wlan: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -512,7 +512,7 @@ int ac_kmod_create_iface(const char* ifname, uint16_t mtu) {
|
||||
if (!result) {
|
||||
result = (ifindex ? (int)ifindex : -1);
|
||||
} else {
|
||||
capwap_logging_error("Unable to create data session: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to create data session: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -540,7 +540,7 @@ int ac_kmod_delete_iface(int ifindex) {
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result && (result != ENOENT)) {
|
||||
capwap_logging_error("Unable to delete interface: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to delete interface: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -580,7 +580,7 @@ int ac_kmod_authorize_station(struct capwap_sessionid_element* sessionid, const
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to authorize station: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to authorize station: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -610,7 +610,7 @@ int ac_kmod_deauthorize_station(struct capwap_sessionid_element* sessionid, cons
|
||||
/* */
|
||||
result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
|
||||
if (result) {
|
||||
capwap_logging_error("Unable to deauthorize station: %d", result);
|
||||
log_printf(LOG_ERR, "Unable to deauthorize station: %d", result);
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -644,7 +644,7 @@ int ac_kmod_init(void) {
|
||||
/* Get nlsmartcapwap netlink family */
|
||||
g_ac.kmodhandle.nlsmartcapwap_id = genl_ctrl_resolve(g_ac.kmodhandle.nl, NLSMARTCAPWAP_GENL_NAME);
|
||||
if (g_ac.kmodhandle.nlsmartcapwap_id < 0) {
|
||||
capwap_logging_warning("Unable to found kernel module");
|
||||
log_printf(LOG_WARNING, "Unable to found kernel module");
|
||||
ac_kmod_free();
|
||||
return -1;
|
||||
}
|
||||
|
@ -165,12 +165,12 @@ static int ac_session_action_authorizestation_response(struct ac_session_t* sess
|
||||
session->retransmitcount = 0;
|
||||
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
|
||||
} else {
|
||||
capwap_logging_warning("Unable to authorize station into kernel module data channel");
|
||||
log_printf(LOG_WARNING, "Unable to authorize station into kernel module data channel");
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
} else {
|
||||
capwap_logging_debug("Warning: error to send Station Configuration Request packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send Station Configuration Request packet");
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
@ -219,7 +219,7 @@ static int ac_session_action_resetwtp(struct ac_session_t* session, struct ac_no
|
||||
ac_dfa_change_state(session, CAPWAP_RESET_STATE);
|
||||
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
|
||||
} else {
|
||||
capwap_logging_debug("Warning: error to send Reset Request packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send Reset Request packet");
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
@ -279,7 +279,7 @@ static int ac_session_action_addwlan(struct ac_session_t* session, struct ac_not
|
||||
session->retransmitcount = 0;
|
||||
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
|
||||
} else {
|
||||
capwap_logging_debug("Warning: error to send WLAN Configuration Request packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send WLAN Configuration Request packet");
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
@ -302,7 +302,7 @@ static int ac_session_action_station_configuration_ieee8011_add_station(struct a
|
||||
response = ac_session_action_authorizestation_request(session, notify->radioid, notify->wlanid, notify->address);
|
||||
if (response) {
|
||||
if (ac_session_action_authorizestation_response(session, response, notify)) {
|
||||
capwap_logging_info("Station is not authorized");
|
||||
log_printf(LOG_INFO, "Station is not authorized");
|
||||
/* TODO kickoff station */
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ static int ac_session_action_station_configuration_ieee8011_delete_station(struc
|
||||
session->retransmitcount = 0;
|
||||
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
|
||||
} else {
|
||||
capwap_logging_debug("Warning: error to send Station Configuration Request packet");
|
||||
log_printf(LOG_DEBUG, "Warning: error to send Station Configuration Request packet");
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
}
|
||||
@ -399,7 +399,7 @@ static int ac_session_action_execute(struct ac_session_t* session, struct ac_ses
|
||||
{
|
||||
char sessionname[33];
|
||||
capwap_sessionid_printf(&session->sessionid, sessionname);
|
||||
capwap_logging_debug("Receive Keep-Alive from %s", sessionname);
|
||||
log_printf(LOG_DEBUG, "Receive Keep-Alive from %s", sessionname);
|
||||
}
|
||||
#endif
|
||||
/* Send keep-alive response */
|
||||
@ -601,7 +601,7 @@ static void ac_dfa_execute(struct ac_session_t* session, struct capwap_parsed_pa
|
||||
}
|
||||
|
||||
default: {
|
||||
capwap_logging_debug("Unknown AC action event: %lu", session->state);
|
||||
log_printf(LOG_DEBUG, "Unknown AC action event: %lu", session->state);
|
||||
ac_session_teardown(session);
|
||||
break;
|
||||
}
|
||||
@ -659,7 +659,7 @@ static void ac_session_destroy(struct ac_session_t* session) {
|
||||
|
||||
#ifdef DEBUG
|
||||
capwap_sessionid_printf(&session->sessionid, sessionname);
|
||||
capwap_logging_debug("Release Session AC %s", sessionname);
|
||||
log_printf(LOG_DEBUG, "Release Session AC %s", sessionname);
|
||||
#endif
|
||||
|
||||
/* Release last reference */
|
||||
@ -674,7 +674,7 @@ static void ac_session_destroy(struct ac_session_t* session) {
|
||||
/* Check if all reference is release */
|
||||
while (session->count > 0) {
|
||||
#ifdef DEBUG
|
||||
capwap_logging_debug("Wait for release Session AC %s (count=%d)", sessionname, session->count);
|
||||
log_printf(LOG_DEBUG, "Wait for release Session AC %s (count=%d)", sessionname, session->count);
|
||||
#endif
|
||||
/* */
|
||||
capwap_event_reset(&session->changereference);
|
||||
@ -777,9 +777,9 @@ static void ac_session_run(struct ac_session_t* session) {
|
||||
if (capwap_is_request_type(session->rxmngpacket->ctrlmsg.type) && (session->remotetype == session->rxmngpacket->ctrlmsg.type) && (session->remoteseqnumber == session->rxmngpacket->ctrlmsg.seq)) {
|
||||
/* Retransmit response */
|
||||
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
|
||||
capwap_logging_error("Error to resend response packet");
|
||||
log_printf(LOG_ERR, "Error to resend response packet");
|
||||
} else {
|
||||
capwap_logging_debug("Retrasmitted control packet");
|
||||
log_printf(LOG_DEBUG, "Retrasmitted control packet");
|
||||
}
|
||||
} else {
|
||||
/* Check message type */
|
||||
@ -832,24 +832,24 @@ static void ac_session_run(struct ac_session_t* session) {
|
||||
/* */
|
||||
ac_dfa_execute(session, &packet);
|
||||
} else {
|
||||
capwap_logging_debug("Failed validation parsed control packet");
|
||||
log_printf(LOG_DEBUG, "Failed validation parsed control packet");
|
||||
if (capwap_is_request_type(session->rxmngpacket->ctrlmsg.type)) {
|
||||
capwap_logging_warning("Missing Mandatory Message Element, send Response Packet with error");
|
||||
log_printf(LOG_WARNING, "Missing Mandatory Message Element, send Response Packet with error");
|
||||
ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_MISSING_MANDATORY_MSG_ELEMENT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
capwap_logging_debug("Failed parsing packet");
|
||||
log_printf(LOG_DEBUG, "Failed parsing packet");
|
||||
if ((res == UNRECOGNIZED_MESSAGE_ELEMENT) && capwap_is_request_type(session->rxmngpacket->ctrlmsg.type)) {
|
||||
capwap_logging_warning("Unrecognized Message Element, send Response Packet with error");
|
||||
log_printf(LOG_WARNING, "Unrecognized Message Element, send Response Packet with error");
|
||||
ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_UNRECOGNIZED_MESSAGE_ELEMENT);
|
||||
/* TODO: add the unrecognized message element */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
capwap_logging_debug("Invalid message type");
|
||||
log_printf(LOG_DEBUG, "Invalid message type");
|
||||
if (res == INVALID_REQUEST_MESSAGE_TYPE) {
|
||||
capwap_logging_warning("Unexpected Unrecognized Request, send Response Packet with error");
|
||||
log_printf(LOG_WARNING, "Unexpected Unrecognized Request, send Response Packet with error");
|
||||
ac_send_invalid_request(session, CAPWAP_RESULTCODE_MSG_UNEXPECTED_UNRECOGNIZED_REQUEST);
|
||||
}
|
||||
}
|
||||
@ -890,7 +890,7 @@ void ac_dfa_change_state(struct ac_session_t* session, int state) {
|
||||
#ifdef DEBUG
|
||||
char sessionname[33];
|
||||
capwap_sessionid_printf(&session->sessionid, sessionname);
|
||||
capwap_logging_debug("Session AC %s change state from %s to %s", sessionname, capwap_dfa_getname(session->state), capwap_dfa_getname(state));
|
||||
log_printf(LOG_DEBUG, "Session AC %s change state from %s to %s", sessionname, capwap_dfa_getname(session->state), capwap_dfa_getname(state));
|
||||
#endif
|
||||
|
||||
session->state = state;
|
||||
@ -984,9 +984,9 @@ void* ac_session_thread(void* param) {
|
||||
threadid = session->threadid;
|
||||
|
||||
/* */
|
||||
capwap_logging_debug("Session start");
|
||||
log_printf(LOG_DEBUG, "Session start");
|
||||
ac_session_run(session);
|
||||
capwap_logging_debug("Session end");
|
||||
log_printf(LOG_DEBUG, "Session end");
|
||||
|
||||
/* Notify terminate thread */
|
||||
ac_msgqueue_notify_closethread(threadid);
|
||||
@ -1100,21 +1100,21 @@ void ac_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long
|
||||
struct ac_session_t* session = (struct ac_session_t*)context;
|
||||
|
||||
if (!session->requestfragmentpacket->count) {
|
||||
capwap_logging_warning("Invalid retransmition request packet");
|
||||
log_printf(LOG_WARNING, "Invalid retransmition request packet");
|
||||
ac_session_teardown(session);
|
||||
} else {
|
||||
session->retransmitcount++;
|
||||
if (session->retransmitcount >= AC_MAX_RETRANSMIT) {
|
||||
capwap_logging_info("Retransmition request packet timeout");
|
||||
log_printf(LOG_INFO, "Retransmition request packet timeout");
|
||||
|
||||
/* Timeout reset state */
|
||||
ac_free_reference_last_request(session);
|
||||
ac_session_teardown(session);
|
||||
} else {
|
||||
/* Retransmit Request */
|
||||
capwap_logging_debug("Retransmition request packet");
|
||||
log_printf(LOG_DEBUG, "Retransmition request packet");
|
||||
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->requestfragmentpacket)) {
|
||||
capwap_logging_error("Error to send request packet");
|
||||
log_printf(LOG_ERR, "Error to send request packet");
|
||||
}
|
||||
|
||||
/* Update timeout */
|
||||
@ -1124,6 +1124,6 @@ void ac_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long
|
||||
}
|
||||
|
||||
void ac_dfa_teardown_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
|
||||
capwap_logging_info("Session timeout, teardown");
|
||||
log_printf(LOG_INFO, "Session timeout, teardown");
|
||||
ac_session_teardown((struct ac_session_t*)context);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static void ac_stations_destroy_station(struct ac_session_t* session, struct ac_
|
||||
ASSERT(station != NULL);
|
||||
|
||||
/* */
|
||||
capwap_logging_info("Destroy station: %s", station->addrtext);
|
||||
log_printf(LOG_INFO, "Destroy station: %s", station->addrtext);
|
||||
|
||||
/* Remove reference from Authoritative Stations List */
|
||||
capwap_rwlock_wrlock(&g_ac.authstationslock);
|
||||
@ -166,7 +166,7 @@ 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);
|
||||
|
||||
/* */
|
||||
capwap_logging_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: %s", (int)wlan->device->radioid, (int)wlan->wlanid, capwap_printf_macaddress(buffer, wlan->address, MACADDRESS_EUI48_LENGTH));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint
|
||||
/* */
|
||||
capwap_printf_macaddress(buffer1, bssid, MACADDRESS_EUI48_LENGTH);
|
||||
capwap_printf_macaddress(buffer2, address, MACADDRESS_EUI48_LENGTH);
|
||||
capwap_logging_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: %s, station address: %s", (int)radioid, buffer1, buffer2);
|
||||
|
||||
/* */
|
||||
wlan = ac_wlans_get_bssid(session, radioid, bssid);
|
||||
@ -392,7 +392,7 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint
|
||||
}
|
||||
}
|
||||
} else {
|
||||
capwap_logging_warning("Unable to find radioid: %d, bssid: %s", (int)radioid, buffer1);
|
||||
log_printf(LOG_WARNING, "Unable to find radioid: %d, bssid: %s", (int)radioid, buffer1);
|
||||
}
|
||||
|
||||
return station;
|
||||
@ -479,7 +479,7 @@ 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: {
|
||||
capwap_logging_warning("The %s station has not completed the association in time", station->addrtext);
|
||||
log_printf(LOG_WARNING, "The %s station has not completed the association in time", station->addrtext);
|
||||
ac_stations_delete_station((struct ac_session_t*)param, station);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user