switch everything to new log API and drop old one

This commit is contained in:
Andreas Schultz 2016-03-30 14:47:57 +02:00
parent dd6f6fcfe2
commit 29ed6544c5
113 changed files with 641 additions and 638 deletions

View File

@ -229,7 +229,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configString, "debug")) { } else if (!strcmp(configString, "debug")) {
capwap_logging_verboselevel(LOG_DEBUG); capwap_logging_verboselevel(LOG_DEBUG);
} else { } else {
capwap_logging_error("Invalid configuration file, unknown logging.level value"); log_printf(LOG_ERR, "Invalid configuration file, unknown logging.level value");
return 0; return 0;
} }
} }
@ -251,7 +251,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configString, "stderr")) { } else if (!strcmp(configString, "stderr")) {
capwap_logging_enable_console(1); capwap_logging_enable_console(1);
} else { } else {
capwap_logging_error("Invalid configuration file, unknown logging.output value"); log_printf(LOG_ERR, "Invalid configuration file, unknown logging.output value");
return 0; return 0;
} }
} }
@ -268,7 +268,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
/* Set name of AC */ /* Set name of AC */
if (config_lookup_string(config, "application.name", &configString) == CONFIG_TRUE) { if (config_lookup_string(config, "application.name", &configString) == CONFIG_TRUE) {
if (strlen(configString) > CAPWAP_ACNAME_MAXLENGTH) { 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; return 0;
} }
@ -291,7 +291,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(bindingName, "EPCGlobal")) { } else if (!strcmp(bindingName, "EPCGlobal")) {
*binding = CAPWAP_WIRELESS_BINDING_EPCGLOBAL; *binding = CAPWAP_WIRELESS_BINDING_EPCGLOBAL;
} else { } else {
capwap_logging_error("Invalid configuration file, unknown application.binding value"); log_printf(LOG_ERR, "Invalid configuration file, unknown application.binding value");
return 0; return 0;
} }
} }
@ -303,7 +303,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if ((configInt > 0) && (configInt < 65536)) { if ((configInt > 0) && (configInt < 65536)) {
g_ac.descriptor.stationlimit = (unsigned short)configInt; g_ac.descriptor.stationlimit = (unsigned short)configInt;
} else { } 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; return 0;
} }
} }
@ -313,7 +313,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if ((configInt > 0) && (configInt < 65536)) { if ((configInt > 0) && (configInt < 65536)) {
g_ac.descriptor.maxwtp = (unsigned short)configInt; g_ac.descriptor.maxwtp = (unsigned short)configInt;
} else { } 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; return 0;
} }
} }
@ -379,7 +379,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configType, "software")) { } else if (!strcmp(configType, "software")) {
type = CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION; type = CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION;
} else { } 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; return 0;
} }
@ -392,19 +392,19 @@ static int ac_parsing_configuration_1_0(config_t* config) {
strcpy((char*)desc->data, configValue); strcpy((char*)desc->data, configValue);
desc->data[desc->length] = 0; desc->data[desc->length] = 0;
} else { } 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; return 0;
} }
} else { } 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; return 0;
} }
} else { } 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; return 0;
} }
} else { } 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; return 0;
} }
} }
@ -418,7 +418,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configString, "limited")) { } else if (!strcmp(configString, "limited")) {
g_ac.dfa.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT; g_ac.dfa.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT;
} else { } else {
capwap_logging_error("Invalid configuration file, unknown application.ecn value"); log_printf(LOG_ERR, "Invalid configuration file, unknown application.ecn value");
return 0; 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)) { if ((configInt >= AC_MIN_DISCOVERY_INTERVAL) && (configInt <= AC_MAX_DISCOVERY_INTERVAL)) {
g_ac.dfa.timers.discovery = (unsigned char)(configInt / 1000); g_ac.dfa.timers.discovery = (unsigned char)(configInt / 1000);
} else { } 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; 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)) { if ((configInt >= AC_MIN_ECHO_INTERVAL) && (configInt <= AC_MAX_ECHO_INTERVAL)) {
g_ac.dfa.timers.echorequest = (unsigned char)(configInt / 1000); g_ac.dfa.timers.echorequest = (unsigned char)(configInt / 1000);
} else { } 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; return 0;
} }
} }
@ -448,7 +448,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if ((configInt > 0) && (configInt < 65536)) { if ((configInt > 0) && (configInt < 65536)) {
g_ac.dfa.decrypterrorreport_interval = (unsigned short)configInt; g_ac.dfa.decrypterrorreport_interval = (unsigned short)configInt;
} else { } 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; return 0;
} }
} }
@ -457,7 +457,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if (configInt > 0) { if (configInt > 0) {
g_ac.dfa.idletimeout.timeout = (unsigned long)configInt; g_ac.dfa.idletimeout.timeout = (unsigned long)configInt;
} else { } 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; return 0;
} }
} }
@ -483,7 +483,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configString, "presharedkey")) { } else if (!strcmp(configString, "presharedkey")) {
dtlsparam.mode = CAPWAP_DTLS_MODE_PRESHAREDKEY; dtlsparam.mode = CAPWAP_DTLS_MODE_PRESHAREDKEY;
} else { } 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; return 0;
} }
} }
@ -576,7 +576,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
/* Set interface binding of AC */ /* Set interface binding of AC */
if (config_lookup_string(config, "application.network.binding", &configString) == CONFIG_TRUE) { if (config_lookup_string(config, "application.network.binding", &configString) == CONFIG_TRUE) {
if (strlen(configString) > (IFNAMSIZ - 1)) { 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; return 0;
} }
@ -588,7 +588,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if ((configInt > 0) && (configInt < 65536)) { if ((configInt > 0) && (configInt < 65536)) {
g_ac.mtu = (unsigned short)configInt; g_ac.mtu = (unsigned short)configInt;
} else { } 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; return 0;
} }
} }
@ -600,7 +600,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
} else if (!strcmp(configString, "udplite")) { } else if (!strcmp(configString, "udplite")) {
g_ac.dfa.transport.type = CAPWAP_UDPLITE_TRANSPORT; g_ac.dfa.transport.type = CAPWAP_UDPLITE_TRANSPORT;
} else { } 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; return 0;
} }
} }
@ -633,7 +633,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
/* */ /* */
server = ac_soapclient_create_server(configString); server = ac_soapclient_create_server(configString);
if (!server) { 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; return 0;
} }
@ -647,7 +647,7 @@ static int ac_parsing_configuration_1_0(config_t* config) {
/* */ /* */
configSSL = config_setting_get_member(configServer, "x509"); configSSL = config_setting_get_member(configServer, "x509");
if (!configSSL) { 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; return 0;
} }
@ -673,11 +673,11 @@ static int ac_parsing_configuration_1_0(config_t* config) {
if (calist && certificate && privatekey) { if (calist && certificate && privatekey) {
server->sslcontext = capwap_socket_crypto_createcontext(calist, certificate, privatekey); server->sslcontext = capwap_socket_crypto_createcontext(calist, certificate, privatekey);
if (!server->sslcontext) { 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; return 0;
} }
} else { } 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; return 0;
} }
@ -707,9 +707,9 @@ static int ac_parsing_configuration(config_t* config) {
return ac_parsing_configuration_1_0(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 { } 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; return 0;
@ -738,7 +738,7 @@ static int ac_load_configuration(int argc, char** argv) {
if (strlen(optarg) < sizeof(g_configurationfile)) { if (strlen(optarg) < sizeof(g_configurationfile)) {
strcpy(g_configurationfile, optarg); strcpy(g_configurationfile, optarg);
} else { } else {
capwap_logging_error("Invalid -%c argument", optopt); log_printf(LOG_ERR, "Invalid -%c argument", optopt);
return -1; return -1;
} }
@ -747,9 +747,9 @@ static int ac_load_configuration(int argc, char** argv) {
case '?': { case '?': {
if (optopt == 'c') { if (optopt == 'c') {
capwap_logging_error("Option -%c requires an argument", optopt); log_printf(LOG_ERR, "Option -%c requires an argument", optopt);
} else { } else {
capwap_logging_error("Unknown option character `\\x%x'", optopt); log_printf(LOG_ERR, "Unknown option character `\\x%x'", optopt);
} }
ac_print_usage(); ac_print_usage();
@ -766,7 +766,7 @@ static int ac_load_configuration(int argc, char** argv) {
result = ac_parsing_configuration(&config); result = ac_parsing_configuration(&config);
} else { } else {
result = -1; 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 */ /* Free libconfig */
@ -778,7 +778,7 @@ static int ac_load_configuration(int argc, char** argv) {
static int ac_configure(void) { static int ac_configure(void) {
/* Bind control channel to any address */ /* Bind control channel to any address */
if (capwap_bind_sockets(&g_ac.net)) { if (capwap_bind_sockets(&g_ac.net)) {
capwap_logging_fatal("Cannot bind address"); log_printf(LOG_EMERG, "Cannot bind address");
return AC_ERROR_NETWORK; return AC_ERROR_NETWORK;
} }
@ -821,7 +821,7 @@ int main(int argc, char** argv) {
/* Init capwap */ /* Init capwap */
if (geteuid() != 0) { if (geteuid() != 0) {
capwap_logging_fatal("Request root privileges"); log_printf(LOG_EMERG, "Request root privileges");
return CAPWAP_REQUEST_ROOT; return CAPWAP_REQUEST_ROOT;
} }
@ -830,7 +830,7 @@ int main(int argc, char** argv) {
/* Init crypt */ /* Init crypt */
if (capwap_crypt_init()) { 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; return CAPWAP_CRYPT_ERROR;
} }
@ -852,7 +852,7 @@ int main(int argc, char** argv) {
/* Console logging is disabled in daemon mode */ /* Console logging is disabled in daemon mode */
capwap_logging_disable_console(); capwap_logging_disable_console();
capwap_logging_info("Running AC in daemon mode"); log_printf(LOG_INFO, "Running AC in daemon mode");
} }
/* Complete configuration AC */ /* Complete configuration AC */
@ -862,18 +862,18 @@ int main(int argc, char** argv) {
if (!ac_kmod_init()) { if (!ac_kmod_init()) {
/* Bind data channel */ /* Bind data channel */
if (!ac_kmod_createdatachannel(g_ac.net.localaddr.ss.ss_family, CAPWAP_GET_NETWORK_PORT(&g_ac.net.localaddr) + 1)) { 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 */ /* Running AC */
result = ac_execute(); result = ac_execute();
} else { } else {
capwap_logging_fatal("Unable to create kernel data channel"); log_printf(LOG_EMERG, "Unable to create kernel data channel");
} }
/* Disconnect kernel module */ /* Disconnect kernel module */
ac_kmod_free(); ac_kmod_free();
} else { } else {
capwap_logging_fatal("Unable to connect to kernel module"); log_printf(LOG_EMERG, "Unable to connect to kernel module");
} }
/* Close connection */ /* Close connection */

View File

@ -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*)&notify, sizeof(struct ac_session_notify_event_t)); ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)&notify, sizeof(struct ac_session_notify_event_t));
/* Async close session */ /* 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); 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*)&notify, sizeof(struct ac_session_notify_event_t)); ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)&notify, sizeof(struct ac_session_notify_event_t));
/* Notify Action */ /* 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); ac_session_send_action(session, AC_SESSION_ACTION_RESET_WTP, 0, (void*)reset, length);
result = 0; 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*)&notify, sizeof(struct ac_session_notify_event_t)); ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)&notify, sizeof(struct ac_session_notify_event_t));
/* Notify Action */ /* 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); 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 */ /* Retrieve AC configuration */
if (g_ac_backend.backendsessionid && forcereset) { if (g_ac_backend.backendsessionid && forcereset) {
if (ac_backend_soap_getconfiguration()) { 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); capwap_free(g_ac_backend.backendsessionid);
g_ac_backend.backendsessionid = NULL; g_ac_backend.backendsessionid = NULL;
} }
@ -725,7 +725,7 @@ static void ac_backend_run(void) {
/* Connection error, change Backend Server */ /* Connection error, change Backend Server */
connected = 0; 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); capwap_lock_enter(&g_ac_backend.backendlock);
/* Lost session id */ /* Lost session id */
@ -738,7 +738,7 @@ static void ac_backend_run(void) {
} else { } else {
/* Join with a Backend Server */ /* Join with a Backend Server */
if (!ac_backend_soap_join(forcereset)) { if (!ac_backend_soap_join(forcereset)) {
capwap_logging_debug("Joined with Backend Server"); log_printf(LOG_DEBUG, "Joined with Backend Server");
/* Join Complete */ /* Join Complete */
connected = 1; connected = 1;
@ -753,7 +753,7 @@ static void ac_backend_run(void) {
/* Wait timeout before continue */ /* Wait timeout before continue */
if (g_ac_backend.errorjoinbackend >= g_ac.availablebackends->count) { 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; forcereset = 1;
@ -792,9 +792,9 @@ static void ac_backend_run(void) {
/* */ /* */
static void* ac_backend_thread(void* param) { static void* ac_backend_thread(void* param) {
capwap_logging_debug("Backend start"); log_printf(LOG_DEBUG, "Backend start");
ac_backend_run(); ac_backend_run();
capwap_logging_debug("Backend stop"); log_printf(LOG_DEBUG, "Backend stop");
/* Thread exit */ /* Thread exit */
pthread_exit(NULL); pthread_exit(NULL);
@ -843,13 +843,13 @@ int ac_backend_start(void) {
/* */ /* */
if (!g_ac.backendacid) { 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; return 0;
} else if (!g_ac.backendversion) { } 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; return 0;
} else if (!g_ac.availablebackends->count) { } 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; return 0;
} }
@ -861,7 +861,7 @@ int ac_backend_start(void) {
/* Create thread */ /* Create thread */
result = pthread_create(&g_ac_backend.threadid, NULL, ac_backend_thread, NULL); result = pthread_create(&g_ac_backend.threadid, NULL, ac_backend_thread, NULL);
if (result) { if (result) {
capwap_logging_debug("Unable create backend thread"); log_printf(LOG_DEBUG, "Unable create backend thread");
return 0; return 0;
} }

View File

@ -759,7 +759,7 @@ void ac_dfa_state_configure(struct ac_session_t* session, struct capwap_parsed_p
/* Send Configure response to WTP */ /* Send Configure response to WTP */
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
/* Response is already created and saved. When receive a re-request, DFA autoresponse */ /* 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 */ /* Change state */

View File

@ -205,7 +205,7 @@ void ac_dfa_state_datacheck(struct ac_session_t* session, struct capwap_parsed_p
/* Send Change event response to WTP */ /* Send Change event response to WTP */
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
/* Response is already created and saved. When receive a re-request, DFA autoresponse */ /* 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 */ /* Change state */

View File

@ -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; resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_UNKNOWN_SOURCE;
} }
} else { } 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; 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]; char sessionname[33];
capwap_sessionid_printf(sessionid, sessionname); 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; 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 { } else {
/* Error to send packets */ /* 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); ac_session_teardown(session);
} }
} }

View File

@ -20,7 +20,7 @@ void ac_dfa_state_reset(struct ac_session_t* session, struct capwap_parsed_packe
/* Check the success of the Request */ /* Check the success of the Request */
resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE);
if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { 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);
} }
/* */ /* */

View File

@ -58,14 +58,14 @@ static int receive_echo_request(struct ac_session_t* session, struct capwap_pars
{ {
char sessionname[33]; char sessionname[33];
capwap_sessionid_printf(&session->sessionid, sessionname); 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 #endif
/* Send Configure response to WTP */ /* Send Configure response to WTP */
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) {
/* Response is already created and saved. When receive a re-request, DFA autoresponse */ /* 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; return 0;
@ -88,7 +88,7 @@ static void execute_ieee80211_wlan_configuration_addwlan(struct ac_session_t* se
/* Assign BSSID to session */ /* Assign BSSID to session */
if (ac_wlans_assign_bssid(session, wlan)) { 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); ac_wlans_free_bssid(wlan);
/* TODO: add remove wlan from wtp */ /* 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); capwap_packet_rxmng_free(rxmngrequestpacket);
} }
} else { } 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); station = ac_stations_get_station(session, station80211->radioid, wlan->address, addstation->address);
if (station) { if (station) {
if (CAPWAP_RESULTCODE_OK(resultcode->code)) { 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; 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); station = ac_stations_get_station(session, deletestation->radioid, NULL, deletestation->address);
if (station) { 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); 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]; char sessionname[33];
capwap_sessionid_printf(&session->sessionid, sessionname); 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 #endif

View File

@ -167,7 +167,7 @@ static void ac_discovery_run(void) {
struct capwap_packet_txmng* txmngpacket; struct capwap_packet_txmng* txmngpacket;
/* */ /* */
capwap_logging_debug("Receive discovery request packet"); log_printf(LOG_DEBUG, "Receive discovery request packet");
/* Creare discovery response */ /* Creare discovery response */
txmngpacket = ac_create_discovery_response(&packet); txmngpacket = ac_create_discovery_response(&packet);
@ -186,7 +186,7 @@ static void ac_discovery_run(void) {
/* Send discovery response to WTP */ /* Send discovery response to WTP */
if (!capwap_sendto_fragmentpacket(acpacket->sendsock, responsefragmentpacket, &acpacket->sender)) { 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 */ /* Don't buffering a packets sent */
@ -211,9 +211,9 @@ static void ac_discovery_run(void) {
/* */ /* */
static void* ac_discovery_thread(void* param) { static void* ac_discovery_thread(void* param) {
capwap_logging_debug("Discovery start"); log_printf(LOG_DEBUG, "Discovery start");
ac_discovery_run(); ac_discovery_run();
capwap_logging_debug("Discovery stop"); log_printf(LOG_DEBUG, "Discovery stop");
/* Thread exit */ /* Thread exit */
pthread_exit(NULL); pthread_exit(NULL);
@ -234,7 +234,7 @@ int ac_discovery_start(void) {
/* Create thread */ /* Create thread */
result = pthread_create(&g_ac_discovery.threadid, NULL, ac_discovery_thread, NULL); result = pthread_create(&g_ac_discovery.threadid, NULL, ac_discovery_thread, NULL);
if (result) { if (result) {
capwap_logging_debug("Unable create discovery thread"); log_printf(LOG_DEBUG, "Unable create discovery thread");
return 0; return 0;
} }

View File

@ -203,7 +203,7 @@ static void ac_session_msgqueue_parsing_item(struct ac_session_msgqueue_item_t*
} }
default: { default: {
capwap_logging_debug("Unknown message queue item: %lu", item->message); log_printf(LOG_DEBUG, "Unknown message queue item: %lu", item->message);
break; break;
} }
} }
@ -215,11 +215,11 @@ static void ac_wait_terminate_allsessions(void) {
/* Wait that list is empty */ /* Wait that list is empty */
while (g_ac.sessionsthread->count > 0) { 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 */ /* Receive message queue packet */
if (!ac_recvmsgqueue(g_ac.fdmsgsessions[1], &item)) { 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; 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 */ /* 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); capwap_itemlist_insert_after(g_ac.sessionsthread, NULL, itemlist);
} else { } 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); capwap_exit(CAPWAP_OUT_OF_MEMORY);
} }
@ -828,7 +828,7 @@ int ac_execute(void) {
/* Set file descriptor pool */ /* Set file descriptor pool */
if (ac_execute_init_fdspool(&fds, &g_ac.net, g_ac.fdmsgsessions[1]) <= 0) { 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; return AC_ERROR_SYSTEM_FAILER;
} }
@ -841,7 +841,7 @@ int ac_execute(void) {
/* Start discovery thread */ /* Start discovery thread */
if (!ac_discovery_start()) { if (!ac_discovery_start()) {
ac_execute_free_fdspool(&fds); 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; return AC_ERROR_SYSTEM_FAILER;
} }
@ -849,7 +849,7 @@ int ac_execute(void) {
if (!ac_backend_start()) { if (!ac_backend_start()) {
ac_execute_free_fdspool(&fds); ac_execute_free_fdspool(&fds);
ac_discovery_stop(); ac_discovery_stop();
capwap_logging_error("Unable start backend management"); log_printf(LOG_ERR, "Unable start backend management");
return AC_ERROR_SYSTEM_FAILER; return AC_ERROR_SYSTEM_FAILER;
} }
@ -859,7 +859,7 @@ int ac_execute(void) {
buffersize = sizeof(buffer); buffersize = sizeof(buffer);
index = ac_recvfrom(&fds, buffer, &buffersize, &fromaddr, &toaddr); index = ac_recvfrom(&fds, buffer, &buffersize, &fromaddr, &toaddr);
if (!g_ac.running) { if (!g_ac.running) {
capwap_logging_debug("Closing AC"); log_printf(LOG_DEBUG, "Closing AC");
break; break;
} }

View File

@ -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 */ /* A station is removed if the association does not complete within a given period of time */
station->timeoutaction = AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE; 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 */ /* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->authetication.ie[0], ielength)) { 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; return;
} }
@ -95,14 +95,14 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session
if (responselength > 0) { if (responselength > 0) {
/* Send authentication response */ /* Send authentication response */
if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) { 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; station->flags |= AC_STATION_FLAGS_AUTHENTICATED;
} else { } 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); ac_stations_delete_station(session, station);
} }
} else { } 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); 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); 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) { if (statuscode == IEEE80211_STATUS_SUCCESS) {
algorithm = __le16_to_cpu(mgmt->authetication.algorithm); 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; wlan = station->wlan;
if (!(station->flags & AC_STATION_FLAGS_AUTHENTICATED)) { if (!(station->flags & AC_STATION_FLAGS_AUTHENTICATED)) {
/* Invalid station, delete station */ /* 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); ac_stations_delete_station(session, station);
return; return;
} }
@ -191,7 +191,7 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
/* Parsing Information Elements */ /* Parsing Information Elements */
if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->associationrequest.ie[0], ielength)) { 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); ac_stations_delete_station(session, station);
return; return;
} }
@ -237,17 +237,17 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se
if (responselength > 0) { if (responselength > 0) {
/* Send association response */ /* Send association response */
if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) { 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 */ /* Active Station */
station->flags |= AC_STATION_FLAGS_ASSOCIATE; station->flags |= AC_STATION_FLAGS_ASSOCIATE;
ac_stations_authorize_station(session, station); ac_stations_authorize_station(session, station);
} else { } 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); ac_stations_delete_station(session, station);
} }
} else { } 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); 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)) { 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); station = ac_stations_get_station(session, radioid, mgmt->bssid, mgmt->da);
if (station && station->wlan && (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL)) { 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) { if (mgmt->associationresponse.statuscode == IEEE80211_STATUS_SUCCESS) {
/* Get Station Info */ /* Get Station Info */

View File

@ -191,7 +191,7 @@ static int ac_kmod_link(void) {
if (result == -EALREADY) { if (result == -EALREADY) {
result = 0; result = 0;
} else { } 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]); res = nl_recvmsgs((struct nl_sock*)params[0], (struct nl_cb*)params[1]);
if (res) { 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); 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result && (result != ENOENT)) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result && (result != ENOENT)) { 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) { if (!result) {
result = (ifindex ? (int)ifindex : -1); result = (ifindex ? (int)ifindex : -1);
} else { } 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result && (result != ENOENT)) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL);
if (result) { 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 */ /* Get nlsmartcapwap netlink family */
g_ac.kmodhandle.nlsmartcapwap_id = genl_ctrl_resolve(g_ac.kmodhandle.nl, NLSMARTCAPWAP_GENL_NAME); g_ac.kmodhandle.nlsmartcapwap_id = genl_ctrl_resolve(g_ac.kmodhandle.nl, NLSMARTCAPWAP_GENL_NAME);
if (g_ac.kmodhandle.nlsmartcapwap_id < 0) { 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(); ac_kmod_free();
return -1; return -1;
} }

View File

@ -165,12 +165,12 @@ static int ac_session_action_authorizestation_response(struct ac_session_t* sess
session->retransmitcount = 0; session->retransmitcount = 0;
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
} else { } 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_free_reference_last_request(session);
ac_session_teardown(session); ac_session_teardown(session);
} }
} else { } 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_free_reference_last_request(session);
ac_session_teardown(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); ac_dfa_change_state(session, CAPWAP_RESET_STATE);
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
} else { } 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_free_reference_last_request(session);
ac_session_teardown(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; session->retransmitcount = 0;
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
} else { } 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_free_reference_last_request(session);
ac_session_teardown(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); response = ac_session_action_authorizestation_request(session, notify->radioid, notify->wlanid, notify->address);
if (response) { if (response) {
if (ac_session_action_authorizestation_response(session, response, notify)) { 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 */ /* TODO kickoff station */
} }
@ -353,7 +353,7 @@ static int ac_session_action_station_configuration_ieee8011_delete_station(struc
session->retransmitcount = 0; session->retransmitcount = 0;
capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL);
} else { } 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_free_reference_last_request(session);
ac_session_teardown(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]; char sessionname[33];
capwap_sessionid_printf(&session->sessionid, sessionname); 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 #endif
/* Send keep-alive response */ /* Send keep-alive response */
@ -601,7 +601,7 @@ static void ac_dfa_execute(struct ac_session_t* session, struct capwap_parsed_pa
} }
default: { 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); ac_session_teardown(session);
break; break;
} }
@ -659,7 +659,7 @@ static void ac_session_destroy(struct ac_session_t* session) {
#ifdef DEBUG #ifdef DEBUG
capwap_sessionid_printf(&session->sessionid, sessionname); capwap_sessionid_printf(&session->sessionid, sessionname);
capwap_logging_debug("Release Session AC %s", sessionname); log_printf(LOG_DEBUG, "Release Session AC %s", sessionname);
#endif #endif
/* Release last reference */ /* Release last reference */
@ -674,7 +674,7 @@ static void ac_session_destroy(struct ac_session_t* session) {
/* Check if all reference is release */ /* Check if all reference is release */
while (session->count > 0) { while (session->count > 0) {
#ifdef DEBUG #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 #endif
/* */ /* */
capwap_event_reset(&session->changereference); 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)) { if (capwap_is_request_type(session->rxmngpacket->ctrlmsg.type) && (session->remotetype == session->rxmngpacket->ctrlmsg.type) && (session->remoteseqnumber == session->rxmngpacket->ctrlmsg.seq)) {
/* Retransmit response */ /* Retransmit response */
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { 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 { } else {
capwap_logging_debug("Retrasmitted control packet"); log_printf(LOG_DEBUG, "Retrasmitted control packet");
} }
} else { } else {
/* Check message type */ /* Check message type */
@ -832,24 +832,24 @@ static void ac_session_run(struct ac_session_t* session) {
/* */ /* */
ac_dfa_execute(session, &packet); ac_dfa_execute(session, &packet);
} else { } 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)) { 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); ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_MISSING_MANDATORY_MSG_ELEMENT);
} }
} }
} else { } 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)) { 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); ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_UNRECOGNIZED_MESSAGE_ELEMENT);
/* TODO: add the unrecognized message element */ /* TODO: add the unrecognized message element */
} }
} }
} else { } else {
capwap_logging_debug("Invalid message type"); log_printf(LOG_DEBUG, "Invalid message type");
if (res == INVALID_REQUEST_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); 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 #ifdef DEBUG
char sessionname[33]; char sessionname[33];
capwap_sessionid_printf(&session->sessionid, sessionname); 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 #endif
session->state = state; session->state = state;
@ -984,9 +984,9 @@ void* ac_session_thread(void* param) {
threadid = session->threadid; threadid = session->threadid;
/* */ /* */
capwap_logging_debug("Session start"); log_printf(LOG_DEBUG, "Session start");
ac_session_run(session); ac_session_run(session);
capwap_logging_debug("Session end"); log_printf(LOG_DEBUG, "Session end");
/* Notify terminate thread */ /* Notify terminate thread */
ac_msgqueue_notify_closethread(threadid); 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; struct ac_session_t* session = (struct ac_session_t*)context;
if (!session->requestfragmentpacket->count) { if (!session->requestfragmentpacket->count) {
capwap_logging_warning("Invalid retransmition request packet"); log_printf(LOG_WARNING, "Invalid retransmition request packet");
ac_session_teardown(session); ac_session_teardown(session);
} else { } else {
session->retransmitcount++; session->retransmitcount++;
if (session->retransmitcount >= AC_MAX_RETRANSMIT) { if (session->retransmitcount >= AC_MAX_RETRANSMIT) {
capwap_logging_info("Retransmition request packet timeout"); log_printf(LOG_INFO, "Retransmition request packet timeout");
/* Timeout reset state */ /* Timeout reset state */
ac_free_reference_last_request(session); ac_free_reference_last_request(session);
ac_session_teardown(session); ac_session_teardown(session);
} else { } else {
/* Retransmit Request */ /* Retransmit Request */
capwap_logging_debug("Retransmition request packet"); log_printf(LOG_DEBUG, "Retransmition request packet");
if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->requestfragmentpacket)) { 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 */ /* 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) { 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); ac_session_teardown((struct ac_session_t*)context);
} }

View File

@ -45,7 +45,7 @@ static void ac_stations_destroy_station(struct ac_session_t* session, struct ac_
ASSERT(station != NULL); 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 */ /* Remove reference from Authoritative Stations List */
capwap_rwlock_wrlock(&g_ac.authstationslock); 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_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; 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(buffer1, bssid, MACADDRESS_EUI48_LENGTH);
capwap_printf_macaddress(buffer2, address, 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); 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 { } 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; return station;
@ -479,7 +479,7 @@ void ac_stations_timeout(struct capwap_timeout* timeout, unsigned long index, vo
if (station->idtimeout == index) { if (station->idtimeout == index) {
switch (station->timeoutaction) { switch (station->timeoutaction) {
case AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE: { 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); ac_stations_delete_station((struct ac_session_t*)param, station);
break; break;
} }

View File

@ -76,7 +76,7 @@ void capwap_daemon(void);
/* */ /* */
#define capwap_outofmemory() do { \ #define capwap_outofmemory() do { \
capwap_logging_fatal("Out of memory %s(%d)", __FILE__, __LINE__); \ log_printf(LOG_EMERG, "Out of memory %s(%d)", __FILE__, __LINE__); \
capwap_exit(CAPWAP_OUT_OF_MEMORY); \ capwap_exit(CAPWAP_OUT_OF_MEMORY); \
} while(0) } while(0)

View File

@ -36,14 +36,14 @@ void* capwap_alloc_debug(size_t size, const char* file, const int line) {
/* Request size > 0 */ /* Request size > 0 */
if (size <= 0) { if (size <= 0) {
capwap_logging_debug("%s(%d): Invalid memory size %zu", file, line, size); log_printf(LOG_DEBUG, "%s(%d): Invalid memory size %zu", file, line, size);
exit(CAPWAP_ASSERT_CONDITION); exit(CAPWAP_ASSERT_CONDITION);
} }
/* Alloc block with memory block */ /* Alloc block with memory block */
block = (struct capwap_memory_block*)malloc(sizeof(struct capwap_memory_block) + size); block = (struct capwap_memory_block*)malloc(sizeof(struct capwap_memory_block) + size);
if (!block) { if (!block) {
capwap_logging_debug("Out of memory %s(%d)", file, line); log_printf(LOG_DEBUG, "Out of memory %s(%d)", file, line);
exit(CAPWAP_OUT_OF_MEMORY); exit(CAPWAP_OUT_OF_MEMORY);
} }
@ -69,19 +69,19 @@ void capwap_free_debug(void* p, const char* file, const int line) {
struct capwap_memory_block* prevblock; struct capwap_memory_block* prevblock;
if (!p) { if (!p) {
capwap_logging_debug("%s(%d): Free NULL pointer", file, line); log_printf(LOG_DEBUG, "%s(%d): Free NULL pointer", file, line);
exit(CAPWAP_ASSERT_CONDITION); exit(CAPWAP_ASSERT_CONDITION);
} }
/* Memory block */ /* Memory block */
if ((size_t)p <= sizeof(struct capwap_memory_block)) { if ((size_t)p <= sizeof(struct capwap_memory_block)) {
capwap_logging_debug("%s(%d): Invalid pointer", file, line); log_printf(LOG_DEBUG, "%s(%d): Invalid pointer", file, line);
exit(CAPWAP_ASSERT_CONDITION); exit(CAPWAP_ASSERT_CONDITION);
} }
block = (struct capwap_memory_block*)((char*)p - sizeof(struct capwap_memory_block)); block = (struct capwap_memory_block*)((char*)p - sizeof(struct capwap_memory_block));
if (block->item != p) { if (block->item != p) {
capwap_logging_debug("%s(%d): Invalid pointer", file, line); log_printf(LOG_DEBUG, "%s(%d): Invalid pointer", file, line);
exit(CAPWAP_ASSERT_CONDITION); exit(CAPWAP_ASSERT_CONDITION);
} }
@ -107,7 +107,7 @@ void capwap_free_debug(void* p, const char* file, const int line) {
findblock = findblock->next; findblock = findblock->next;
} }
capwap_logging_debug("%s(%d): Unable to find memory block", file, line); log_printf(LOG_DEBUG, "%s(%d): Unable to find memory block", file, line);
} }
/* Dump memory alloced */ /* Dump memory alloced */
@ -119,7 +119,7 @@ void capwap_dump_memory(void) {
findblock = g_memoryblocks; findblock = g_memoryblocks;
while (findblock != NULL) { while (findblock != NULL) {
capwap_logging_debug("%s(%d): block at %p, %zu bytes long", log_printf(LOG_DEBUG, "%s(%d): block at %p, %zu bytes long",
findblock->file, findblock->line, findblock->item, findblock->size); findblock->file, findblock->line, findblock->item, findblock->size);
#ifdef USE_DEBUG_BACKTRACE #ifdef USE_DEBUG_BACKTRACE
@ -129,7 +129,7 @@ void capwap_dump_memory(void) {
/* Skipping capwap_alloc_debug function print out */ /* Skipping capwap_alloc_debug function print out */
for (j = 1; j < findblock->backtrace_count; j++) { for (j = 1; j < findblock->backtrace_count; j++) {
capwap_logging_debug("\t%s", backtrace_functions[j]); log_printf(LOG_DEBUG, "\t%s", backtrace_functions[j]);
} }
free(backtrace_functions); free(backtrace_functions);
@ -144,9 +144,9 @@ void capwap_dump_memory(void) {
/* Check if all memory is free */ /* Check if all memory is free */
int capwap_check_memory_leak(int verbose) { int capwap_check_memory_leak(int verbose) {
if ((g_memoryblocks != NULL) && (verbose != 0)) { if ((g_memoryblocks != NULL) && (verbose != 0)) {
capwap_logging_debug("*** Detected memory leaks ! ***"); log_printf(LOG_DEBUG, "*** Detected memory leaks ! ***");
capwap_dump_memory(); capwap_dump_memory();
capwap_logging_debug("*******************************"); log_printf(LOG_DEBUG, "*******************************");
} }
return ((g_memoryblocks != NULL) ? 1 : 0); return ((g_memoryblocks != NULL) ? 1 : 0);
@ -168,7 +168,7 @@ void capwap_backtrace_callstack(void) {
/* Skipping capwap_backtrace_callstack function print out */ /* Skipping capwap_backtrace_callstack function print out */
for (i = 1; i < count; i++) { for (i = 1; i < count; i++) {
capwap_logging_debug("\t%s", functions[i]); log_printf(LOG_DEBUG, "\t%s", functions[i]);
} }
free(functions); free(functions);

View File

@ -6,7 +6,7 @@
#ifdef DEBUG #ifdef DEBUG
#define ASSERT(expr) if (!(expr)) { capwap_logging_fatal("Assertion failed \'%s\': %s(%d)", #expr, __FILE__, __LINE__); capwap_exit(CAPWAP_ASSERT_CONDITION); } #define ASSERT(expr) if (!(expr)) { log_printf(LOG_EMERG, "Assertion failed \'%s\': %s(%d)", #expr, __FILE__, __LINE__); capwap_exit(CAPWAP_ASSERT_CONDITION); }
/* Custom memory management */ /* Custom memory management */
#define capwap_alloc(x) capwap_alloc_debug(x, __FILE__, __LINE__) #define capwap_alloc(x) capwap_alloc_debug(x, __FILE__, __LINE__)

View File

@ -33,7 +33,7 @@ static int capwap_bio_method_recv(WOLFSSL* ssl, char* buffer, int length, void*
/* Check DTLS Capwap Preamble */ /* Check DTLS Capwap Preamble */
dtlspreamble = (struct capwap_dtls_header*)dtls->buffer; dtlspreamble = (struct capwap_dtls_header*)dtls->buffer;
if ((dtlspreamble->preamble.version != CAPWAP_PROTOCOL_VERSION) || (dtlspreamble->preamble.type != CAPWAP_PREAMBLE_DTLS_HEADER)) { if ((dtlspreamble->preamble.version != CAPWAP_PROTOCOL_VERSION) || (dtlspreamble->preamble.type != CAPWAP_PREAMBLE_DTLS_HEADER)) {
capwap_logging_debug("Wrong DTLS Capwap Preamble"); log_printf(LOG_DEBUG, "Wrong DTLS Capwap Preamble");
return WOLFSSL_CBIO_ERR_GENERAL; /* Wrong DTLS Capwap Preamble */ return WOLFSSL_CBIO_ERR_GENERAL; /* Wrong DTLS Capwap Preamble */
} }
@ -75,7 +75,7 @@ static int capwap_bio_method_send(WOLFSSL* ssl, char* buffer, int length, void*
/* Send packet */ /* Send packet */
err = capwap_sendto(dtls->sock, data, length + sizeof(struct capwap_dtls_header), &dtls->peeraddr); err = capwap_sendto(dtls->sock, data, length + sizeof(struct capwap_dtls_header), &dtls->peeraddr);
if (err <= 0) { if (err <= 0) {
capwap_logging_warning("Unable to send crypt packet, sentto return error %d", err); log_printf(LOG_WARNING, "Unable to send crypt packet, sentto return error %d", err);
return WOLFSSL_CBIO_ERR_GENERAL; return WOLFSSL_CBIO_ERR_GENERAL;
} }
@ -236,7 +236,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
/* Alloc context */ /* Alloc context */
dtlscontext->sslcontext = (void*)wolfSSL_CTX_new(((param->type == CAPWAP_DTLS_SERVER) ? wolfDTLSv1_server_method() : wolfDTLSv1_client_method())); dtlscontext->sslcontext = (void*)wolfSSL_CTX_new(((param->type == CAPWAP_DTLS_SERVER) ? wolfDTLSv1_server_method() : wolfDTLSv1_client_method()));
if (!dtlscontext->sslcontext) { if (!dtlscontext->sslcontext) {
capwap_logging_debug("Error to initialize dtls context"); log_printf(LOG_DEBUG, "Error to initialize dtls context");
return 0; return 0;
} }
@ -249,42 +249,42 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
if (dtlscontext->mode == CAPWAP_DTLS_MODE_CERTIFICATE) { if (dtlscontext->mode == CAPWAP_DTLS_MODE_CERTIFICATE) {
/* Check context */ /* Check context */
if (!param->cert.filecert || !strlen(param->cert.filecert)) { if (!param->cert.filecert || !strlen(param->cert.filecert)) {
capwap_logging_debug("Error, request certificate file"); log_printf(LOG_DEBUG, "Error, request certificate file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} else if (!param->cert.filekey || !strlen(param->cert.filekey)) { } else if (!param->cert.filekey || !strlen(param->cert.filekey)) {
capwap_logging_debug("Error, request privatekey file"); log_printf(LOG_DEBUG, "Error, request privatekey file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} else if (!param->cert.fileca || !strlen(param->cert.fileca)) { } else if (!param->cert.fileca || !strlen(param->cert.fileca)) {
capwap_logging_debug("Error, request ca file"); log_printf(LOG_DEBUG, "Error, request ca file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
/* Public certificate */ /* Public certificate */
if (!wolfSSL_CTX_use_certificate_file((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.filecert, SSL_FILETYPE_PEM)) { if (!wolfSSL_CTX_use_certificate_file((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.filecert, SSL_FILETYPE_PEM)) {
capwap_logging_debug("Error to load certificate file"); log_printf(LOG_DEBUG, "Error to load certificate file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
/* Private key */ /* Private key */
if (!wolfSSL_CTX_use_PrivateKey_file((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.filekey, SSL_FILETYPE_PEM)) { if (!wolfSSL_CTX_use_PrivateKey_file((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.filekey, SSL_FILETYPE_PEM)) {
capwap_logging_debug("Error to load private key file"); log_printf(LOG_DEBUG, "Error to load private key file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
if (!wolfSSL_CTX_check_private_key((WOLFSSL_CTX*)dtlscontext->sslcontext)) { if (!wolfSSL_CTX_check_private_key((WOLFSSL_CTX*)dtlscontext->sslcontext)) {
capwap_logging_debug("Error to check private key"); log_printf(LOG_DEBUG, "Error to check private key");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
/* Certificate Authority */ /* Certificate Authority */
if (!wolfSSL_CTX_load_verify_locations((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.fileca, NULL)) { if (!wolfSSL_CTX_load_verify_locations((WOLFSSL_CTX*)dtlscontext->sslcontext, param->cert.fileca, NULL)) {
capwap_logging_debug("Error to load ca file"); log_printf(LOG_DEBUG, "Error to load ca file");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -299,7 +299,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA
*/ */
if (!wolfSSL_CTX_set_cipher_list((WOLFSSL_CTX*)dtlscontext->sslcontext, "AES128-SHA:DHE-RSA-AES128-SHA:AES256-SHA:DHE-RSA-AES256-SHA")) { if (!wolfSSL_CTX_set_cipher_list((WOLFSSL_CTX*)dtlscontext->sslcontext, "AES128-SHA:DHE-RSA-AES128-SHA:AES256-SHA:DHE-RSA-AES256-SHA")) {
capwap_logging_debug("Error to select cipher list"); log_printf(LOG_DEBUG, "Error to select cipher list");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -311,7 +311,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
TLS_DHE_PSK_WITH_AES_256_CBC_SHA TLS_DHE_PSK_WITH_AES_256_CBC_SHA
*/ */
if (!wolfSSL_CTX_set_cipher_list((WOLFSSL_CTX*)dtlscontext->sslcontext, "PSK-AES128-CBC-SHA:PSK-AES256-CBC-SHA")) { if (!wolfSSL_CTX_set_cipher_list((WOLFSSL_CTX*)dtlscontext->sslcontext, "PSK-AES128-CBC-SHA:PSK-AES256-CBC-SHA")) {
capwap_logging_debug("Error to select cipher list"); log_printf(LOG_DEBUG, "Error to select cipher list");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -321,7 +321,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
if (param->presharedkey.hint) { if (param->presharedkey.hint) {
wolfSSL_CTX_use_psk_identity_hint((WOLFSSL_CTX*)dtlscontext->sslcontext, param->presharedkey.hint); wolfSSL_CTX_use_psk_identity_hint((WOLFSSL_CTX*)dtlscontext->sslcontext, param->presharedkey.hint);
} else { } else {
capwap_logging_debug("Error to presharedkey hint"); log_printf(LOG_DEBUG, "Error to presharedkey hint");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -331,7 +331,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
dtlscontext->presharedkey.identity = capwap_duplicate_string(param->presharedkey.identity); dtlscontext->presharedkey.identity = capwap_duplicate_string(param->presharedkey.identity);
dtlscontext->presharedkey.pskkeylength = capwap_crypt_psk_to_bin(param->presharedkey.pskkey, &dtlscontext->presharedkey.pskkey); dtlscontext->presharedkey.pskkeylength = capwap_crypt_psk_to_bin(param->presharedkey.pskkey, &dtlscontext->presharedkey.pskkey);
if (!dtlscontext->presharedkey.pskkeylength) { if (!dtlscontext->presharedkey.pskkeylength) {
capwap_logging_debug("Error to presharedkey"); log_printf(LOG_DEBUG, "Error to presharedkey");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -343,7 +343,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c
wolfSSL_CTX_set_psk_client_callback((WOLFSSL_CTX*)dtlscontext->sslcontext, capwap_crypt_psk_client); wolfSSL_CTX_set_psk_client_callback((WOLFSSL_CTX*)dtlscontext->sslcontext, capwap_crypt_psk_client);
} }
} else { } else {
capwap_logging_debug("Invalid DTLS mode"); log_printf(LOG_DEBUG, "Invalid DTLS mode");
capwap_crypt_freecontext(dtlscontext); capwap_crypt_freecontext(dtlscontext);
return 0; return 0;
} }
@ -383,7 +383,7 @@ int capwap_crypt_createsession(struct capwap_dtls* dtls, struct capwap_dtls_cont
/* Create ssl session */ /* Create ssl session */
dtls->sslsession = (void*)wolfSSL_new((WOLFSSL_CTX*)dtlscontext->sslcontext); dtls->sslsession = (void*)wolfSSL_new((WOLFSSL_CTX*)dtlscontext->sslcontext);
if (!dtls->sslsession) { if (!dtls->sslsession) {
capwap_logging_debug("Error to initialize dtls session"); log_printf(LOG_DEBUG, "Error to initialize dtls session");
return 0; return 0;
} }
@ -498,7 +498,7 @@ int capwap_crypt_sendto(struct capwap_dtls* dtls, void* buffer, int size) {
if (!dtls->enable) { if (!dtls->enable) {
err = capwap_sendto(dtls->sock, buffer, size, &dtls->peeraddr); err = capwap_sendto(dtls->sock, buffer, size, &dtls->peeraddr);
if (err <= 0) { if (err <= 0) {
capwap_logging_warning("Unable to send plain packet, sentto return error %d", err); log_printf(LOG_WARNING, "Unable to send plain packet, sentto return error %d", err);
} }
return err; return err;
@ -535,7 +535,7 @@ int capwap_crypt_sendto_fragmentpacket(struct capwap_dtls* dtls, struct capwap_l
err = capwap_crypt_sendto(dtls, fragmentpacket->buffer, fragmentpacket->offset); err = capwap_crypt_sendto(dtls, fragmentpacket->buffer, fragmentpacket->offset);
if (err <= 0) { if (err <= 0) {
capwap_logging_warning("Unable to send crypt fragment, sentto return error %d", err); log_printf(LOG_WARNING, "Unable to send crypt fragment, sentto return error %d", err);
return 0; return 0;
} }
@ -572,7 +572,7 @@ int capwap_decrypt_packet(struct capwap_dtls* dtls, void* encrybuffer, int size,
/* */ /* */
if (dtls->action == CAPWAP_DTLS_ACTION_HANDSHAKE) { if (dtls->action == CAPWAP_DTLS_ACTION_HANDSHAKE) {
if (capwap_crypt_handshake(dtls) == CAPWAP_HANDSHAKE_ERROR) { if (capwap_crypt_handshake(dtls) == CAPWAP_HANDSHAKE_ERROR) {
capwap_logging_debug("Error in DTLS handshake"); log_printf(LOG_DEBUG, "Error in DTLS handshake");
result = CAPWAP_ERROR_CLOSE; /* Error handshake */ result = CAPWAP_ERROR_CLOSE; /* Error handshake */
} else { } else {
result = CAPWAP_ERROR_AGAIN; /* Don't parsing DTLS packet */ result = CAPWAP_ERROR_AGAIN; /* Don't parsing DTLS packet */

View File

@ -212,27 +212,27 @@ int capwap_parsing_packet(struct capwap_packet_rxmng* rxmngpacket, struct capwap
(binding != CAPWAP_WIRELESS_BINDING_IEEE80211)) (binding != CAPWAP_WIRELESS_BINDING_IEEE80211))
return UNRECOGNIZED_MESSAGE_ELEMENT; return UNRECOGNIZED_MESSAGE_ELEMENT;
capwap_logging_debug("MESSAGE ELEMENT: %d", id.type); log_printf(LOG_DEBUG, "MESSAGE ELEMENT: %d", id.type);
if (id.type == CAPWAP_ELEMENT_VENDORPAYLOAD_TYPE) { if (id.type == CAPWAP_ELEMENT_VENDORPAYLOAD_TYPE) {
struct capwap_message_element_id vendor_id; struct capwap_message_element_id vendor_id;
if (msglength < 7) { if (msglength < 7) {
capwap_logging_debug("Invalid Vendor Specific Payload element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Vendor Specific Payload element: underbuffer");
return INVALID_MESSAGE_ELEMENT; return INVALID_MESSAGE_ELEMENT;
} }
if ((msglength - 6) > CAPWAP_VENDORPAYLOAD_MAXLENGTH) { if ((msglength - 6) > CAPWAP_VENDORPAYLOAD_MAXLENGTH) {
capwap_logging_debug("Invalid Vendor Specific Payload element: overbuffer"); log_printf(LOG_DEBUG, "Invalid Vendor Specific Payload element: overbuffer");
return INVALID_MESSAGE_ELEMENT; return INVALID_MESSAGE_ELEMENT;
} }
rxmngpacket->read_ops.read_u32((capwap_message_elements_handle)rxmngpacket, &vendor_id.vendor); rxmngpacket->read_ops.read_u32((capwap_message_elements_handle)rxmngpacket, &vendor_id.vendor);
rxmngpacket->read_ops.read_u16((capwap_message_elements_handle)rxmngpacket, &vendor_id.type); rxmngpacket->read_ops.read_u16((capwap_message_elements_handle)rxmngpacket, &vendor_id.type);
capwap_logging_debug("VENDOR MESSAGE ELEMENT: %06x:%d", vendor_id.vendor, vendor_id.type); log_printf(LOG_DEBUG, "VENDOR MESSAGE ELEMENT: %06x:%d", vendor_id.vendor, vendor_id.type);
read_ops = capwap_get_message_element_ops(vendor_id); read_ops = capwap_get_message_element_ops(vendor_id);
capwap_logging_debug("vendor read_ops: %p", read_ops); log_printf(LOG_DEBUG, "vendor read_ops: %p", read_ops);
if (read_ops) { if (read_ops) {
id = vendor_id; id = vendor_id;
element = read_ops->parse((capwap_message_elements_handle)rxmngpacket, &rxmngpacket->read_ops); element = read_ops->parse((capwap_message_elements_handle)rxmngpacket, &rxmngpacket->read_ops);
@ -244,7 +244,7 @@ int capwap_parsing_packet(struct capwap_packet_rxmng* rxmngpacket, struct capwap
} else { } else {
/* Reader function */ /* Reader function */
read_ops = capwap_get_message_element_ops(id); read_ops = capwap_get_message_element_ops(id);
capwap_logging_debug("read_ops: %p", read_ops); log_printf(LOG_DEBUG, "read_ops: %p", read_ops);
if (!read_ops) if (!read_ops)
return UNRECOGNIZED_MESSAGE_ELEMENT; return UNRECOGNIZED_MESSAGE_ELEMENT;

View File

@ -99,7 +99,7 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 20) { if (length < 20) {
capwap_logging_debug("Invalid IEEE 802.11 Add WLAN element: underbuffer"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Add WLAN element: underbuffer");
return NULL; return NULL;
} }
@ -113,11 +113,11 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_80211_addwlan_element_free((void*)data); capwap_80211_addwlan_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Add WLAN element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Add WLAN element: invalid radioid");
return NULL; return NULL;
} else if (!IS_VALID_WLANID(data->wlanid)) { } else if (!IS_VALID_WLANID(data->wlanid)) {
capwap_80211_addwlan_element_free((void*)data); capwap_80211_addwlan_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Add WLAN element: invalid wlanid"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Add WLAN element: invalid wlanid");
return NULL; return NULL;
} }
@ -141,7 +141,7 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (!length || (length > CAPWAP_ADD_WLAN_SSID_LENGTH)) { if (!length || (length > CAPWAP_ADD_WLAN_SSID_LENGTH)) {
capwap_80211_addwlan_element_free((void*)data); capwap_80211_addwlan_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Add WLAN element: invalid ssid"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Add WLAN element: invalid ssid");
return NULL; return NULL;
} }

View File

@ -75,13 +75,13 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 5) { if (length < 5) {
capwap_logging_debug("Invalid IEEE 802.11 Antenna element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Antenna element");
return NULL; return NULL;
} }
length -= 4; length -= 4;
if (length > CAPWAP_ANTENNASELECTIONS_MAXLENGTH) { if (length > CAPWAP_ANTENNASELECTIONS_MAXLENGTH) {
capwap_logging_debug("Invalid IEEE 802.11 Antenna element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Antenna element");
return NULL; return NULL;
} }
@ -94,7 +94,7 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle
func->read_u8(handle, &data->radioid); func->read_u8(handle, &data->radioid);
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_80211_antenna_element_free((void*)data); capwap_80211_antenna_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Antenna element element: invalid radio"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Antenna element element: invalid radio");
return NULL; return NULL;
} }
@ -104,7 +104,7 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle
/* Check */ /* Check */
if (count != length) { if (count != length) {
capwap_logging_debug("Invalid IEEE 802.11 Antenna element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Antenna element");
capwap_free(data); capwap_free(data);
return NULL; return NULL;
} }

View File

@ -36,7 +36,7 @@ static void* capwap_80211_assignbssid_element_parsing(capwap_message_elements_ha
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 Assigned WTP BSSID element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Assigned WTP BSSID element");
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ static void* capwap_80211_deletewlan_element_parsing(capwap_message_elements_han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 2) { if (func->read_ready(handle) != 2) {
capwap_logging_debug("Invalid IEEE 802.11 Delete WLAN element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Delete WLAN element");
return NULL; return NULL;
} }

View File

@ -54,7 +54,7 @@ static void* capwap_80211_directsequencecontrol_element_parsing(capwap_message_e
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 Direct Sequence Control element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Direct Sequence Control element");
return NULL; return NULL;
} }
@ -66,7 +66,7 @@ static void* capwap_80211_directsequencecontrol_element_parsing(capwap_message_e
func->read_u8(handle, &data->radioid); func->read_u8(handle, &data->radioid);
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_80211_directsequencecontrol_element_free((void*)data); capwap_80211_directsequencecontrol_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Direct Sequence Control element: invalid radio"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Direct Sequence Control element: invalid radio");
return NULL; return NULL;
} }

View File

@ -37,7 +37,7 @@ static void* capwap_80211_ie_element_parsing(capwap_message_elements_handle hand
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 4) { if (length < 4) {
capwap_logging_debug("Invalid IEEE 802.11 Information Element element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Information Element element");
return NULL; return NULL;
} }

View File

@ -46,7 +46,7 @@ static void* capwap_80211_macoperation_element_parsing(capwap_message_elements_h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 16) { if (func->read_ready(handle) != 16) {
capwap_logging_debug("Invalid IEEE 802.11 MAC Operation element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 MAC Operation element");
return NULL; return NULL;
} }

View File

@ -36,7 +36,7 @@ static void* capwap_80211_miccountermeasures_element_parsing(capwap_message_elem
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 MIC Countermeasures element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 MIC Countermeasures element");
return NULL; return NULL;
} }

View File

@ -39,7 +39,7 @@ static void* capwap_80211_multidomaincapability_element_parsing(capwap_message_e
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 Multi-Domain Capability element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Multi-Domain Capability element");
return NULL; return NULL;
} }

View File

@ -39,7 +39,7 @@ static void* capwap_80211_ofdmcontrol_element_parsing(capwap_message_elements_ha
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 OFDM Control element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 OFDM Control element");
return NULL; return NULL;
} }

View File

@ -35,13 +35,13 @@ static void* capwap_80211_rateset_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 3) { if (length < 3) {
capwap_logging_debug("Invalid IEEE 802.11 Rate Set element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Rate Set element");
return NULL; return NULL;
} }
length -= 1; length -= 1;
if (length > CAPWAP_RATESET_MAXLENGTH) { if (length > CAPWAP_RATESET_MAXLENGTH) {
capwap_logging_debug("Invalid IEEE 802.11 Rate Set element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Rate Set element");
return NULL; return NULL;
} }

View File

@ -61,7 +61,7 @@ static void* capwap_80211_rsnaerrorreport_element_parsing(capwap_message_element
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 40) { if (func->read_ready(handle) != 40) {
capwap_logging_debug("Invalid IEEE 802.11 RSNA Error Report From Station element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 RSNA Error Report From Station element");
return NULL; return NULL;
} }

View File

@ -46,13 +46,13 @@ static void* capwap_80211_station_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 14) { if (length < 14) {
capwap_logging_debug("Invalid IEEE 802.11 Station element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Station element");
return NULL; return NULL;
} }
length -= 13; length -= 13;
if (length > CAPWAP_STATION_RATES_MAXLENGTH) { if (length > CAPWAP_STATION_RATES_MAXLENGTH) {
capwap_logging_debug("Invalid IEEE 802.11 Station element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Station element");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_han
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 25) { if (length < 25) {
capwap_logging_debug("Invalid IEEE 802.11 Station Session Key element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Station Session Key element");
return NULL; return NULL;
} }

View File

@ -36,7 +36,7 @@ static void* capwap_80211_stationqos_element_parsing(capwap_message_elements_han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11 Station QoS Profile element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Station QoS Profile element");
return NULL; return NULL;
} }

View File

@ -91,7 +91,7 @@ static void* capwap_80211_statistics_element_parsing(capwap_message_elements_han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 80) { if (func->read_ready(handle) != 80) {
capwap_logging_debug("Invalid IEEE 802.11 Statistics element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Statistics element");
return NULL; return NULL;
} }

View File

@ -35,13 +35,13 @@ static void* capwap_80211_supportedrates_element_parsing(capwap_message_elements
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 3) { if (length < 3) {
capwap_logging_debug("Invalid IEEE 802.11 Supported Rates element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported Rates element");
return NULL; return NULL;
} }
length -= 1; length -= 1;
if (length > CAPWAP_RATESET_MAXLENGTH) { if (length > CAPWAP_RATESET_MAXLENGTH) {
capwap_logging_debug("Invalid IEEE 802.11 Supported Rates element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported Rates element");
return NULL; return NULL;
} }

View File

@ -35,7 +35,7 @@ static void* capwap_80211_txpower_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid IEEE 802.11 Tx Power element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Tx Power element");
return NULL; return NULL;
} }

View File

@ -40,13 +40,13 @@ static void* capwap_80211_txpowerlevel_element_parsing(capwap_message_elements_h
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 4) { if (length < 4) {
capwap_logging_debug("Invalid IEEE 802.11 Tx Power Level element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Tx Power Level element");
return NULL; return NULL;
} }
length -= 2; length -= 2;
if ((length % sizeof(uint16_t)) || ((length / sizeof(uint16_t)) > CAPWAP_TXPOWERLEVEL_MAXLENGTH)) { if ((length % sizeof(uint16_t)) || ((length / sizeof(uint16_t)) > CAPWAP_TXPOWERLEVEL_MAXLENGTH)) {
capwap_logging_debug("Invalid IEEE 802.11 Tx Power Level element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Tx Power Level element");
return NULL; return NULL;
} }
@ -60,7 +60,7 @@ static void* capwap_80211_txpowerlevel_element_parsing(capwap_message_elements_h
/* Check */ /* Check */
if ((data->numlevels * sizeof(uint16_t)) != length) { if ((data->numlevels * sizeof(uint16_t)) != length) {
capwap_logging_debug("Invalid IEEE 802.11 Tx Power Level element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Tx Power Level element");
capwap_free(data); capwap_free(data);
return NULL; return NULL;
} }

View File

@ -47,7 +47,7 @@ static void* capwap_80211_updatestationqos_element_parsing(capwap_message_elemen
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 14) { if (func->read_ready(handle) != 14) {
capwap_logging_debug("Invalid IEEE 802.11 Update Station QoS element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Update Station QoS element");
return NULL; return NULL;
} }

View File

@ -73,7 +73,7 @@ static void* capwap_80211_updatewlan_element_parsing(capwap_message_elements_han
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 8) { if (length < 8) {
capwap_logging_debug("Invalid IEEE 802.11 Update WLAN element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Update WLAN element");
return NULL; return NULL;
} }
@ -93,7 +93,7 @@ static void* capwap_80211_updatewlan_element_parsing(capwap_message_elements_han
if (length != data->keylength) { if (length != data->keylength) {
capwap_80211_updatewlan_element_free((void*)data); capwap_80211_updatewlan_element_free((void*)data);
capwap_logging_debug("Invalid IEEE 802.11 Update WLAN element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Update WLAN element");
return NULL; return NULL;
} else if (data->keylength > 0) { } else if (data->keylength > 0) {
data->key = (uint8_t*)capwap_alloc(data->keylength); data->key = (uint8_t*)capwap_alloc(data->keylength);

View File

@ -51,7 +51,7 @@ static void* capwap_80211_wtpqos_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 34) { if (func->read_ready(handle) != 34) {
capwap_logging_debug("Invalid IEEE 802.11 WTP QoS element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 WTP QoS element");
return NULL; return NULL;
} }

View File

@ -44,7 +44,7 @@ static void* capwap_80211_wtpradioconf_element_parsing(capwap_message_elements_h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 16) { if (func->read_ready(handle) != 16) {
capwap_logging_debug("Invalid IEEE 802.11 WTP WLAN Radio Configuration element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 WTP WLAN Radio Configuration element");
return NULL; return NULL;
} }

View File

@ -35,7 +35,7 @@ static void* capwap_80211_wtpradiofailalarm_element_parsing(capwap_message_eleme
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid IEEE 802.11 WTP Radio Fail Alarm Indication element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 WTP Radio Fail Alarm Indication element");
return NULL; return NULL;
} }

View File

@ -36,7 +36,7 @@ static void* capwap_80211_wtpradioinformation_element_parsing(capwap_message_ele
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 5) { if (func->read_ready(handle) != 5) {
capwap_logging_debug("Invalid IEEE 802.11 WTP Radio Information element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11 WTP Radio Information element");
return NULL; return NULL;
} }

View File

@ -45,7 +45,7 @@ capwap_80211n_radioconf_element_parsing(capwap_message_elements_handle handle,
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 8) { if (func->read_ready(handle) != 8) {
capwap_logging_debug("Invalid IEEE 802.11n Radio Configuration element"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11n Radio Configuration element");
return NULL; return NULL;
} }

View File

@ -53,7 +53,7 @@ capwap_80211n_station_info_element_parsing(capwap_message_elements_handle handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 24) { if (func->read_ready(handle) != 24) {
capwap_logging_debug("Invalid IEEE 802.11n Station Information"); log_printf(LOG_DEBUG, "Invalid IEEE 802.11n Station Information");
return NULL; return NULL;
} }

View File

@ -118,7 +118,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) < 12) { if (func->read_ready(handle) < 12) {
capwap_logging_debug("Invalid AC Descriptor element: underbuffer"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: underbuffer");
return NULL; return NULL;
} }
@ -135,11 +135,11 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle
/* Check */ /* Check */
if (data->stations > data->stationlimit) { if (data->stations > data->stationlimit) {
capwap_logging_debug("Invalid AC Descriptor element: stations > stationlimit"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: stations > stationlimit");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} else if (data->activewtp > data->maxwtp) { } else if (data->activewtp > data->maxwtp) {
capwap_logging_debug("Invalid AC Descriptor element: activewtp > maxwtp"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: activewtp > maxwtp");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -152,15 +152,15 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle
/* */ /* */
if (data->security & ~CAPWAP_ACDESC_SECURITY_MASK) { if (data->security & ~CAPWAP_ACDESC_SECURITY_MASK) {
capwap_logging_debug("Invalid AC Descriptor element: security"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: security");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} else if (data->dtlspolicy & ~CAPWAP_ACDESC_DTLS_POLICY_MASK) { } else if (data->dtlspolicy & ~CAPWAP_ACDESC_DTLS_POLICY_MASK) {
capwap_logging_debug("Invalid AC Descriptor element: dtlspolicy"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: dtlspolicy");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} else if ((data->rmacfield != CAPWAP_ACDESC_RMACFIELD_SUPPORTED) && (data->rmacfield != CAPWAP_ACDESC_RMACFIELD_NOTSUPPORTED)) { } else if ((data->rmacfield != CAPWAP_ACDESC_RMACFIELD_SUPPORTED) && (data->rmacfield != CAPWAP_ACDESC_RMACFIELD_NOTSUPPORTED)) {
capwap_logging_debug("Invalid AC Descriptor element: rmacfield"); log_printf(LOG_DEBUG, "Invalid AC Descriptor element: rmacfield");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -176,7 +176,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle
func->read_u16(handle, &desc->length); func->read_u16(handle, &desc->length);
if ((desc->type != CAPWAP_ACDESC_SUBELEMENT_HARDWAREVERSION) && (desc->type != CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION)) { if ((desc->type != CAPWAP_ACDESC_SUBELEMENT_HARDWAREVERSION) && (desc->type != CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION)) {
capwap_logging_debug("Invalid AC Descriptor subelement: type"); log_printf(LOG_DEBUG, "Invalid AC Descriptor subelement: type");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -184,7 +184,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle
/* Check buffer size */ /* Check buffer size */
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length > CAPWAP_ACDESC_SUBELEMENT_MAXDATA) || (length < desc->length)) { if ((length > CAPWAP_ACDESC_SUBELEMENT_MAXDATA) || (length < desc->length)) {
capwap_logging_debug("Invalid AC Descriptor subelement: length"); log_printf(LOG_DEBUG, "Invalid AC Descriptor subelement: length");
capwap_acdescriptor_element_free(data); capwap_acdescriptor_element_free(data);
return NULL; return NULL;
} }

View File

@ -38,7 +38,7 @@ static void* capwap_acipv4list_element_parsing(capwap_message_elements_handle ha
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length >= 4) && (length <= CAPWAP_ACIPV4LIST_MAX_ELEMENTS * 4) && (length % 4)) { if ((length >= 4) && (length <= CAPWAP_ACIPV4LIST_MAX_ELEMENTS * 4) && (length % 4)) {
capwap_logging_debug("Invalid AC IPv4 List element: unbuffer"); log_printf(LOG_DEBUG, "Invalid AC IPv4 List element: unbuffer");
return NULL; return NULL;
} }

View File

@ -44,7 +44,7 @@ static void* capwap_acipv6list_element_parsing(capwap_message_elements_handle ha
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length >= 16) && (length <= CAPWAP_ACIPV4LIST_MAX_ELEMENTS * 16) && (length % 16)) { if ((length >= 16) && (length <= CAPWAP_ACIPV4LIST_MAX_ELEMENTS * 16) && (length % 16)) {
capwap_logging_debug("Invalid AC IPv6 List element: underbuffer"); log_printf(LOG_DEBUG, "Invalid AC IPv6 List element: underbuffer");
return NULL; return NULL;
} }

View File

@ -35,7 +35,7 @@ static void* capwap_acname_element_parsing(capwap_message_elements_handle handle
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length < 1) || (length > CAPWAP_ACNAME_MAXLENGTH)) { if ((length < 1) || (length > CAPWAP_ACNAME_MAXLENGTH)) {
capwap_logging_debug("Invalid AC Name element: underbuffer"); log_printf(LOG_DEBUG, "Invalid AC Name element: underbuffer");
return NULL; return NULL;
} }

View File

@ -35,7 +35,7 @@ static void* capwap_acnamepriority_element_parsing(capwap_message_elements_handl
length = func->read_ready(handle) - 1; length = func->read_ready(handle) - 1;
if ((length < 1) || (length > CAPWAP_ACNAMEPRIORITY_MAXLENGTH)) { if ((length < 1) || (length > CAPWAP_ACNAMEPRIORITY_MAXLENGTH)) {
capwap_logging_debug("Invalid AC Name Priority element: underbuffer"); log_printf(LOG_DEBUG, "Invalid AC Name Priority element: underbuffer");
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ static void* capwap_actimestamp_element_parsing(capwap_message_elements_handle h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid AC Timestamp element: underbuffer"); log_printf(LOG_DEBUG, "Invalid AC Timestamp element: underbuffer");
return NULL; return NULL;
} }

View File

@ -65,7 +65,7 @@ static void* capwap_addmacacl_element_parsing(capwap_message_elements_handle han
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 8) { if (length < 8) {
capwap_logging_debug("Invalid Add MAC ACL Entry element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Add MAC ACL Entry element: underbuffer");
return NULL; return NULL;
} }
@ -81,17 +81,17 @@ static void* capwap_addmacacl_element_parsing(capwap_message_elements_handle han
if (!data->entry) { if (!data->entry) {
capwap_addmacacl_element_free((void*)data); capwap_addmacacl_element_free((void*)data);
capwap_logging_debug("Invalid Add MAC ACL Entry element: invalid entry"); log_printf(LOG_DEBUG, "Invalid Add MAC ACL Entry element: invalid entry");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) {
capwap_addmacacl_element_free((void*)data); capwap_addmacacl_element_free((void*)data);
capwap_logging_debug("Invalid Add MAC ACL Entry element: invalid length"); log_printf(LOG_DEBUG, "Invalid Add MAC ACL Entry element: invalid length");
return NULL; return NULL;
} }
if (length != (data->entry * data->length)) { if (length != (data->entry * data->length)) {
capwap_addmacacl_element_free((void*)data); capwap_addmacacl_element_free((void*)data);
capwap_logging_debug("Invalid Add MAC ACL Entry element: invalid total length"); log_printf(LOG_DEBUG, "Invalid Add MAC ACL Entry element: invalid total length");
return NULL; return NULL;
} }

View File

@ -82,7 +82,7 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 8) { if (length < 8) {
capwap_logging_debug("Invalid Add Station element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Add Station element: underbuffer");
return NULL; return NULL;
} }
@ -98,11 +98,11 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_addstation_element_free((void*)data); capwap_addstation_element_free((void*)data);
capwap_logging_debug("Invalid Add Station element: invalid radio"); log_printf(LOG_DEBUG, "Invalid Add Station element: invalid radio");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length < data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length < data->length)) {
capwap_addstation_element_free((void*)data); capwap_addstation_element_free((void*)data);
capwap_logging_debug("Invalid Add Station element: invalid length"); log_printf(LOG_DEBUG, "Invalid Add Station element: invalid length");
return NULL; return NULL;
} }
@ -117,7 +117,7 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha
data->vlan[length] = 0; data->vlan[length] = 0;
} else { } else {
capwap_addstation_element_free((void*)data); capwap_addstation_element_free((void*)data);
capwap_logging_debug("Invalid Add Station element: invalid vlan"); log_printf(LOG_DEBUG, "Invalid Add Station element: invalid vlan");
return NULL; return NULL;
} }
} }

View File

@ -36,7 +36,7 @@ static void* capwap_controlipv4_element_parsing(capwap_message_elements_handle h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 6) { if (func->read_ready(handle) != 6) {
capwap_logging_debug("Invalid Control IPv4 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Control IPv4 Address element: underbuffer");
return NULL; return NULL;
} }

View File

@ -42,7 +42,7 @@ static void* capwap_controlipv6_element_parsing(capwap_message_elements_handle h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 18) { if (func->read_ready(handle) != 18) {
capwap_logging_debug("Invalid Control IPv6 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Control IPv6 Address element: underbuffer");
return NULL; return NULL;
} }

View File

@ -69,7 +69,7 @@ static void* capwap_datatransferdata_element_parsing(capwap_message_elements_han
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 5) { if (length < 5) {
capwap_logging_debug("Invalid Data Transfer Data element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Data Transfer Data element: underbuffer");
return NULL; return NULL;
} }
@ -86,15 +86,15 @@ static void* capwap_datatransferdata_element_parsing(capwap_message_elements_han
if ((data->type != CAPWAP_DATATRANSFERDATA_TYPE_DATA_IS_INCLUDED) && (data->type != CAPWAP_DATATRANSFERDATA_TYPE_DATA_EOF) && (data->type != CAPWAP_DATATRANSFERDATA_TYPE_ERROR)) { if ((data->type != CAPWAP_DATATRANSFERDATA_TYPE_DATA_IS_INCLUDED) && (data->type != CAPWAP_DATATRANSFERDATA_TYPE_DATA_EOF) && (data->type != CAPWAP_DATATRANSFERDATA_TYPE_ERROR)) {
capwap_datatransferdata_element_free((void*)data); capwap_datatransferdata_element_free((void*)data);
capwap_logging_debug("Invalid Data Transfer Data element: invalid type"); log_printf(LOG_DEBUG, "Invalid Data Transfer Data element: invalid type");
return NULL; return NULL;
} else if ((data->mode != CAPWAP_DATATRANSFERDATA_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERDATA_MODE_MEMORY_DUMP)) { } else if ((data->mode != CAPWAP_DATATRANSFERDATA_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERDATA_MODE_MEMORY_DUMP)) {
capwap_datatransferdata_element_free((void*)data); capwap_datatransferdata_element_free((void*)data);
capwap_logging_debug("Invalid Data Transfer Data element: invalid mode"); log_printf(LOG_DEBUG, "Invalid Data Transfer Data element: invalid mode");
return NULL; return NULL;
} else if (length != data->length) { } else if (length != data->length) {
capwap_datatransferdata_element_free((void*)data); capwap_datatransferdata_element_free((void*)data);
capwap_logging_debug("Invalid Data Transfer Data element: invalid length"); log_printf(LOG_DEBUG, "Invalid Data Transfer Data element: invalid length");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_datatransfermode_element_parsing(capwap_message_elements_han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid Data Transfer Mode element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Data Transfer Mode element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_datatransfermode_element_parsing(capwap_message_elements_han
func->read_u8(handle, &data->mode); func->read_u8(handle, &data->mode);
if ((data->mode != CAPWAP_DATATRANSFERMODE_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERMODE_MODE_MEMORY_DUMP)) { if ((data->mode != CAPWAP_DATATRANSFERMODE_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERMODE_MODE_MEMORY_DUMP)) {
capwap_datatransfermode_element_free((void*)data); capwap_datatransfermode_element_free((void*)data);
capwap_logging_debug("Invalid Data Transfer Mode element: invalid mode"); log_printf(LOG_DEBUG, "Invalid Data Transfer Mode element: invalid mode");
return NULL; return NULL;
} }

View File

@ -67,7 +67,7 @@ static void* capwap_decrypterrorreport_element_parsing(capwap_message_elements_h
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 9) { if (length < 9) {
capwap_logging_debug("Invalid Decryption Error Report element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: underbuffer");
return NULL; return NULL;
} }
@ -84,21 +84,21 @@ static void* capwap_decrypterrorreport_element_parsing(capwap_message_elements_h
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_decrypterrorreport_element_free((void*)data); capwap_decrypterrorreport_element_free((void*)data);
capwap_logging_debug("Invalid Decryption Error Report element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: invalid radioid");
return NULL; return NULL;
} else if (!data->entry) { } else if (!data->entry) {
capwap_decrypterrorreport_element_free((void*)data); capwap_decrypterrorreport_element_free((void*)data);
capwap_logging_debug("Invalid Decryption Error Report element: invalid entry"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: invalid entry");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) {
capwap_decrypterrorreport_element_free((void*)data); capwap_decrypterrorreport_element_free((void*)data);
capwap_logging_debug("Invalid Decryption Error Report element: invalid length"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: invalid length");
return NULL; return NULL;
} }
if (length != (data->entry * data->length)) { if (length != (data->entry * data->length)) {
capwap_decrypterrorreport_element_free((void*)data); capwap_decrypterrorreport_element_free((void*)data);
capwap_logging_debug("Invalid Decryption Error Report element: invalid total length"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: invalid total length");
return NULL; return NULL;
} }

View File

@ -49,7 +49,7 @@ static void* capwap_decrypterrorreportperiod_element_parsing(capwap_message_elem
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 3) { if (func->read_ready(handle) != 3) {
capwap_logging_debug("Invalid Decryption Error Report Period element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report Period element: underbuffer");
return NULL; return NULL;
} }
@ -60,7 +60,7 @@ static void* capwap_decrypterrorreportperiod_element_parsing(capwap_message_elem
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_decrypterrorreportperiod_element_free((void*)data); capwap_decrypterrorreportperiod_element_free((void*)data);
capwap_logging_debug("Invalid Decryption Error Report Period element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid Decryption Error Report Period element: invalid radioid");
return NULL; return NULL;
} }

View File

@ -65,7 +65,7 @@ static void* capwap_deletemacacl_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 8) { if (length < 8) {
capwap_logging_debug("Invalid Delete MAC ACL Entry element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Delete MAC ACL Entry element: underbuffer");
return NULL; return NULL;
} }
@ -81,17 +81,17 @@ static void* capwap_deletemacacl_element_parsing(capwap_message_elements_handle
if (!data->entry) { if (!data->entry) {
capwap_deletemacacl_element_free((void*)data); capwap_deletemacacl_element_free((void*)data);
capwap_logging_debug("Invalid Delete MAC ACL Entry element: invalid entry"); log_printf(LOG_DEBUG, "Invalid Delete MAC ACL Entry element: invalid entry");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) {
capwap_deletemacacl_element_free((void*)data); capwap_deletemacacl_element_free((void*)data);
capwap_logging_debug("Invalid Delete MAC ACL Entry element: invalid length"); log_printf(LOG_DEBUG, "Invalid Delete MAC ACL Entry element: invalid length");
return NULL; return NULL;
} }
if (length != (data->entry * data->length)) { if (length != (data->entry * data->length)) {
capwap_deletemacacl_element_free((void*)data); capwap_deletemacacl_element_free((void*)data);
capwap_logging_debug("Invalid Delete MAC ACL Entry element"); log_printf(LOG_DEBUG, "Invalid Delete MAC ACL Entry element");
return NULL; return NULL;
} }

View File

@ -65,7 +65,7 @@ static void* capwap_deletestation_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 8) { if (length < 8) {
capwap_logging_debug("Invalid Delete Station element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Delete Station element: underbuffer");
return NULL; return NULL;
} }
@ -81,11 +81,11 @@ static void* capwap_deletestation_element_parsing(capwap_message_elements_handle
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_deletestation_element_free((void*)data); capwap_deletestation_element_free((void*)data);
capwap_logging_debug("Invalid Delete Station element: invalid radio"); log_printf(LOG_DEBUG, "Invalid Delete Station element: invalid radio");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) {
capwap_deletestation_element_free((void*)data); capwap_deletestation_element_free((void*)data);
capwap_logging_debug("Invalid Delete Station element: invalid length"); log_printf(LOG_DEBUG, "Invalid Delete Station element: invalid length");
return NULL; return NULL;
} }

View File

@ -50,7 +50,7 @@ static void* capwap_discoverytype_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid Discovery Type element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Discovery Type element: underbuffer");
return NULL; return NULL;
} }
@ -61,7 +61,7 @@ static void* capwap_discoverytype_element_parsing(capwap_message_elements_handle
(data->type != CAPWAP_DISCOVERYTYPE_TYPE_DHCP) && (data->type != CAPWAP_DISCOVERYTYPE_TYPE_DNS) && (data->type != CAPWAP_DISCOVERYTYPE_TYPE_DHCP) && (data->type != CAPWAP_DISCOVERYTYPE_TYPE_DNS) &&
(data->type != CAPWAP_DISCOVERYTYPE_TYPE_ACREFERRAL)) { (data->type != CAPWAP_DISCOVERYTYPE_TYPE_ACREFERRAL)) {
capwap_discoverytype_element_free((void*)data); capwap_discoverytype_element_free((void*)data);
capwap_logging_debug("Invalid Discovery Type element: invalid type"); log_printf(LOG_DEBUG, "Invalid Discovery Type element: invalid type");
return NULL; return NULL;
} }

View File

@ -68,7 +68,7 @@ static void* capwap_duplicateipv4_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 12) { if (length < 12) {
capwap_logging_debug("Invalid Duplicate IPv4 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv4 Address element: underbuffer");
return NULL; return NULL;
} }
@ -85,11 +85,11 @@ static void* capwap_duplicateipv4_element_parsing(capwap_message_elements_handle
if ((data->status != CAPWAP_DUPLICATEIPv4_CLEARED) && (data->status != CAPWAP_DUPLICATEIPv4_DETECTED)) { if ((data->status != CAPWAP_DUPLICATEIPv4_CLEARED) && (data->status != CAPWAP_DUPLICATEIPv4_DETECTED)) {
capwap_duplicateipv4_element_free((void*)data); capwap_duplicateipv4_element_free((void*)data);
capwap_logging_debug("Invalid Duplicate IPv4 Address element: invalid status"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv4 Address element: invalid status");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) {
capwap_duplicateipv4_element_free((void*)data); capwap_duplicateipv4_element_free((void*)data);
capwap_logging_debug("Invalid Duplicate IPv4 Address element: invalid length"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv4 Address element: invalid length");
return NULL; return NULL;
} }

View File

@ -74,7 +74,7 @@ static void* capwap_duplicateipv6_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 24) { if (length < 24) {
capwap_logging_debug("Invalid Duplicate IPv6 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv6 Address element: underbuffer");
return NULL; return NULL;
} }
@ -91,11 +91,11 @@ static void* capwap_duplicateipv6_element_parsing(capwap_message_elements_handle
if ((data->status != CAPWAP_DUPLICATEIPv6_CLEARED) && (data->status != CAPWAP_DUPLICATEIPv6_DETECTED)) { if ((data->status != CAPWAP_DUPLICATEIPv6_CLEARED) && (data->status != CAPWAP_DUPLICATEIPv6_DETECTED)) {
capwap_duplicateipv6_element_free((void*)data); capwap_duplicateipv6_element_free((void*)data);
capwap_logging_debug("Invalid Duplicate IPv6 Address element: invalid status"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv6 Address element: invalid status");
return NULL; return NULL;
} else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) {
capwap_duplicateipv6_element_free((void*)data); capwap_duplicateipv6_element_free((void*)data);
capwap_logging_debug("Invalid Duplicate IPv6 Address element: invalid length"); log_printf(LOG_DEBUG, "Invalid Duplicate IPv6 Address element: invalid length");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_ecnsupport_element_parsing(capwap_message_elements_handle ha
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid ECN Support element: underbuffer"); log_printf(LOG_DEBUG, "Invalid ECN Support element: underbuffer");
return NULL; return NULL;
} }
@ -58,7 +58,7 @@ static void* capwap_ecnsupport_element_parsing(capwap_message_elements_handle ha
if ((data->flag != CAPWAP_LIMITED_ECN_SUPPORT) && (data->flag != CAPWAP_FULL_ECN_SUPPORT)) { if ((data->flag != CAPWAP_LIMITED_ECN_SUPPORT) && (data->flag != CAPWAP_FULL_ECN_SUPPORT)) {
capwap_ecnsupport_element_free((void*)data); capwap_ecnsupport_element_free((void*)data);
capwap_logging_debug("Invalid ECN Support element: invalid flag"); log_printf(LOG_DEBUG, "Invalid ECN Support element: invalid flag");
return NULL; return NULL;
} }

View File

@ -32,7 +32,7 @@ static void* capwap_idletimeout_element_parsing(capwap_message_elements_handle h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid Idle Timeout element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Idle Timeout element: underbuffer");
return NULL; return NULL;
} }

View File

@ -66,7 +66,7 @@ static void* capwap_imagedata_element_parsing(capwap_message_elements_handle han
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 1) { if (length < 1) {
capwap_logging_debug("Invalid Image Data element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Image Data element: underbuffer");
return NULL; return NULL;
} }
@ -80,15 +80,15 @@ static void* capwap_imagedata_element_parsing(capwap_message_elements_handle han
func->read_u8(handle, &data->type); func->read_u8(handle, &data->type);
if ((data->type != CAPWAP_IMAGEDATA_TYPE_DATA_IS_INCLUDED) && (data->type != CAPWAP_IMAGEDATA_TYPE_DATA_EOF) && (data->type != CAPWAP_IMAGEDATA_TYPE_ERROR)) { if ((data->type != CAPWAP_IMAGEDATA_TYPE_DATA_IS_INCLUDED) && (data->type != CAPWAP_IMAGEDATA_TYPE_DATA_EOF) && (data->type != CAPWAP_IMAGEDATA_TYPE_ERROR)) {
capwap_imagedata_element_free((void*)data); capwap_imagedata_element_free((void*)data);
capwap_logging_debug("Invalid Image Data element: underbuffer: invalid type"); log_printf(LOG_DEBUG, "Invalid Image Data element: underbuffer: invalid type");
return NULL; return NULL;
} else if ((data->type == CAPWAP_IMAGEDATA_TYPE_ERROR) && (length > 0)) { } else if ((data->type == CAPWAP_IMAGEDATA_TYPE_ERROR) && (length > 0)) {
capwap_imagedata_element_free((void*)data); capwap_imagedata_element_free((void*)data);
capwap_logging_debug("Invalid Image Data element: underbuffer: invalid error type"); log_printf(LOG_DEBUG, "Invalid Image Data element: underbuffer: invalid error type");
return NULL; return NULL;
} else if (length > CAPWAP_IMAGEDATA_DATA_MAX_LENGTH) { } else if (length > CAPWAP_IMAGEDATA_DATA_MAX_LENGTH) {
capwap_imagedata_element_free((void*)data); capwap_imagedata_element_free((void*)data);
capwap_logging_debug("Invalid Image Data element: underbuffer: invalid length"); log_printf(LOG_DEBUG, "Invalid Image Data element: underbuffer: invalid length");
return NULL; return NULL;
} }

View File

@ -66,13 +66,13 @@ static void* capwap_imageidentifier_element_parsing(capwap_message_elements_hand
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 5) { if (length < 5) {
capwap_logging_debug("Invalid Image Indentifier element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Image Indentifier element: underbuffer");
return NULL; return NULL;
} }
length -= 4; length -= 4;
if (length > CAPWAP_IMAGEIDENTIFIER_MAXLENGTH) { if (length > CAPWAP_IMAGEIDENTIFIER_MAXLENGTH) {
capwap_logging_debug("Invalid Image Indentifier element: invalid length"); log_printf(LOG_DEBUG, "Invalid Image Indentifier element: invalid length");
return NULL; return NULL;
} }

View File

@ -55,7 +55,7 @@ static void* capwap_imageinfo_element_parsing(capwap_message_elements_handle han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 20) { if (func->read_ready(handle) != 20) {
capwap_logging_debug("Invalid Image Information element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Image Information element: underbuffer");
return NULL; return NULL;
} }

View File

@ -21,7 +21,7 @@ static void* capwap_initdownload_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 0) { if (func->read_ready(handle) != 0) {
capwap_logging_debug("Invalid Initiate Download element"); log_printf(LOG_DEBUG, "Invalid Initiate Download element");
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ static void* capwap_localipv4_element_parsing(capwap_message_elements_handle han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid Local IPv4 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Local IPv4 Address element: underbuffer");
return NULL; return NULL;
} }

View File

@ -38,7 +38,7 @@ static void* capwap_localipv6_element_parsing(capwap_message_elements_handle han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 16) { if (func->read_ready(handle) != 16) {
capwap_logging_debug("Invalid Local IPv6 Address element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Local IPv6 Address element: underbuffer");
return NULL; return NULL;
} }

View File

@ -63,7 +63,7 @@ static void* capwap_location_element_parsing(capwap_message_elements_handle hand
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length < 1) || (length > CAPWAP_LOCATION_MAXLENGTH)) { if ((length < 1) || (length > CAPWAP_LOCATION_MAXLENGTH)) {
capwap_logging_debug("Invalid Location Data element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Location Data element: underbuffer");
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ static void* capwap_maximumlength_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 2) { if (func->read_ready(handle) != 2) {
capwap_logging_debug("Invalid Maxium Message Length element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Maxium Message Length element: underbuffer");
return NULL; return NULL;
} }

View File

@ -40,7 +40,7 @@ static void* capwap_mtudiscovery_element_parsing(capwap_message_elements_handle
length = func->read_ready(handle); length = func->read_ready(handle);
if (length > 0) { if (length > 0) {
capwap_logging_debug("Invalid MTU Discovery Padding element: underbuffer"); log_printf(LOG_DEBUG, "Invalid MTU Discovery Padding element: underbuffer");
return NULL; return NULL;
} }

View File

@ -50,7 +50,7 @@ static void* capwap_radioadmstate_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 2) { if (func->read_ready(handle) != 2) {
capwap_logging_debug("Invalid Radio Administrative State element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Radio Administrative State element: underbuffer");
return NULL; return NULL;
} }
@ -61,11 +61,11 @@ static void* capwap_radioadmstate_element_parsing(capwap_message_elements_handle
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_radioadmstate_element_free((void*)data); capwap_radioadmstate_element_free((void*)data);
capwap_logging_debug("Invalid Radio Administrative State element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid Radio Administrative State element: invalid radioid");
return NULL; return NULL;
} else if ((data->state != CAPWAP_RADIO_ADMIN_STATE_ENABLED) && (data->state != CAPWAP_RADIO_ADMIN_STATE_DISABLED)) { } else if ((data->state != CAPWAP_RADIO_ADMIN_STATE_ENABLED) && (data->state != CAPWAP_RADIO_ADMIN_STATE_DISABLED)) {
capwap_radioadmstate_element_free((void*)data); capwap_radioadmstate_element_free((void*)data);
capwap_logging_debug("Invalid Radio Administrative State element: invalid state"); log_printf(LOG_DEBUG, "Invalid Radio Administrative State element: invalid state");
return NULL; return NULL;
} }

View File

@ -53,7 +53,7 @@ static void* capwap_radiooprstate_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 3) { if (func->read_ready(handle) != 3) {
capwap_logging_debug("Invalid Radio Operational State element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Radio Operational State element: underbuffer");
return NULL; return NULL;
} }
@ -65,18 +65,18 @@ static void* capwap_radiooprstate_element_parsing(capwap_message_elements_handle
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_radiooprstate_element_free((void*)data); capwap_radiooprstate_element_free((void*)data);
capwap_logging_debug("Invalid Radio Operational State element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid Radio Operational State element: invalid radioid");
return NULL; return NULL;
} else if ((data->state != CAPWAP_RADIO_OPERATIONAL_STATE_ENABLED) && (data->state != CAPWAP_RADIO_OPERATIONAL_STATE_DISABLED)) { } else if ((data->state != CAPWAP_RADIO_OPERATIONAL_STATE_ENABLED) && (data->state != CAPWAP_RADIO_OPERATIONAL_STATE_DISABLED)) {
capwap_radiooprstate_element_free((void*)data); capwap_radiooprstate_element_free((void*)data);
capwap_logging_debug("Invalid Radio Operational State element: invalid state"); log_printf(LOG_DEBUG, "Invalid Radio Operational State element: invalid state");
return NULL; return NULL;
} else if ((data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_NORMAL) && } else if ((data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_NORMAL) &&
(data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_RADIOFAILURE) && (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_RADIOFAILURE) &&
(data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_SOFTWAREFAILURE) && (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_SOFTWAREFAILURE) &&
(data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_ADMINSET)) { (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_ADMINSET)) {
capwap_radiooprstate_element_free((void*)data); capwap_radiooprstate_element_free((void*)data);
capwap_logging_debug("Invalid Radio Operational State element: invalid cause"); log_printf(LOG_DEBUG, "Invalid Radio Operational State element: invalid cause");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_resultcode_element_parsing(capwap_message_elements_handle ha
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 4) { if (func->read_ready(handle) != 4) {
capwap_logging_debug("Invalid Result Code element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Result Code element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_resultcode_element_parsing(capwap_message_elements_handle ha
func->read_u32(handle, &data->code); func->read_u32(handle, &data->code);
if ((data->code < CAPWAP_RESULTCODE_FIRST) || (data->code > CAPWAP_RESULTCODE_LAST)) { if ((data->code < CAPWAP_RESULTCODE_FIRST) || (data->code > CAPWAP_RESULTCODE_LAST)) {
capwap_resultcode_element_free((void*)data); capwap_resultcode_element_free((void*)data);
capwap_logging_debug("Invalid Result Code element: invalid code"); log_printf(LOG_DEBUG, "Invalid Result Code element: invalid code");
return NULL; return NULL;
} }

View File

@ -66,13 +66,13 @@ static void* capwap_returnedmessage_element_parsing(capwap_message_elements_hand
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 6) { if (length < 6) {
capwap_logging_debug("Invalid Returned Message element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Returned Message element: underbuffer");
return NULL; return NULL;
} }
length -= 2; length -= 2;
if (length > CAPWAP_RETURNED_MESSAGE_MAX_LENGTH) { if (length > CAPWAP_RETURNED_MESSAGE_MAX_LENGTH) {
capwap_logging_debug("Invalid Returned Message element: overbuffer"); log_printf(LOG_DEBUG, "Invalid Returned Message element: overbuffer");
return NULL; return NULL;
} }
@ -89,11 +89,11 @@ static void* capwap_returnedmessage_element_parsing(capwap_message_elements_hand
(data->reason != CAPWAP_RETURNED_MESSAGE_UNKNOWN_MESSAGE_ELEMENT_VALUE) && (data->reason != CAPWAP_RETURNED_MESSAGE_UNKNOWN_MESSAGE_ELEMENT_VALUE) &&
(data->reason != CAPWAP_RETURNED_MESSAGE_UNSUPPORTED_MESSAGE_ELEMENT_VALUE)) { (data->reason != CAPWAP_RETURNED_MESSAGE_UNSUPPORTED_MESSAGE_ELEMENT_VALUE)) {
capwap_returnedmessage_element_free((void*)data); capwap_returnedmessage_element_free((void*)data);
capwap_logging_debug("Invalid Returned Message element: invalid reason"); log_printf(LOG_DEBUG, "Invalid Returned Message element: invalid reason");
return NULL; return NULL;
} else if (data->length != length) { } else if (data->length != length) {
capwap_returnedmessage_element_free((void*)data); capwap_returnedmessage_element_free((void*)data);
capwap_logging_debug("Invalid Returned Message element: invalid length"); log_printf(LOG_DEBUG, "Invalid Returned Message element: invalid length");
return NULL; return NULL;
} }

View File

@ -65,7 +65,7 @@ static void* capwap_sessionid_element_parsing(capwap_message_elements_handle han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 16) { if (func->read_ready(handle) != 16) {
capwap_logging_debug("Invalid Session ID element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Session ID element: underbuffer");
return NULL; return NULL;
} }

View File

@ -33,7 +33,7 @@ static void* capwap_statisticstimer_element_parsing(capwap_message_elements_hand
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 2) { if (func->read_ready(handle) != 2) {
capwap_logging_debug("Invalid Statistics Timer element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Statistics Timer element: underbuffer");
return NULL; return NULL;
} }

View File

@ -34,7 +34,7 @@ static void* capwap_timers_element_parsing(capwap_message_elements_handle handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 2) { if (func->read_ready(handle) != 2) {
capwap_logging_debug("Invalid Timers element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Timers element: underbuffer");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_transport_element_parsing(capwap_message_elements_handle han
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid Transport Protocol element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Transport Protocol element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_transport_element_parsing(capwap_message_elements_handle han
func->read_u8(handle, &data->type); func->read_u8(handle, &data->type);
if ((data->type != CAPWAP_UDPLITE_TRANSPORT) && (data->type != CAPWAP_UDP_TRANSPORT)) { if ((data->type != CAPWAP_UDPLITE_TRANSPORT) && (data->type != CAPWAP_UDP_TRANSPORT)) {
capwap_transport_element_free((void*)data); capwap_transport_element_free((void*)data);
capwap_logging_debug("Invalid Transport Protocol element: invalid type"); log_printf(LOG_DEBUG, "Invalid Transport Protocol element: invalid type");
return NULL; return NULL;
} }

View File

@ -84,13 +84,13 @@ capwap_vendorpayload_element_parsing(capwap_message_elements_handle handle,
length = func->read_ready(handle); length = func->read_ready(handle);
if (length < 7) { if (length < 7) {
capwap_logging_debug("Invalid Vendor Specific Payload element: underbuffer"); log_printf(LOG_DEBUG, "Invalid Vendor Specific Payload element: underbuffer");
return NULL; return NULL;
} }
length -= 6; length -= 6;
if (length > CAPWAP_VENDORPAYLOAD_MAXLENGTH) { if (length > CAPWAP_VENDORPAYLOAD_MAXLENGTH) {
capwap_logging_debug("Invalid Vendor Specific Payload element: overbuffer"); log_printf(LOG_DEBUG, "Invalid Vendor Specific Payload element: overbuffer");
return NULL; return NULL;
} }

View File

@ -103,7 +103,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) < 14) { if (func->read_ready(handle) < 14) {
capwap_logging_debug("Invalid WTP Board Data element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Board Data element: underbuffer");
return NULL; return NULL;
} }
@ -115,7 +115,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle
func->read_u32(handle, &data->vendor); func->read_u32(handle, &data->vendor);
if (!data->vendor) { if (!data->vendor) {
capwap_wtpboarddata_element_free((void*)data); capwap_wtpboarddata_element_free((void*)data);
capwap_logging_debug("Invalid WTP Board Data element: invalid vendor"); log_printf(LOG_DEBUG, "Invalid WTP Board Data element: invalid vendor");
return NULL; return NULL;
} }
@ -129,7 +129,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle
func->read_u16(handle, &desc->length); func->read_u16(handle, &desc->length);
if ((desc->type < CAPWAP_BOARD_SUBELEMENT_TYPE_FIRST) || (desc->type > CAPWAP_BOARD_SUBELEMENT_TYPE_LAST)) { if ((desc->type < CAPWAP_BOARD_SUBELEMENT_TYPE_FIRST) || (desc->type > CAPWAP_BOARD_SUBELEMENT_TYPE_LAST)) {
capwap_logging_debug("Invalid WTP Board Data element: invalid type"); log_printf(LOG_DEBUG, "Invalid WTP Board Data element: invalid type");
capwap_wtpboarddata_element_free(data); capwap_wtpboarddata_element_free(data);
return NULL; return NULL;
} }
@ -137,7 +137,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle
/* Check buffer size */ /* Check buffer size */
length = func->read_ready(handle); length = func->read_ready(handle);
if (!length || (length > CAPWAP_BOARD_SUBELEMENT_MAXDATA) || (length < desc->length)) { if (!length || (length > CAPWAP_BOARD_SUBELEMENT_MAXDATA) || (length < desc->length)) {
capwap_logging_debug("Invalid WTP Board Data element: invalid length"); log_printf(LOG_DEBUG, "Invalid WTP Board Data element: invalid length");
capwap_wtpboarddata_element_free(data); capwap_wtpboarddata_element_free(data);
return NULL; return NULL;
} }

View File

@ -138,7 +138,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) < 33) { if (func->read_ready(handle) < 33) {
capwap_logging_debug("Invalid WTP Descriptor element: underbufer"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor element: underbufer");
return NULL; return NULL;
} }
@ -155,11 +155,11 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
/* Check */ /* Check */
if (!encryptlength) { if (!encryptlength) {
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
capwap_logging_debug("Invalid WTP Descriptor element: invalid encryptlength"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor element: invalid encryptlength");
return NULL; return NULL;
} else if (data->maxradios < data->radiosinuse) { } else if (data->maxradios < data->radiosinuse) {
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
capwap_logging_debug("Invalid WTP Descriptor element: invalid radio"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor element: invalid radio");
return NULL; return NULL;
} }
@ -169,7 +169,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
/* Check */ /* Check */
if (func->read_ready(handle) < 3) { if (func->read_ready(handle) < 3) {
capwap_logging_debug("Invalid WTP Descriptor subelement: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor subelement: underbuffer");
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -181,7 +181,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
if ((desc->wbid & CAPWAP_WTPDESC_SUBELEMENT_WBID_MASK) != desc->wbid) { if ((desc->wbid & CAPWAP_WTPDESC_SUBELEMENT_WBID_MASK) != desc->wbid) {
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
capwap_logging_debug("Invalid WTP Descriptor element: invalid wbid"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor element: invalid wbid");
return NULL; return NULL;
} }
} }
@ -194,7 +194,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
/* Check */ /* Check */
if (func->read_ready(handle) < 8) { if (func->read_ready(handle) < 8) {
capwap_logging_debug("Invalid WTP Descriptor subelement: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor subelement: underbuffer");
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -206,7 +206,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
func->read_u16(handle, &lengthdesc); func->read_u16(handle, &lengthdesc);
if ((desc->type < CAPWAP_WTPDESC_SUBELEMENT_TYPE_FIRST) || (desc->type > CAPWAP_WTPDESC_SUBELEMENT_TYPE_LAST)) { if ((desc->type < CAPWAP_WTPDESC_SUBELEMENT_TYPE_FIRST) || (desc->type > CAPWAP_WTPDESC_SUBELEMENT_TYPE_LAST)) {
capwap_logging_debug("Invalid WTP Descriptor subelement: invalid type"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor subelement: invalid type");
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
return NULL; return NULL;
} }
@ -214,7 +214,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle
/* Check buffer size */ /* Check buffer size */
length = func->read_ready(handle); length = func->read_ready(handle);
if (!length || (length > CAPWAP_WTPDESC_SUBELEMENT_MAXDATA) || (length < lengthdesc)) { if (!length || (length > CAPWAP_WTPDESC_SUBELEMENT_MAXDATA) || (length < lengthdesc)) {
capwap_logging_debug("Invalid WTP Descriptor element"); log_printf(LOG_DEBUG, "Invalid WTP Descriptor element");
capwap_wtpdescriptor_element_free(data); capwap_wtpdescriptor_element_free(data);
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_wtpfallback_element_parsing(capwap_message_elements_handle h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid WTP Fallback element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Fallback element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_wtpfallback_element_parsing(capwap_message_elements_handle h
func->read_u8(handle, &data->mode); func->read_u8(handle, &data->mode);
if ((data->mode != CAPWAP_WTP_FALLBACK_ENABLED) && (data->mode != CAPWAP_WTP_FALLBACK_DISABLED)) { if ((data->mode != CAPWAP_WTP_FALLBACK_ENABLED) && (data->mode != CAPWAP_WTP_FALLBACK_DISABLED)) {
capwap_wtpfallback_element_free((void*)data); capwap_wtpfallback_element_free((void*)data);
capwap_logging_debug("Invalid WTP Fallback element: invalid mode"); log_printf(LOG_DEBUG, "Invalid WTP Fallback element: invalid mode");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_wtpframetunnelmode_element_parsing(capwap_message_elements_h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid WTP Frame Tunnel Mode element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Frame Tunnel Mode element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_wtpframetunnelmode_element_parsing(capwap_message_elements_h
func->read_u8(handle, &data->mode); func->read_u8(handle, &data->mode);
if ((data->mode & CAPWAP_WTP_FRAME_TUNNEL_MODE_MASK) != data->mode) { if ((data->mode & CAPWAP_WTP_FRAME_TUNNEL_MODE_MASK) != data->mode) {
capwap_wtpframetunnelmode_element_free((void*)data); capwap_wtpframetunnelmode_element_free((void*)data);
capwap_logging_debug("Invalid WTP Frame Tunnel Mode element: invalid mode"); log_printf(LOG_DEBUG, "Invalid WTP Frame Tunnel Mode element: invalid mode");
return NULL; return NULL;
} }

View File

@ -48,7 +48,7 @@ static void* capwap_wtpmactype_element_parsing(capwap_message_elements_handle ha
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 1) { if (func->read_ready(handle) != 1) {
capwap_logging_debug("Invalid WTP MAC Type element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP MAC Type element: underbuffer");
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ static void* capwap_wtpmactype_element_parsing(capwap_message_elements_handle ha
func->read_u8(handle, &data->type); func->read_u8(handle, &data->type);
if ((data->type != CAPWAP_LOCALMAC) && (data->type != CAPWAP_SPLITMAC) && (data->type != CAPWAP_LOCALANDSPLITMAC)) { if ((data->type != CAPWAP_LOCALMAC) && (data->type != CAPWAP_SPLITMAC) && (data->type != CAPWAP_LOCALANDSPLITMAC)) {
capwap_wtpmactype_element_free((void*)data); capwap_wtpmactype_element_free((void*)data);
capwap_logging_debug("Invalid WTP MAC Type element: invalid type"); log_printf(LOG_DEBUG, "Invalid WTP MAC Type element: invalid type");
return NULL; return NULL;
} }

View File

@ -38,7 +38,7 @@ static void* capwap_wtpname_element_parsing(capwap_message_elements_handle handl
length = func->read_ready(handle); length = func->read_ready(handle);
if ((length < 1) || (length > CAPWAP_WTPNAME_MAXLENGTH)) { if ((length < 1) || (length > CAPWAP_WTPNAME_MAXLENGTH)) {
capwap_logging_debug("Invalid WTP Name element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Name element: underbuffer");
return NULL; return NULL;
} }

View File

@ -66,7 +66,7 @@ static void* capwap_wtpradiostat_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 20) { if (func->read_ready(handle) != 20) {
capwap_logging_debug("Invalid WTP Radio Statistics element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Radio Statistics element: underbuffer");
return NULL; return NULL;
} }
@ -75,7 +75,7 @@ static void* capwap_wtpradiostat_element_parsing(capwap_message_elements_handle
func->read_u8(handle, &data->radioid); func->read_u8(handle, &data->radioid);
if (!IS_VALID_RADIOID(data->radioid)) { if (!IS_VALID_RADIOID(data->radioid)) {
capwap_wtpradiostat_element_free((void*)data); capwap_wtpradiostat_element_free((void*)data);
capwap_logging_debug("Invalid WTP Radio Statistics element: invalid radioid"); log_printf(LOG_DEBUG, "Invalid WTP Radio Statistics element: invalid radioid");
return NULL; return NULL;
} }

View File

@ -46,7 +46,7 @@ static void* capwap_wtprebootstat_element_parsing(capwap_message_elements_handle
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 15) { if (func->read_ready(handle) != 15) {
capwap_logging_debug("Invalid WTP Reboot Statistics element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Reboot Statistics element: underbuffer");
return NULL; return NULL;
} }

View File

@ -42,7 +42,7 @@ static void* capwap_wtpstaticipaddress_element_parsing(capwap_message_elements_h
ASSERT(func != NULL); ASSERT(func != NULL);
if (func->read_ready(handle) != 13) { if (func->read_ready(handle) != 13) {
capwap_logging_debug("Invalid WTP Static IP Address Information element: underbuffer"); log_printf(LOG_DEBUG, "Invalid WTP Static IP Address Information element: underbuffer");
return NULL; return NULL;
} }

View File

@ -29,10 +29,10 @@ void capwap_lock_destroy_debug(capwap_lock_t* lock, const char* file, const int
if (!res) { if (!res) {
pthread_mutex_unlock(&lock->mutex); pthread_mutex_unlock(&lock->mutex);
} else if (res == EINVAL) { } else if (res == EINVAL) {
capwap_logging_debug("Attempt to destroy invalid mutex from '%s' (%d)", file, line); log_printf(LOG_DEBUG, "Attempt to destroy invalid mutex from '%s' (%d)", file, line);
capwap_backtrace_callstack(); capwap_backtrace_callstack();
} else if (res == EBUSY) { } else if (res == EBUSY) {
capwap_logging_debug("Attempt to destroy locked mutex by '%s' (%d) from '%s' (%d)", lock->file, lock->line, file, line); log_printf(LOG_DEBUG, "Attempt to destroy locked mutex by '%s' (%d) from '%s' (%d)", lock->file, lock->line, file, line);
capwap_backtrace_callstack(); capwap_backtrace_callstack();
} }
@ -57,7 +57,7 @@ void capwap_lock_enter_debug(capwap_lock_t* lock, const char* file, const int li
waittime = time(NULL) - starttime; waittime = time(NULL) - starttime;
if (!(waittime % 5) && (waittime > lasttime)) { if (!(waittime % 5) && (waittime > lasttime)) {
lasttime = waittime; lasttime = waittime;
capwap_logging_debug("Waited %d sec for mutex '%s' (%d) locked by '%s' (%d)", waittime, file, line, lock->file, lock->line); log_printf(LOG_DEBUG, "Waited %d sec for mutex '%s' (%d) locked by '%s' (%d)", waittime, file, line, lock->file, lock->line);
capwap_backtrace_callstack(); capwap_backtrace_callstack();
} }
@ -80,7 +80,7 @@ void capwap_lock_exit_debug(capwap_lock_t* lock, const char* file, const int lin
/* */ /* */
if (pthread_mutex_unlock(&lock->mutex)) { if (pthread_mutex_unlock(&lock->mutex)) {
capwap_logging_debug("Error releasing mutex '%s' (%d)", file, line); log_printf(LOG_DEBUG, "Error releasing mutex '%s' (%d)", file, line);
capwap_backtrace_callstack(); capwap_backtrace_callstack();
} }
} }

View File

@ -107,7 +107,7 @@ void capwap_logging_disable_console(void) {
/* */ /* */
#ifdef ENABLE_LOGGING #ifdef ENABLE_LOGGING
void capwap_logging_printf(int level, const char* format, ...) void __log_printf(int level, const char* format, ...)
{ {
int errsv = errno; int errsv = errno;
va_list args; va_list args;
@ -141,7 +141,7 @@ void capwap_logging_printf(int level, const char* format, ...)
errno = errsv; errno = errsv;
} }
void capwap_logging_hexdump(int level, const char *title, const unsigned char *data, size_t len) void __log_hexdump(int level, const char *title, const unsigned char *data, size_t len)
{ {
int errsv = errno; int errsv = errno;
char prefix[256]; char prefix[256];

View File

@ -20,32 +20,35 @@ void capwap_logging_disable_console(void);
/* */ /* */
#ifdef ENABLE_LOGGING #ifdef ENABLE_LOGGING
void log_printf(int level, const char *format, ...) void __log_printf(int level, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 2, 3)));
void log_hexdump(int level, const char *title, const unsigned char *data, size_t len); void __log_hexdump(int level, const char *title, const unsigned char *data, size_t len);
#ifdef DISABLE_LOGGING_DEBUG
#define log_printf(level, f, args...) \
do { \
if ((level) != LOG_DEBUG) \
__log_printf((level), (f), ##args); \
} while (0)
#define log_hexdump(level, title, data, len) \
do { \
if ((level) != LOG_DEBUG) \
__log_hexdump((level), (title), (data), (len)); \
} while (0)
#else
#define log_printf(level, f, args...) \
__log_printf((level), (f), ##args)
#define log_hexdump(level, title, data, len) \
__log_hexdump((level), (title), (data), (len))
#endif
#else #else
#define log_printf(l, f, args...) do { } while (0) #define log_printf(l, f, args...) do { } while (0)
#define log_hexdump(l, t, d, len) do { } while (0) #define log_hexdump(l, t, d, len) do { } while (0)
#endif #endif
#define capwap_logging_printf log_printf
#define capwap_logging_hexdump log_hexdump
/* */
#define capwap_logging_fatal(f, args...) \
log_printf(LOG_EMERG, f, ##args)
#define capwap_logging_error(f, args...) \
log_printf(LOG_ERR, f, ##args)
#define capwap_logging_warning(f, args...) \
log_printf(LOG_WARNING, f, ##args)
#define capwap_logging_info(f, args...) \
log_printf(LOG_INFO, f, ##args)
#ifdef DISABLE_LOGGING_DEBUG
#define capwap_logging_debug(f, args...)
#else
#define capwap_logging_debug(f, args...) \
log_printf(LOG_DEBUG, f, ##args)
#endif
#endif /* __CAPWAP_LOGGING_HEADER__ */ #endif /* __CAPWAP_LOGGING_HEADER__ */

View File

@ -24,13 +24,13 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi
#ifdef IP_PKTINFO #ifdef IP_PKTINFO
flag = 1; flag = 1;
if (setsockopt(sock, SOL_IP, IP_PKTINFO, &flag, sizeof(int))) { if (setsockopt(sock, SOL_IP, IP_PKTINFO, &flag, sizeof(int))) {
capwap_logging_error("Unable set IP_PKTINFO to socket '%d'", errno); log_printf(LOG_ERR, "Unable set IP_PKTINFO to socket '%d'", errno);
return -1; return -1;
} }
#elif defined IP_RECVDSTADDR #elif defined IP_RECVDSTADDR
flag = 1; flag = 1;
if (setsockopt(sock, IPPROTO_IP, IP_RECVDSTADDR, &flag, sizeof(int))) { if (setsockopt(sock, IPPROTO_IP, IP_RECVDSTADDR, &flag, sizeof(int))) {
capwap_logging_error("Unable set IP_RECVDSTADDR to socket '%d'", errno); log_printf(LOG_ERR, "Unable set IP_RECVDSTADDR to socket '%d'", errno);
return -1; return -1;
} }
#else #else
@ -39,7 +39,7 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi
} else if (socketfamily == AF_INET6) { } else if (socketfamily == AF_INET6) {
flag = 1; flag = 1;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &flag, sizeof(int))) { if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &flag, sizeof(int))) {
capwap_logging_error("Unable set IPV6_RECVPKTINFO to socket '%d'", errno); log_printf(LOG_ERR, "Unable set IPV6_RECVPKTINFO to socket '%d'", errno);
return -1; return -1;
} }
} }
@ -47,21 +47,21 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi
/* Reuse address */ /* Reuse address */
flag = 1; flag = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(int))) { if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(int))) {
capwap_logging_error("Unable set SO_REUSEADDR to socket"); log_printf(LOG_ERR, "Unable set SO_REUSEADDR to socket");
return -1; return -1;
} }
/* Broadcast */ /* Broadcast */
flag = 1; flag = 1;
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &flag, sizeof(int))) { if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &flag, sizeof(int))) {
capwap_logging_error("Unable set SO_BROADCAST to socket"); log_printf(LOG_ERR, "Unable set SO_BROADCAST to socket");
return -1; return -1;
} }
/* Bind to interface */ /* Bind to interface */
if ((bindinterface != NULL) && (bindinterface[0] != 0)) { if ((bindinterface != NULL) && (bindinterface[0] != 0)) {
if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, bindinterface, strlen(bindinterface) + 1)) { if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, bindinterface, strlen(bindinterface) + 1)) {
capwap_logging_error("Unable set SO_BINDTODEVICE to socket %d", errno); log_printf(LOG_ERR, "Unable set SO_BINDTODEVICE to socket %d", errno);
return -1; return -1;
} }
} }
@ -70,7 +70,7 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi
if (socketfamily == AF_INET) { if (socketfamily == AF_INET) {
flag = 1; flag = 1;
if (setsockopt(sock, SOL_SOCKET, SO_NO_CHECK, &flag, sizeof(int))) { if (setsockopt(sock, SOL_SOCKET, SO_NO_CHECK, &flag, sizeof(int))) {
capwap_logging_error("Unable set SO_NO_CHECK to socket"); log_printf(LOG_ERR, "Unable set SO_NO_CHECK to socket");
return -1; return -1;
} }
} }
@ -269,14 +269,14 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len,
if (r < 0) { if (r < 0) {
if (errno != EAGAIN) if (errno != EAGAIN)
capwap_logging_warning("Unable to recv packet, recvmsg return %zd with error %d", r, errno); log_printf(LOG_WARNING, "Unable to recv packet, recvmsg return %zd with error %d", r, errno);
return r; return r;
} }
/* Check if IPv4 is mapped into IPv6 */ /* Check if IPv4 is mapped into IPv6 */
if (fromaddr->ss.ss_family == AF_INET6) { if (fromaddr->ss.ss_family == AF_INET6) {
if (!capwap_ipv4_mapped_ipv6(fromaddr)) { if (!capwap_ipv4_mapped_ipv6(fromaddr)) {
capwap_logging_warning("Receive packet with invalid fromaddr"); log_printf(LOG_WARNING, "Receive packet with invalid fromaddr");
return -1; return -1;
} }
} }
@ -306,7 +306,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len,
/* Check if IPv4 is mapped into IPv6 */ /* Check if IPv4 is mapped into IPv6 */
if (fromaddr->ss.ss_family == AF_INET) { if (fromaddr->ss.ss_family == AF_INET) {
if (!capwap_ipv4_mapped_ipv6(toaddr)) { if (!capwap_ipv4_mapped_ipv6(toaddr)) {
capwap_logging_warning("Receive packet with invalid toaddr"); log_printf(LOG_WARNING, "Receive packet with invalid toaddr");
return -1; return -1;
} }
} }
@ -320,7 +320,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len,
{ {
char strfromaddr[INET6_ADDRSTRLEN]; char strfromaddr[INET6_ADDRSTRLEN];
char strtoaddr[INET6_ADDRSTRLEN]; char strtoaddr[INET6_ADDRSTRLEN];
capwap_logging_debug("Receive packet from %s:%d to %s with size %zd", log_printf(LOG_DEBUG, "Receive packet from %s:%d to %s with size %zd",
capwap_address_to_string(fromaddr, strfromaddr, INET6_ADDRSTRLEN), capwap_address_to_string(fromaddr, strfromaddr, INET6_ADDRSTRLEN),
(int)CAPWAP_GET_NETWORK_PORT(fromaddr), (int)CAPWAP_GET_NETWORK_PORT(fromaddr),
capwap_address_to_string(toaddr, strtoaddr, INET6_ADDRSTRLEN), r); capwap_address_to_string(toaddr, strtoaddr, INET6_ADDRSTRLEN), r);
@ -373,10 +373,10 @@ int capwap_sendto(int sock, void* buffer, int size, union sockaddr_capwap* toadd
do { do {
result = sendto(sock, buffer, size, 0, &toaddr->sa, sizeof(union sockaddr_capwap)); result = sendto(sock, buffer, size, 0, &toaddr->sa, sizeof(union sockaddr_capwap));
if ((result < 0) && (errno != EAGAIN) && (errno != EINTR)) { if ((result < 0) && (errno != EAGAIN) && (errno != EINTR)) {
capwap_logging_warning("Unable to send packet, sendto return %d with error %d", result, errno); log_printf(LOG_WARNING, "Unable to send packet, sendto return %d with error %d", result, errno);
return -errno; return -errno;
} else if ((result > 0) && (result != size)) { } else if ((result > 0) && (result != size)) {
capwap_logging_warning("Unable to send packet, mismatch sendto size %d - %d", size, result); log_printf(LOG_WARNING, "Unable to send packet, mismatch sendto size %d - %d", size, result);
return -ENETRESET; return -ENETRESET;
} }
} while (result < 0); } while (result < 0);
@ -384,7 +384,7 @@ int capwap_sendto(int sock, void* buffer, int size, union sockaddr_capwap* toadd
#ifdef DEBUG #ifdef DEBUG
{ {
char strtoaddr[INET6_ADDRSTRLEN]; char strtoaddr[INET6_ADDRSTRLEN];
capwap_logging_debug("Sent packet to %s:%d with result %d", capwap_address_to_string(toaddr, strtoaddr, INET6_ADDRSTRLEN), (int)CAPWAP_GET_NETWORK_PORT(toaddr), result); log_printf(LOG_DEBUG, "Sent packet to %s:%d with result %d", capwap_address_to_string(toaddr, strtoaddr, INET6_ADDRSTRLEN), (int)CAPWAP_GET_NETWORK_PORT(toaddr), result);
} }
#endif #endif
@ -408,7 +408,7 @@ int capwap_sendto_fragmentpacket(int sock, struct capwap_list* fragmentlist, uni
err = capwap_sendto(sock, fragmentpacket->buffer, fragmentpacket->offset, toaddr); err = capwap_sendto(sock, fragmentpacket->buffer, fragmentpacket->offset, toaddr);
if (err <= 0) { if (err <= 0) {
capwap_logging_warning("Unable to send fragment, sentto return error %d", err); log_printf(LOG_WARNING, "Unable to send fragment, sentto return error %d", err);
return 0; return 0;
} }

View File

@ -459,7 +459,7 @@ struct capwap_packet_txmng* capwap_packet_txmng_create_ctrl_message(struct capwa
/* Check MTU */ /* Check MTU */
if ((mtu > 0) && (mtu < (length + sizeof(struct capwap_control_message)))) { if ((mtu > 0) && (mtu < (length + sizeof(struct capwap_control_message)))) {
capwap_logging_debug("The mtu is too small: %hu", mtu); log_printf(LOG_DEBUG, "The mtu is too small: %hu", mtu);
return NULL; return NULL;
} }
@ -618,7 +618,7 @@ static int capwap_fragment_read_block_from_pos(uint8_t* data, unsigned short len
if (!readpos->item) { if (!readpos->item) {
readpos->pos = 0; readpos->pos = 0;
if (readdataleft) { if (readdataleft) {
capwap_logging_debug("Complete to read capwap packet but remain %hu byte to read", readdataleft); log_printf(LOG_DEBUG, "Complete to read capwap packet but remain %hu byte to read", readdataleft);
} }
} else { } else {
struct capwap_header* header; struct capwap_header* header;
@ -759,7 +759,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
/* Size of payload is multiple of 64bits */ /* Size of payload is multiple of 64bits */
if (((length - headersize) % 8) != 0) { if (((length - headersize) % 8) != 0) {
capwap_logging_debug("Body capwap packet is not multiple of 64bit"); log_printf(LOG_DEBUG, "Body capwap packet is not multiple of 64bit");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} }
@ -770,7 +770,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
headersearch = (struct capwap_header*)packetsearch->buffer; headersearch = (struct capwap_header*)packetsearch->buffer;
if (fragid != GET_FRAGMENT_ID_HEADER(headersearch)) { if (fragid != GET_FRAGMENT_ID_HEADER(headersearch)) {
capwap_logging_debug("Sent fragment packets with different fragment id"); log_printf(LOG_DEBUG, "Sent fragment packets with different fragment id");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} }
} }
@ -794,12 +794,12 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
} else { } else {
/* Check duplicate packet */ /* Check duplicate packet */
if (packetsearch->size != length) { if (packetsearch->size != length) {
capwap_logging_debug("Duplicate fragment offset with different size"); log_printf(LOG_DEBUG, "Duplicate fragment offset with different size");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} }
if (memcmp(packetsearch->buffer, data, packetsearch->size)) { if (memcmp(packetsearch->buffer, data, packetsearch->size)) {
capwap_logging_debug("Duplicate fragment offset with different packet"); log_printf(LOG_DEBUG, "Duplicate fragment offset with different packet");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} }
@ -831,7 +831,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
return CAPWAP_REQUEST_MORE_FRAGMENT; return CAPWAP_REQUEST_MORE_FRAGMENT;
} else if (sanityfragoffset > fragoffsetsearch) { } else if (sanityfragoffset > fragoffsetsearch) {
capwap_list_flush(rxmngpacket->fragmentlist); capwap_list_flush(rxmngpacket->fragmentlist);
capwap_logging_debug("Wrong fragment offset"); log_printf(LOG_DEBUG, "Wrong fragment offset");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} }
@ -853,7 +853,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
/* Check if already received fragment packets */ /* Check if already received fragment packets */
if (rxmngpacket->fragmentlist->count > 0) { if (rxmngpacket->fragmentlist->count > 0) {
/* Overlap fragment packet with complete packet */ /* Overlap fragment packet with complete packet */
capwap_logging_debug("Overlap fragment packet with complete packet"); log_printf(LOG_DEBUG, "Overlap fragment packet with complete packet");
return CAPWAP_WRONG_FRAGMENT; return CAPWAP_WRONG_FRAGMENT;
} else { } else {
struct capwap_header* header; struct capwap_header* header;

View File

@ -99,27 +99,27 @@ void* capwap_socket_crypto_createcontext(char* calist, char* cert, char* private
if (context) { if (context) {
/* Public certificate */ /* Public certificate */
if (!wolfSSL_CTX_use_certificate_file(context, cert, SSL_FILETYPE_PEM)) { if (!wolfSSL_CTX_use_certificate_file(context, cert, SSL_FILETYPE_PEM)) {
capwap_logging_debug("Error to load certificate file"); log_printf(LOG_DEBUG, "Error to load certificate file");
capwap_socket_crypto_freecontext(context); capwap_socket_crypto_freecontext(context);
return NULL; return NULL;
} }
/* Private key */ /* Private key */
if (!wolfSSL_CTX_use_PrivateKey_file(context, privatekey, SSL_FILETYPE_PEM)) { if (!wolfSSL_CTX_use_PrivateKey_file(context, privatekey, SSL_FILETYPE_PEM)) {
capwap_logging_debug("Error to load private key file"); log_printf(LOG_DEBUG, "Error to load private key file");
capwap_socket_crypto_freecontext(context); capwap_socket_crypto_freecontext(context);
return NULL; return NULL;
} }
if (!wolfSSL_CTX_check_private_key(context)) { if (!wolfSSL_CTX_check_private_key(context)) {
capwap_logging_debug("Error to check private key"); log_printf(LOG_DEBUG, "Error to check private key");
capwap_socket_crypto_freecontext(context); capwap_socket_crypto_freecontext(context);
return NULL; return NULL;
} }
/* Certificate Authority */ /* Certificate Authority */
if (!wolfSSL_CTX_load_verify_locations(context, calist, NULL)) { if (!wolfSSL_CTX_load_verify_locations(context, calist, NULL)) {
capwap_logging_debug("Error to load ca file"); log_printf(LOG_DEBUG, "Error to load ca file");
capwap_socket_crypto_freecontext(context); capwap_socket_crypto_freecontext(context);
return NULL; return NULL;
} }
@ -129,7 +129,7 @@ void* capwap_socket_crypto_createcontext(char* calist, char* cert, char* private
/* Set only high security cipher list */ /* Set only high security cipher list */
if (!wolfSSL_CTX_set_cipher_list(context, "AES256-SHA")) { if (!wolfSSL_CTX_set_cipher_list(context, "AES256-SHA")) {
capwap_logging_debug("Error to select cipher list"); log_printf(LOG_DEBUG, "Error to select cipher list");
capwap_socket_crypto_freecontext(context); capwap_socket_crypto_freecontext(context);
return NULL; return NULL;
} }

View File

@ -135,7 +135,7 @@ unsigned long capwap_timeout_createtimer(struct capwap_timeout* timeout) {
index = capwap_timeout_set_bitfield(timeout); index = capwap_timeout_set_bitfield(timeout);
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Create new timer: %lu", index); log_printf(LOG_DEBUG, "Create new timer: %lu", index);
#endif #endif
return index; return index;
@ -147,7 +147,7 @@ void capwap_timeout_deletetimer(struct capwap_timeout* timeout, unsigned long in
if (index != CAPWAP_TIMEOUT_INDEX_NO_SET) { if (index != CAPWAP_TIMEOUT_INDEX_NO_SET) {
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Delete timer: %lu", index); log_printf(LOG_DEBUG, "Delete timer: %lu", index);
#endif #endif
/* Unset timeout timer */ /* Unset timeout timer */
@ -187,7 +187,7 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i
item->param = param; item->param = param;
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Update timeout: %lu %ld", item->index, item->durate); log_printf(LOG_DEBUG, "Update timeout: %lu %ld", item->index, item->durate);
#endif #endif
/* Add itemlist into order list */ /* Add itemlist into order list */
@ -209,7 +209,7 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i
item->param = param; item->param = param;
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Set timeout: %lu %ld", item->index, item->durate); log_printf(LOG_DEBUG, "Set timeout: %lu %ld", item->index, item->durate);
#endif #endif
/* Add itemlist into hash for rapid searching */ /* Add itemlist into hash for rapid searching */
@ -231,7 +231,7 @@ void capwap_timeout_unset(struct capwap_timeout* timeout, unsigned long index) {
itemlist = (struct capwap_list_item*)capwap_hash_search(timeout->itemsreference, &index); itemlist = (struct capwap_list_item*)capwap_hash_search(timeout->itemsreference, &index);
if (itemlist) { if (itemlist) {
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Unset timeout: %lu", index); log_printf(LOG_DEBUG, "Unset timeout: %lu", index);
#endif #endif
/* */ /* */
@ -307,7 +307,7 @@ unsigned long capwap_timeout_hasexpired(struct capwap_timeout* timeout) {
item = (struct capwap_timeout_item*)itemlist->item; item = (struct capwap_timeout_item*)itemlist->item;
#ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG
capwap_logging_debug("Expired timeout: %lu", item->index); log_printf(LOG_DEBUG, "Expired timeout: %lu", item->index);
#endif #endif
/* Cache callback before release timeout timer */ /* Cache callback before release timeout timer */

Some files were not shown because too many files have changed in this diff Show More