From 29ed6544c5fd81c71c91a86a90e193ffa490dc59 Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Wed, 30 Mar 2016 14:47:57 +0200 Subject: [PATCH] switch everything to new log API and drop old one --- src/ac/ac.c | 74 +++++----- src/ac/ac_backend.c | 26 ++-- src/ac/ac_dfa_configure.c | 2 +- src/ac/ac_dfa_datacheck.c | 2 +- src/ac/ac_dfa_join.c | 6 +- src/ac/ac_dfa_reset.c | 2 +- src/ac/ac_dfa_run.c | 14 +- src/ac/ac_discovery.c | 10 +- src/ac/ac_execute.c | 18 +-- src/ac/ac_ieee80211_data.c | 26 ++-- src/ac/ac_kmod.c | 32 ++-- src/ac/ac_session.c | 52 +++---- src/ac/ac_wlans.c | 10 +- src/common/capwap.h | 2 +- src/common/capwap_debug.c | 22 +-- src/common/capwap_debug.h | 2 +- src/common/capwap_dtls.c | 38 ++--- src/common/capwap_element.c | 12 +- src/common/capwap_element_80211_addwlan.c | 8 +- src/common/capwap_element_80211_antenna.c | 8 +- src/common/capwap_element_80211_assignbssid.c | 2 +- src/common/capwap_element_80211_deletewlan.c | 2 +- ...pwap_element_80211_directsequencecontrol.c | 4 +- src/common/capwap_element_80211_ie.c | 2 +- .../capwap_element_80211_macoperation.c | 2 +- .../capwap_element_80211_miccountermeasures.c | 2 +- ...pwap_element_80211_multidomaincapability.c | 2 +- src/common/capwap_element_80211_ofdmcontrol.c | 2 +- src/common/capwap_element_80211_rateset.c | 4 +- .../capwap_element_80211_rsnaerrorreport.c | 2 +- src/common/capwap_element_80211_station.c | 4 +- src/common/capwap_element_80211_stationkey.c | 2 +- src/common/capwap_element_80211_stationqos.c | 2 +- src/common/capwap_element_80211_statistics.c | 2 +- .../capwap_element_80211_supportedrates.c | 4 +- src/common/capwap_element_80211_txpower.c | 2 +- .../capwap_element_80211_txpowerlevel.c | 6 +- .../capwap_element_80211_updatestationqos.c | 2 +- src/common/capwap_element_80211_updatewlan.c | 4 +- src/common/capwap_element_80211_wtpqos.c | 2 +- .../capwap_element_80211_wtpradioconf.c | 2 +- .../capwap_element_80211_wtpradiofailalarm.c | 2 +- ...capwap_element_80211_wtpradioinformation.c | 2 +- src/common/capwap_element_80211n_radioconf.c | 2 +- ...apwap_element_80211n_station_information.c | 2 +- src/common/capwap_element_acdescriptor.c | 16 +- src/common/capwap_element_acipv4list.c | 2 +- src/common/capwap_element_acipv6list.c | 2 +- src/common/capwap_element_acname.c | 2 +- src/common/capwap_element_acnamepriority.c | 2 +- src/common/capwap_element_actimestamp.c | 2 +- src/common/capwap_element_addmacacl.c | 8 +- src/common/capwap_element_addstation.c | 8 +- src/common/capwap_element_controlipv4.c | 2 +- src/common/capwap_element_controlipv6.c | 2 +- src/common/capwap_element_datatransferdata.c | 8 +- src/common/capwap_element_datatransfermode.c | 4 +- .../capwap_element_decrypterrorreport.c | 10 +- .../capwap_element_decrypterrorreportperiod.c | 4 +- src/common/capwap_element_deletemacacl.c | 8 +- src/common/capwap_element_deletestation.c | 6 +- src/common/capwap_element_discoverytype.c | 4 +- src/common/capwap_element_duplicateipv4.c | 6 +- src/common/capwap_element_duplicateipv6.c | 6 +- src/common/capwap_element_ecnsupport.c | 4 +- src/common/capwap_element_idletimeout.c | 2 +- src/common/capwap_element_imagedata.c | 8 +- src/common/capwap_element_imageidentifier.c | 4 +- src/common/capwap_element_imageinfo.c | 2 +- src/common/capwap_element_initdownload.c | 2 +- src/common/capwap_element_localipv4.c | 2 +- src/common/capwap_element_localipv6.c | 2 +- src/common/capwap_element_location.c | 2 +- src/common/capwap_element_maximumlength.c | 2 +- src/common/capwap_element_mtudiscovery.c | 2 +- src/common/capwap_element_radioadmstate.c | 6 +- src/common/capwap_element_radiooprstate.c | 8 +- src/common/capwap_element_resultcode.c | 4 +- src/common/capwap_element_returnedmessage.c | 8 +- src/common/capwap_element_sessionid.c | 2 +- src/common/capwap_element_statisticstimer.c | 2 +- src/common/capwap_element_timers.c | 2 +- src/common/capwap_element_transport.c | 4 +- src/common/capwap_element_vendorpayload.c | 4 +- src/common/capwap_element_wtpboarddata.c | 8 +- src/common/capwap_element_wtpdescriptor.c | 16 +- src/common/capwap_element_wtpfallback.c | 4 +- .../capwap_element_wtpframetunnelmode.c | 4 +- src/common/capwap_element_wtpmactype.c | 4 +- src/common/capwap_element_wtpname.c | 2 +- src/common/capwap_element_wtpradiostat.c | 4 +- src/common/capwap_element_wtprebootstat.c | 2 +- .../capwap_element_wtpstaticipaddress.c | 2 +- src/common/capwap_lock.c | 8 +- src/common/capwap_logging.c | 4 +- src/common/capwap_logging.h | 47 +++--- src/common/capwap_network.c | 30 ++-- src/common/capwap_protocol.c | 16 +- src/common/capwap_socket.c | 10 +- src/common/capwap_timeout.c | 12 +- src/wtp/binding/ieee80211/wifi_drivers.c | 92 ++++++------ src/wtp/binding/ieee80211/wifi_nl80211.c | 60 ++++---- src/wtp/wtp.c | 138 +++++++++--------- src/wtp/wtp_dfa.c | 48 +++--- src/wtp/wtp_dfa_configure.c | 12 +- src/wtp/wtp_dfa_datacheck.c | 10 +- src/wtp/wtp_dfa_discovery.c | 20 +-- src/wtp/wtp_dfa_dtls.c | 6 +- src/wtp/wtp_dfa_idle.c | 10 +- src/wtp/wtp_dfa_join.c | 16 +- src/wtp/wtp_dfa_run.c | 36 ++--- src/wtp/wtp_kmod.c | 6 +- src/wtp/wtp_radio.c | 48 +++--- 113 files changed, 641 insertions(+), 638 deletions(-) diff --git a/src/ac/ac.c b/src/ac/ac.c index 35afa40..b1403da 100644 --- a/src/ac/ac.c +++ b/src/ac/ac.c @@ -229,7 +229,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "debug")) { capwap_logging_verboselevel(LOG_DEBUG); } else { - capwap_logging_error("Invalid configuration file, unknown logging.level value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown logging.level value"); return 0; } } @@ -251,7 +251,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "stderr")) { capwap_logging_enable_console(1); } else { - capwap_logging_error("Invalid configuration file, unknown logging.output value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown logging.output value"); return 0; } } @@ -268,7 +268,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { /* Set name of AC */ if (config_lookup_string(config, "application.name", &configString) == CONFIG_TRUE) { if (strlen(configString) > CAPWAP_ACNAME_MAXLENGTH) { - capwap_logging_error("Invalid configuration file, application.name string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.name string length exceeded"); return 0; } @@ -291,7 +291,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(bindingName, "EPCGlobal")) { *binding = CAPWAP_WIRELESS_BINDING_EPCGLOBAL; } else { - capwap_logging_error("Invalid configuration file, unknown application.binding value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.binding value"); return 0; } } @@ -303,7 +303,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_ac.descriptor.stationlimit = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, unknown application.descriptor.maxstations value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.maxstations value"); return 0; } } @@ -313,7 +313,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_ac.descriptor.maxwtp = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, unknown application.descriptor.maxwtp value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.maxwtp value"); return 0; } } @@ -379,7 +379,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configType, "software")) { type = CAPWAP_ACDESC_SUBELEMENT_SOFTWAREVERSION; } else { - capwap_logging_error("Invalid configuration file, unknown application.descriptor.info.type value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.descriptor.info.type value"); return 0; } @@ -392,19 +392,19 @@ static int ac_parsing_configuration_1_0(config_t* config) { strcpy((char*)desc->data, configValue); desc->data[desc->length] = 0; } else { - capwap_logging_error("Invalid configuration file, application.descriptor.info.value string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.descriptor.info.value string length exceeded"); return 0; } } else { - capwap_logging_error("Invalid configuration file, element application.descriptor.info.value not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.value not found"); return 0; } } else { - capwap_logging_error("Invalid configuration file, element application.descriptor.info.type not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.type not found"); return 0; } } else { - capwap_logging_error("Invalid configuration file, element application.descriptor.info.idvendor not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.descriptor.info.idvendor not found"); return 0; } } @@ -418,7 +418,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "limited")) { g_ac.dfa.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT; } else { - capwap_logging_error("Invalid configuration file, unknown application.ecn value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.ecn value"); return 0; } } @@ -429,7 +429,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt >= AC_MIN_DISCOVERY_INTERVAL) && (configInt <= AC_MAX_DISCOVERY_INTERVAL)) { g_ac.dfa.timers.discovery = (unsigned char)(configInt / 1000); } else { - capwap_logging_error("Invalid configuration file, invalid application.timer.discovery value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.discovery value"); return 0; } } @@ -439,7 +439,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt >= AC_MIN_ECHO_INTERVAL) && (configInt <= AC_MAX_ECHO_INTERVAL)) { g_ac.dfa.timers.echorequest = (unsigned char)(configInt / 1000); } else { - capwap_logging_error("Invalid configuration file, invalid application.timer.echorequest value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.echorequest value"); return 0; } } @@ -448,7 +448,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_ac.dfa.decrypterrorreport_interval = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, invalid application.timer.decrypterrorreport value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.decrypterrorreport value"); return 0; } } @@ -457,7 +457,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if (configInt > 0) { g_ac.dfa.idletimeout.timeout = (unsigned long)configInt; } else { - capwap_logging_error("Invalid configuration file, invalid application.timer.idletimeout value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.idletimeout value"); return 0; } } @@ -483,7 +483,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "presharedkey")) { dtlsparam.mode = CAPWAP_DTLS_MODE_PRESHAREDKEY; } else { - capwap_logging_error("Invalid configuration file, unknown application.dtls.type value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.dtls.type value"); return 0; } } @@ -576,7 +576,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { /* Set interface binding of AC */ if (config_lookup_string(config, "application.network.binding", &configString) == CONFIG_TRUE) { if (strlen(configString) > (IFNAMSIZ - 1)) { - capwap_logging_error("Invalid configuration file, application.network.binding string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.network.binding string length exceeded"); return 0; } @@ -588,7 +588,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_ac.mtu = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, invalid application.network.mtu value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.network.mtu value"); return 0; } } @@ -600,7 +600,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "udplite")) { g_ac.dfa.transport.type = CAPWAP_UDPLITE_TRANSPORT; } else { - capwap_logging_error("Invalid configuration file, unknown application.network.transport value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.network.transport value"); return 0; } } @@ -633,7 +633,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { /* */ server = ac_soapclient_create_server(configString); if (!server) { - capwap_logging_error("Invalid configuration file, invalid backend.server value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server value"); return 0; } @@ -647,7 +647,7 @@ static int ac_parsing_configuration_1_0(config_t* config) { /* */ configSSL = config_setting_get_member(configServer, "x509"); if (!configSSL) { - capwap_logging_error("Invalid configuration file, invalid backend.server.x509 value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server.x509 value"); return 0; } @@ -673,11 +673,11 @@ static int ac_parsing_configuration_1_0(config_t* config) { if (calist && certificate && privatekey) { server->sslcontext = capwap_socket_crypto_createcontext(calist, certificate, privatekey); if (!server->sslcontext) { - capwap_logging_error("Invalid configuration file, unable to initialize crypto library"); + log_printf(LOG_ERR, "Invalid configuration file, unable to initialize crypto library"); return 0; } } else { - capwap_logging_error("Invalid configuration file, invalid backend.server.x509 value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid backend.server.x509 value"); return 0; } @@ -707,9 +707,9 @@ static int ac_parsing_configuration(config_t* config) { return ac_parsing_configuration_1_0(config); } - capwap_logging_error("Invalid configuration file, '%s' is not supported", configString); + log_printf(LOG_ERR, "Invalid configuration file, '%s' is not supported", configString); } else { - capwap_logging_error("Invalid configuration file, unable to found version tag"); + log_printf(LOG_ERR, "Invalid configuration file, unable to found version tag"); } return 0; @@ -738,7 +738,7 @@ static int ac_load_configuration(int argc, char** argv) { if (strlen(optarg) < sizeof(g_configurationfile)) { strcpy(g_configurationfile, optarg); } else { - capwap_logging_error("Invalid -%c argument", optopt); + log_printf(LOG_ERR, "Invalid -%c argument", optopt); return -1; } @@ -747,9 +747,9 @@ static int ac_load_configuration(int argc, char** argv) { case '?': { if (optopt == 'c') { - capwap_logging_error("Option -%c requires an argument", optopt); + log_printf(LOG_ERR, "Option -%c requires an argument", optopt); } else { - capwap_logging_error("Unknown option character `\\x%x'", optopt); + log_printf(LOG_ERR, "Unknown option character `\\x%x'", optopt); } ac_print_usage(); @@ -766,7 +766,7 @@ static int ac_load_configuration(int argc, char** argv) { result = ac_parsing_configuration(&config); } else { result = -1; - capwap_logging_error("Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config)); + log_printf(LOG_ERR, "Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config)); } /* Free libconfig */ @@ -778,7 +778,7 @@ static int ac_load_configuration(int argc, char** argv) { static int ac_configure(void) { /* Bind control channel to any address */ if (capwap_bind_sockets(&g_ac.net)) { - capwap_logging_fatal("Cannot bind address"); + log_printf(LOG_EMERG, "Cannot bind address"); return AC_ERROR_NETWORK; } @@ -821,7 +821,7 @@ int main(int argc, char** argv) { /* Init capwap */ if (geteuid() != 0) { - capwap_logging_fatal("Request root privileges"); + log_printf(LOG_EMERG, "Request root privileges"); return CAPWAP_REQUEST_ROOT; } @@ -830,7 +830,7 @@ int main(int argc, char** argv) { /* Init crypt */ if (capwap_crypt_init()) { - capwap_logging_fatal("Error to init crypt engine"); + log_printf(LOG_EMERG, "Error to init crypt engine"); return CAPWAP_CRYPT_ERROR; } @@ -852,7 +852,7 @@ int main(int argc, char** argv) { /* Console logging is disabled in daemon mode */ capwap_logging_disable_console(); - capwap_logging_info("Running AC in daemon mode"); + log_printf(LOG_INFO, "Running AC in daemon mode"); } /* Complete configuration AC */ @@ -862,18 +862,18 @@ int main(int argc, char** argv) { if (!ac_kmod_init()) { /* Bind data channel */ if (!ac_kmod_createdatachannel(g_ac.net.localaddr.ss.ss_family, CAPWAP_GET_NETWORK_PORT(&g_ac.net.localaddr) + 1)) { - capwap_logging_info("SmartCAPWAP kernel module connected"); + log_printf(LOG_INFO, "SmartCAPWAP kernel module connected"); /* Running AC */ result = ac_execute(); } else { - capwap_logging_fatal("Unable to create kernel data channel"); + log_printf(LOG_EMERG, "Unable to create kernel data channel"); } /* Disconnect kernel module */ ac_kmod_free(); } else { - capwap_logging_fatal("Unable to connect to kernel module"); + log_printf(LOG_EMERG, "Unable to connect to kernel module"); } /* Close connection */ diff --git a/src/ac/ac_backend.c b/src/ac/ac_backend.c index 2ee0bc5..eaa553a 100644 --- a/src/ac/ac_backend.c +++ b/src/ac/ac_backend.c @@ -66,7 +66,7 @@ static int ac_backend_parsing_closewtpsession_event(const char* idevent, struct ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t)); /* Async close session */ - capwap_logging_debug("Receive close wtp session for WTP %s", session->wtpid); + log_printf(LOG_DEBUG, "Receive close wtp session for WTP %s", session->wtpid); ac_session_send_action(session, AC_SESSION_ACTION_CLOSE, 0, NULL, 0); /* */ @@ -138,7 +138,7 @@ static int ac_backend_parsing_resetwtp_event(const char* idevent, struct json_ob ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t)); /* Notify Action */ - capwap_logging_debug("Receive reset request for WTP %s", session->wtpid); + log_printf(LOG_DEBUG, "Receive reset request for WTP %s", session->wtpid); ac_session_send_action(session, AC_SESSION_ACTION_RESET_WTP, 0, (void*)reset, length); result = 0; @@ -289,7 +289,7 @@ static int ac_backend_parsing_addwlan_event(const char* idevent, struct json_obj ac_session_send_action(session, AC_SESSION_ACTION_NOTIFY_EVENT, 0, (void*)¬ify, sizeof(struct ac_session_notify_event_t)); /* Notify Action */ - capwap_logging_debug("Receive AddWLAN request for WTP %s with SSID: %s", session->wtpid, addwlan->ssid); + log_printf(LOG_DEBUG, "Receive AddWLAN request for WTP %s with SSID: %s", session->wtpid, addwlan->ssid); ac_session_send_action(session, AC_SESSION_ACTION_ADDWLAN, 0, (void*)addwlan, length); /* */ @@ -506,7 +506,7 @@ static int ac_backend_soap_join(int forcereset) { /* Retrieve AC configuration */ if (g_ac_backend.backendsessionid && forcereset) { if (ac_backend_soap_getconfiguration()) { - capwap_logging_error("Unable to get AC configuration from Backend Server"); + log_printf(LOG_ERR, "Unable to get AC configuration from Backend Server"); capwap_free(g_ac_backend.backendsessionid); g_ac_backend.backendsessionid = NULL; } @@ -725,7 +725,7 @@ static void ac_backend_run(void) { /* Connection error, change Backend Server */ connected = 0; - capwap_logging_debug("Lost connection with Backend Server"); + log_printf(LOG_DEBUG, "Lost connection with Backend Server"); capwap_lock_enter(&g_ac_backend.backendlock); /* Lost session id */ @@ -738,7 +738,7 @@ static void ac_backend_run(void) { } else { /* Join with a Backend Server */ if (!ac_backend_soap_join(forcereset)) { - capwap_logging_debug("Joined with Backend Server"); + log_printf(LOG_DEBUG, "Joined with Backend Server"); /* Join Complete */ connected = 1; @@ -753,7 +753,7 @@ static void ac_backend_run(void) { /* Wait timeout before continue */ if (g_ac_backend.errorjoinbackend >= g_ac.availablebackends->count) { - capwap_logging_debug("Unable to join with Backend Server"); + log_printf(LOG_DEBUG, "Unable to join with Backend Server"); /* */ forcereset = 1; @@ -792,9 +792,9 @@ static void ac_backend_run(void) { /* */ static void* ac_backend_thread(void* param) { - capwap_logging_debug("Backend start"); + log_printf(LOG_DEBUG, "Backend start"); ac_backend_run(); - capwap_logging_debug("Backend stop"); + log_printf(LOG_DEBUG, "Backend stop"); /* Thread exit */ pthread_exit(NULL); @@ -843,13 +843,13 @@ int ac_backend_start(void) { /* */ if (!g_ac.backendacid) { - capwap_logging_error("AC Backend ID isn't set"); + log_printf(LOG_ERR, "AC Backend ID isn't set"); return 0; } else if (!g_ac.backendversion) { - capwap_logging_error("Backend Protocol Version isn't set"); + log_printf(LOG_ERR, "Backend Protocol Version isn't set"); return 0; } else if (!g_ac.availablebackends->count) { - capwap_logging_error("List of available backends is empty"); + log_printf(LOG_ERR, "List of available backends is empty"); return 0; } @@ -861,7 +861,7 @@ int ac_backend_start(void) { /* Create thread */ result = pthread_create(&g_ac_backend.threadid, NULL, ac_backend_thread, NULL); if (result) { - capwap_logging_debug("Unable create backend thread"); + log_printf(LOG_DEBUG, "Unable create backend thread"); return 0; } diff --git a/src/ac/ac_dfa_configure.c b/src/ac/ac_dfa_configure.c index 47163bf..93dfc9b 100644 --- a/src/ac/ac_dfa_configure.c +++ b/src/ac/ac_dfa_configure.c @@ -759,7 +759,7 @@ void ac_dfa_state_configure(struct ac_session_t* session, struct capwap_parsed_p /* Send Configure response to WTP */ if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { /* Response is already created and saved. When receive a re-request, DFA autoresponse */ - capwap_logging_debug("Warning: error to send configuration status response packet"); + log_printf(LOG_DEBUG, "Warning: error to send configuration status response packet"); } /* Change state */ diff --git a/src/ac/ac_dfa_datacheck.c b/src/ac/ac_dfa_datacheck.c index 0d8a21b..8e40581 100644 --- a/src/ac/ac_dfa_datacheck.c +++ b/src/ac/ac_dfa_datacheck.c @@ -205,7 +205,7 @@ void ac_dfa_state_datacheck(struct ac_session_t* session, struct capwap_parsed_p /* Send Change event response to WTP */ if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { /* Response is already created and saved. When receive a re-request, DFA autoresponse */ - capwap_logging_debug("Warning: error to send change event response packet"); + log_printf(LOG_DEBUG, "Warning: error to send change event response packet"); } /* Change state */ diff --git a/src/ac/ac_dfa_join.c b/src/ac/ac_dfa_join.c index 40ed2c1..37928db 100644 --- a/src/ac/ac_dfa_join.c +++ b/src/ac/ac_dfa_join.c @@ -590,7 +590,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_UNKNOWN_SOURCE; } } else { - capwap_logging_info("WTP Id %s already used in another session", wtpid); + log_printf(LOG_INFO, "WTP Id %s already used in another session", wtpid); resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_UNKNOWN_SOURCE; } @@ -606,7 +606,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet char sessionname[33]; capwap_sessionid_printf(sessionid, sessionname); - capwap_logging_info("Session Id %s already used in another session", sessionname); + log_printf(LOG_INFO, "Session Id %s already used in another session", sessionname); resultcode.code = CAPWAP_RESULTCODE_JOIN_FAILURE_ID_ALREADY_IN_USE; } @@ -657,7 +657,7 @@ void ac_dfa_state_join(struct ac_session_t* session, struct capwap_parsed_packet } } else { /* Error to send packets */ - capwap_logging_debug("Warning: error to send join response packet"); + log_printf(LOG_DEBUG, "Warning: error to send join response packet"); ac_session_teardown(session); } } diff --git a/src/ac/ac_dfa_reset.c b/src/ac/ac_dfa_reset.c index 10aa8e3..56c24c6 100644 --- a/src/ac/ac_dfa_reset.c +++ b/src/ac/ac_dfa_reset.c @@ -20,7 +20,7 @@ void ac_dfa_state_reset(struct ac_session_t* session, struct capwap_parsed_packe /* Check the success of the Request */ resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_warning("Receive Reset Response with error: %d", (int)resultcode->code); + log_printf(LOG_WARNING, "Receive Reset Response with error: %d", (int)resultcode->code); } /* */ diff --git a/src/ac/ac_dfa_run.c b/src/ac/ac_dfa_run.c index ffbd63f..5fcbf93 100644 --- a/src/ac/ac_dfa_run.c +++ b/src/ac/ac_dfa_run.c @@ -58,14 +58,14 @@ static int receive_echo_request(struct ac_session_t* session, struct capwap_pars { char sessionname[33]; capwap_sessionid_printf(&session->sessionid, sessionname); - capwap_logging_debug("Send Echo Response to %s", sessionname); + log_printf(LOG_DEBUG, "Send Echo Response to %s", sessionname); } #endif /* Send Configure response to WTP */ if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { /* Response is already created and saved. When receive a re-request, DFA autoresponse */ - capwap_logging_debug("Warning: error to send echo response packet"); + log_printf(LOG_DEBUG, "Warning: error to send echo response packet"); } return 0; @@ -88,7 +88,7 @@ static void execute_ieee80211_wlan_configuration_addwlan(struct ac_session_t* se /* Assign BSSID to session */ if (ac_wlans_assign_bssid(session, wlan)) { - capwap_logging_warning("Unable to add new wlan with radioid: %d, wlanid: %d", (int)assignbssid->radioid, (int)assignbssid->wlanid); + log_printf(LOG_WARNING, "Unable to add new wlan with radioid: %d, wlanid: %d", (int)assignbssid->radioid, (int)assignbssid->wlanid); ac_wlans_free_bssid(wlan); /* TODO: add remove wlan from wtp */ @@ -142,7 +142,7 @@ static void receive_ieee80211_wlan_configuration_response(struct ac_session_t* s capwap_packet_rxmng_free(rxmngrequestpacket); } } else { - capwap_logging_warning("Receive IEEE802.11 WLAN Configuration Response with error: %d", (int)resultcode->code); + log_printf(LOG_WARNING, "Receive IEEE802.11 WLAN Configuration Response with error: %d", (int)resultcode->code); } /* */ @@ -170,7 +170,7 @@ static void execute_ieee80211_station_configuration_response_addstation(struct a station = ac_stations_get_station(session, station80211->radioid, wlan->address, addstation->address); if (station) { if (CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_info("Authorized station: %s", station->addrtext); + log_printf(LOG_INFO, "Authorized station: %s", station->addrtext); /* */ station->flags |= AC_STATION_FLAGS_AUTHORIZED; @@ -198,7 +198,7 @@ static void execute_ieee80211_station_configuration_response_deletestation(struc /* */ station = ac_stations_get_station(session, deletestation->radioid, NULL, deletestation->address); if (station) { - capwap_logging_info("Deauthorized station: %s with %d result code", station->addrtext, (int)resultcode->code); + log_printf(LOG_INFO, "Deauthorized station: %s with %d result code", station->addrtext, (int)resultcode->code); /* */ ac_stations_delete_station(session, station); @@ -258,7 +258,7 @@ void ac_dfa_state_run(struct ac_session_t* session, struct capwap_parsed_packet* { char sessionname[33]; capwap_sessionid_printf(&session->sessionid, sessionname); - capwap_logging_debug("Receive Echo Request from %s", sessionname); + log_printf(LOG_DEBUG, "Receive Echo Request from %s", sessionname); } #endif diff --git a/src/ac/ac_discovery.c b/src/ac/ac_discovery.c index 8878158..4c4be16 100644 --- a/src/ac/ac_discovery.c +++ b/src/ac/ac_discovery.c @@ -167,7 +167,7 @@ static void ac_discovery_run(void) { struct capwap_packet_txmng* txmngpacket; /* */ - capwap_logging_debug("Receive discovery request packet"); + log_printf(LOG_DEBUG, "Receive discovery request packet"); /* Creare discovery response */ txmngpacket = ac_create_discovery_response(&packet); @@ -186,7 +186,7 @@ static void ac_discovery_run(void) { /* Send discovery response to WTP */ if (!capwap_sendto_fragmentpacket(acpacket->sendsock, responsefragmentpacket, &acpacket->sender)) { - capwap_logging_debug("Warning: error to send discovery response packet"); + log_printf(LOG_DEBUG, "Warning: error to send discovery response packet"); } /* Don't buffering a packets sent */ @@ -211,9 +211,9 @@ static void ac_discovery_run(void) { /* */ static void* ac_discovery_thread(void* param) { - capwap_logging_debug("Discovery start"); + log_printf(LOG_DEBUG, "Discovery start"); ac_discovery_run(); - capwap_logging_debug("Discovery stop"); + log_printf(LOG_DEBUG, "Discovery stop"); /* Thread exit */ pthread_exit(NULL); @@ -234,7 +234,7 @@ int ac_discovery_start(void) { /* Create thread */ result = pthread_create(&g_ac_discovery.threadid, NULL, ac_discovery_thread, NULL); if (result) { - capwap_logging_debug("Unable create discovery thread"); + log_printf(LOG_DEBUG, "Unable create discovery thread"); return 0; } diff --git a/src/ac/ac_execute.c b/src/ac/ac_execute.c index eb02c92..9bb2d0e 100644 --- a/src/ac/ac_execute.c +++ b/src/ac/ac_execute.c @@ -203,7 +203,7 @@ static void ac_session_msgqueue_parsing_item(struct ac_session_msgqueue_item_t* } default: { - capwap_logging_debug("Unknown message queue item: %lu", item->message); + log_printf(LOG_DEBUG, "Unknown message queue item: %lu", item->message); break; } } @@ -215,11 +215,11 @@ static void ac_wait_terminate_allsessions(void) { /* Wait that list is empty */ while (g_ac.sessionsthread->count > 0) { - capwap_logging_debug("Waiting for %d session terminate", g_ac.sessionsthread->count); + log_printf(LOG_DEBUG, "Waiting for %d session terminate", g_ac.sessionsthread->count); /* Receive message queue packet */ if (!ac_recvmsgqueue(g_ac.fdmsgsessions[1], &item)) { - capwap_logging_debug("Unable to receive message queue"); + log_printf(LOG_DEBUG, "Unable to receive message queue"); break; } @@ -229,7 +229,7 @@ static void ac_wait_terminate_allsessions(void) { } } - capwap_logging_debug("Close all sessions"); + log_printf(LOG_DEBUG, "Close all sessions"); } /* Initialize message queue */ @@ -682,7 +682,7 @@ static struct ac_session_t* ac_create_session(int sock, union sockaddr_capwap* f /* */ capwap_itemlist_insert_after(g_ac.sessionsthread, NULL, itemlist); } else { - capwap_logging_fatal("Unable create session thread, error code %d", result); + log_printf(LOG_EMERG, "Unable create session thread, error code %d", result); capwap_exit(CAPWAP_OUT_OF_MEMORY); } @@ -828,7 +828,7 @@ int ac_execute(void) { /* Set file descriptor pool */ if (ac_execute_init_fdspool(&fds, &g_ac.net, g_ac.fdmsgsessions[1]) <= 0) { - capwap_logging_debug("Unable to initialize file descriptor pool"); + log_printf(LOG_DEBUG, "Unable to initialize file descriptor pool"); return AC_ERROR_SYSTEM_FAILER; } @@ -841,7 +841,7 @@ int ac_execute(void) { /* Start discovery thread */ if (!ac_discovery_start()) { ac_execute_free_fdspool(&fds); - capwap_logging_debug("Unable to start discovery thread"); + log_printf(LOG_DEBUG, "Unable to start discovery thread"); return AC_ERROR_SYSTEM_FAILER; } @@ -849,7 +849,7 @@ int ac_execute(void) { if (!ac_backend_start()) { ac_execute_free_fdspool(&fds); ac_discovery_stop(); - capwap_logging_error("Unable start backend management"); + log_printf(LOG_ERR, "Unable start backend management"); return AC_ERROR_SYSTEM_FAILER; } @@ -859,7 +859,7 @@ int ac_execute(void) { buffersize = sizeof(buffer); index = ac_recvfrom(&fds, buffer, &buffersize, &fromaddr, &toaddr); if (!g_ac.running) { - capwap_logging_debug("Closing AC"); + log_printf(LOG_DEBUG, "Closing AC"); break; } diff --git a/src/ac/ac_ieee80211_data.c b/src/ac/ac_ieee80211_data.c index aac36e3..217b284 100644 --- a/src/ac/ac_ieee80211_data.c +++ b/src/ac/ac_ieee80211_data.c @@ -42,7 +42,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session } /* */ - capwap_logging_info("Receive IEEE802.11 Authentication Request from %s station", station->addrtext); + log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request from %s station", station->addrtext); /* A station is removed if the association does not complete within a given period of time */ station->timeoutaction = AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE; @@ -62,7 +62,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session /* Parsing Information Elements */ if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->authetication.ie[0], ielength)) { - capwap_logging_info("Invalid IEEE802.11 Authentication Request from %s station", station->addrtext); + log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request from %s station", station->addrtext); return; } @@ -95,14 +95,14 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session if (responselength > 0) { /* Send authentication response */ if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) { - capwap_logging_info("Sent IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)responsestatuscode); + log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)responsestatuscode); station->flags |= AC_STATION_FLAGS_AUTHENTICATED; } else { - capwap_logging_warning("Unable to send IEEE802.11 Authentication Response to %s station", station->addrtext); + log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response to %s station", station->addrtext); ac_stations_delete_station(session, station); } } else { - capwap_logging_warning("Unable to create IEEE802.11 Authentication Response to %s station", station->addrtext); + log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response to %s station", station->addrtext); ac_stations_delete_station(session, station); } } @@ -117,7 +117,7 @@ static void ac_ieee80211_mgmt_authentication_packet(struct ac_session_t* session statuscode = __le16_to_cpu(mgmt->authetication.statuscode); /* */ - capwap_logging_info("Receive IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)statuscode); + log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Response to %s station with %d status code", station->addrtext, (int)statuscode); if (statuscode == IEEE80211_STATUS_SUCCESS) { algorithm = __le16_to_cpu(mgmt->authetication.algorithm); @@ -155,13 +155,13 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se } /* */ - capwap_logging_info("Receive IEEE802.11 Association Request from %s station", station->addrtext); + log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s station", station->addrtext); /* */ wlan = station->wlan; if (!(station->flags & AC_STATION_FLAGS_AUTHENTICATED)) { /* Invalid station, delete station */ - capwap_logging_info("Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext); + log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unauthorized station", station->addrtext); ac_stations_delete_station(session, station); return; } @@ -191,7 +191,7 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se /* Parsing Information Elements */ if (ieee80211_retrieve_information_elements_position(&ieitems, &mgmt->associationrequest.ie[0], ielength)) { - capwap_logging_info("Invalid IEEE802.11 Association Request from %s station", station->addrtext); + log_printf(LOG_INFO, "Invalid IEEE802.11 Association Request from %s station", station->addrtext); ac_stations_delete_station(session, station); return; } @@ -237,17 +237,17 @@ static void ac_ieee80211_mgmt_association_request_packet(struct ac_session_t* se if (responselength > 0) { /* Send association response */ if (!ac_kmod_send_data(&session->sessionid, wlan->device->radioid, session->binding, buffer, responselength)) { - capwap_logging_info("Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode); + log_printf(LOG_INFO, "Sent IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)resultstatuscode); /* Active Station */ station->flags |= AC_STATION_FLAGS_ASSOCIATE; ac_stations_authorize_station(session, station); } else { - capwap_logging_warning("Unable to send IEEE802.11 Association Response to %s station", station->addrtext); + log_printf(LOG_WARNING, "Unable to send IEEE802.11 Association Response to %s station", station->addrtext); ac_stations_delete_station(session, station); } } else { - capwap_logging_warning("Unable to create IEEE802.11 Association Response to %s station", station->addrtext); + log_printf(LOG_WARNING, "Unable to create IEEE802.11 Association Response to %s station", station->addrtext); ac_stations_delete_station(session, station); } } @@ -271,7 +271,7 @@ static void ac_ieee80211_mgmt_association_response_packet(struct ac_session_t* s if (!memcmp(mgmt->bssid, mgmt->sa, MACADDRESS_EUI48_LENGTH) && memcmp(mgmt->bssid, mgmt->da, MACADDRESS_EUI48_LENGTH)) { station = ac_stations_get_station(session, radioid, mgmt->bssid, mgmt->da); if (station && station->wlan && (station->wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL)) { - capwap_logging_info("Receive IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)mgmt->associationresponse.statuscode); + log_printf(LOG_INFO, "Receive IEEE802.11 Association Response to %s station with %d status code", station->addrtext, (int)mgmt->associationresponse.statuscode); if (mgmt->associationresponse.statuscode == IEEE80211_STATUS_SUCCESS) { /* Get Station Info */ diff --git a/src/ac/ac_kmod.c b/src/ac/ac_kmod.c index 680c495..17c0ecd 100644 --- a/src/ac/ac_kmod.c +++ b/src/ac/ac_kmod.c @@ -191,7 +191,7 @@ static int ac_kmod_link(void) { if (result == -EALREADY) { result = 0; } else { - capwap_logging_warning("Unable to connect kernel module, error code: %d", result); + log_printf(LOG_WARNING, "Unable to connect kernel module, error code: %d", result); } } @@ -211,7 +211,7 @@ static void ac_kmod_event_receive(int fd, void** params, int paramscount) { /* */ res = nl_recvmsgs((struct nl_sock*)params[0], (struct nl_cb*)params[1]); if (res) { - capwap_logging_warning("Receive kernel module message failed: %d", res); + log_printf(LOG_WARNING, "Receive kernel module message failed: %d", res); } } @@ -233,12 +233,12 @@ int ac_kmod_send_keepalive(struct capwap_sessionid_element* sessionid) { nla_put(msg, NLSMARTCAPWAP_ATTR_SESSION_ID, sizeof(struct capwap_sessionid_element), sessionid); /* */ - capwap_logging_debug("Prepare to send keep-alive"); + log_printf(LOG_DEBUG, "Prepare to send keep-alive"); result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to send keep-alive: %d", result); + log_printf(LOG_ERR, "Unable to send keep-alive: %d", result); } - capwap_logging_debug("Sent keep-alive"); + log_printf(LOG_DEBUG, "Sent keep-alive"); /* */ nlmsg_free(msg); @@ -270,7 +270,7 @@ int ac_kmod_send_data(struct capwap_sessionid_element* sessionid, uint8_t radioi /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to send data: %d", result); + log_printf(LOG_ERR, "Unable to send data: %d", result); } /* */ @@ -342,7 +342,7 @@ int ac_kmod_createdatachannel(int family, unsigned short port) { /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to bind kernel socket: %d", result); + log_printf(LOG_ERR, "Unable to bind kernel socket: %d", result); } /* */ @@ -372,7 +372,7 @@ int ac_kmod_new_datasession(struct capwap_sessionid_element* sessionid, uint8_t /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to create data session: %d", result); + log_printf(LOG_ERR, "Unable to create data session: %d", result); } /* */ @@ -400,7 +400,7 @@ int ac_kmod_delete_datasession(struct capwap_sessionid_element* sessionid) { /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result && (result != ENOENT)) { - capwap_logging_error("Unable to delete data session: %d", result); + log_printf(LOG_ERR, "Unable to delete data session: %d", result); } /* */ @@ -436,7 +436,7 @@ int ac_kmod_addwlan(struct capwap_sessionid_element* sessionid, uint8_t radioid, /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to add wlan: %d", result); + log_printf(LOG_ERR, "Unable to add wlan: %d", result); } /* */ @@ -464,7 +464,7 @@ int ac_kmod_removewlan(struct capwap_sessionid_element* sessionid) { /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result && (result != ENOENT)) { - capwap_logging_error("Unable to remove wlan: %d", result); + log_printf(LOG_ERR, "Unable to remove wlan: %d", result); } /* */ @@ -512,7 +512,7 @@ int ac_kmod_create_iface(const char* ifname, uint16_t mtu) { if (!result) { result = (ifindex ? (int)ifindex : -1); } else { - capwap_logging_error("Unable to create data session: %d", result); + log_printf(LOG_ERR, "Unable to create data session: %d", result); } /* */ @@ -540,7 +540,7 @@ int ac_kmod_delete_iface(int ifindex) { /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result && (result != ENOENT)) { - capwap_logging_error("Unable to delete interface: %d", result); + log_printf(LOG_ERR, "Unable to delete interface: %d", result); } /* */ @@ -580,7 +580,7 @@ int ac_kmod_authorize_station(struct capwap_sessionid_element* sessionid, const /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to authorize station: %d", result); + log_printf(LOG_ERR, "Unable to authorize station: %d", result); } /* */ @@ -610,7 +610,7 @@ int ac_kmod_deauthorize_station(struct capwap_sessionid_element* sessionid, cons /* */ result = ac_kmod_send_and_recv_msg(msg, NULL, NULL); if (result) { - capwap_logging_error("Unable to deauthorize station: %d", result); + log_printf(LOG_ERR, "Unable to deauthorize station: %d", result); } /* */ @@ -644,7 +644,7 @@ int ac_kmod_init(void) { /* Get nlsmartcapwap netlink family */ g_ac.kmodhandle.nlsmartcapwap_id = genl_ctrl_resolve(g_ac.kmodhandle.nl, NLSMARTCAPWAP_GENL_NAME); if (g_ac.kmodhandle.nlsmartcapwap_id < 0) { - capwap_logging_warning("Unable to found kernel module"); + log_printf(LOG_WARNING, "Unable to found kernel module"); ac_kmod_free(); return -1; } diff --git a/src/ac/ac_session.c b/src/ac/ac_session.c index 41b75ee..164e0df 100644 --- a/src/ac/ac_session.c +++ b/src/ac/ac_session.c @@ -165,12 +165,12 @@ static int ac_session_action_authorizestation_response(struct ac_session_t* sess session->retransmitcount = 0; capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); } else { - capwap_logging_warning("Unable to authorize station into kernel module data channel"); + log_printf(LOG_WARNING, "Unable to authorize station into kernel module data channel"); ac_free_reference_last_request(session); ac_session_teardown(session); } } else { - capwap_logging_debug("Warning: error to send Station Configuration Request packet"); + log_printf(LOG_DEBUG, "Warning: error to send Station Configuration Request packet"); ac_free_reference_last_request(session); ac_session_teardown(session); } @@ -219,7 +219,7 @@ static int ac_session_action_resetwtp(struct ac_session_t* session, struct ac_no ac_dfa_change_state(session, CAPWAP_RESET_STATE); capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); } else { - capwap_logging_debug("Warning: error to send Reset Request packet"); + log_printf(LOG_DEBUG, "Warning: error to send Reset Request packet"); ac_free_reference_last_request(session); ac_session_teardown(session); } @@ -279,7 +279,7 @@ static int ac_session_action_addwlan(struct ac_session_t* session, struct ac_not session->retransmitcount = 0; capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); } else { - capwap_logging_debug("Warning: error to send WLAN Configuration Request packet"); + log_printf(LOG_DEBUG, "Warning: error to send WLAN Configuration Request packet"); ac_free_reference_last_request(session); ac_session_teardown(session); } @@ -302,7 +302,7 @@ static int ac_session_action_station_configuration_ieee8011_add_station(struct a response = ac_session_action_authorizestation_request(session, notify->radioid, notify->wlanid, notify->address); if (response) { if (ac_session_action_authorizestation_response(session, response, notify)) { - capwap_logging_info("Station is not authorized"); + log_printf(LOG_INFO, "Station is not authorized"); /* TODO kickoff station */ } @@ -353,7 +353,7 @@ static int ac_session_action_station_configuration_ieee8011_delete_station(struc session->retransmitcount = 0; capwap_timeout_set(session->timeout, session->idtimercontrol, AC_RETRANSMIT_INTERVAL, ac_dfa_retransmition_timeout, session, NULL); } else { - capwap_logging_debug("Warning: error to send Station Configuration Request packet"); + log_printf(LOG_DEBUG, "Warning: error to send Station Configuration Request packet"); ac_free_reference_last_request(session); ac_session_teardown(session); } @@ -399,7 +399,7 @@ static int ac_session_action_execute(struct ac_session_t* session, struct ac_ses { char sessionname[33]; capwap_sessionid_printf(&session->sessionid, sessionname); - capwap_logging_debug("Receive Keep-Alive from %s", sessionname); + log_printf(LOG_DEBUG, "Receive Keep-Alive from %s", sessionname); } #endif /* Send keep-alive response */ @@ -601,7 +601,7 @@ static void ac_dfa_execute(struct ac_session_t* session, struct capwap_parsed_pa } default: { - capwap_logging_debug("Unknown AC action event: %lu", session->state); + log_printf(LOG_DEBUG, "Unknown AC action event: %lu", session->state); ac_session_teardown(session); break; } @@ -659,7 +659,7 @@ static void ac_session_destroy(struct ac_session_t* session) { #ifdef DEBUG capwap_sessionid_printf(&session->sessionid, sessionname); - capwap_logging_debug("Release Session AC %s", sessionname); + log_printf(LOG_DEBUG, "Release Session AC %s", sessionname); #endif /* Release last reference */ @@ -674,7 +674,7 @@ static void ac_session_destroy(struct ac_session_t* session) { /* Check if all reference is release */ while (session->count > 0) { #ifdef DEBUG - capwap_logging_debug("Wait for release Session AC %s (count=%d)", sessionname, session->count); + log_printf(LOG_DEBUG, "Wait for release Session AC %s (count=%d)", sessionname, session->count); #endif /* */ capwap_event_reset(&session->changereference); @@ -777,9 +777,9 @@ static void ac_session_run(struct ac_session_t* session) { if (capwap_is_request_type(session->rxmngpacket->ctrlmsg.type) && (session->remotetype == session->rxmngpacket->ctrlmsg.type) && (session->remoteseqnumber == session->rxmngpacket->ctrlmsg.seq)) { /* Retransmit response */ if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->responsefragmentpacket)) { - capwap_logging_error("Error to resend response packet"); + log_printf(LOG_ERR, "Error to resend response packet"); } else { - capwap_logging_debug("Retrasmitted control packet"); + log_printf(LOG_DEBUG, "Retrasmitted control packet"); } } else { /* Check message type */ @@ -832,24 +832,24 @@ static void ac_session_run(struct ac_session_t* session) { /* */ ac_dfa_execute(session, &packet); } else { - capwap_logging_debug("Failed validation parsed control packet"); + log_printf(LOG_DEBUG, "Failed validation parsed control packet"); if (capwap_is_request_type(session->rxmngpacket->ctrlmsg.type)) { - capwap_logging_warning("Missing Mandatory Message Element, send Response Packet with error"); + log_printf(LOG_WARNING, "Missing Mandatory Message Element, send Response Packet with error"); ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_MISSING_MANDATORY_MSG_ELEMENT); } } } else { - capwap_logging_debug("Failed parsing packet"); + log_printf(LOG_DEBUG, "Failed parsing packet"); if ((res == UNRECOGNIZED_MESSAGE_ELEMENT) && capwap_is_request_type(session->rxmngpacket->ctrlmsg.type)) { - capwap_logging_warning("Unrecognized Message Element, send Response Packet with error"); + log_printf(LOG_WARNING, "Unrecognized Message Element, send Response Packet with error"); ac_send_invalid_request(session, CAPWAP_RESULTCODE_FAILURE_UNRECOGNIZED_MESSAGE_ELEMENT); /* TODO: add the unrecognized message element */ } } } else { - capwap_logging_debug("Invalid message type"); + log_printf(LOG_DEBUG, "Invalid message type"); if (res == INVALID_REQUEST_MESSAGE_TYPE) { - capwap_logging_warning("Unexpected Unrecognized Request, send Response Packet with error"); + log_printf(LOG_WARNING, "Unexpected Unrecognized Request, send Response Packet with error"); ac_send_invalid_request(session, CAPWAP_RESULTCODE_MSG_UNEXPECTED_UNRECOGNIZED_REQUEST); } } @@ -890,7 +890,7 @@ void ac_dfa_change_state(struct ac_session_t* session, int state) { #ifdef DEBUG char sessionname[33]; capwap_sessionid_printf(&session->sessionid, sessionname); - capwap_logging_debug("Session AC %s change state from %s to %s", sessionname, capwap_dfa_getname(session->state), capwap_dfa_getname(state)); + log_printf(LOG_DEBUG, "Session AC %s change state from %s to %s", sessionname, capwap_dfa_getname(session->state), capwap_dfa_getname(state)); #endif session->state = state; @@ -984,9 +984,9 @@ void* ac_session_thread(void* param) { threadid = session->threadid; /* */ - capwap_logging_debug("Session start"); + log_printf(LOG_DEBUG, "Session start"); ac_session_run(session); - capwap_logging_debug("Session end"); + log_printf(LOG_DEBUG, "Session end"); /* Notify terminate thread */ ac_msgqueue_notify_closethread(threadid); @@ -1100,21 +1100,21 @@ void ac_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long struct ac_session_t* session = (struct ac_session_t*)context; if (!session->requestfragmentpacket->count) { - capwap_logging_warning("Invalid retransmition request packet"); + log_printf(LOG_WARNING, "Invalid retransmition request packet"); ac_session_teardown(session); } else { session->retransmitcount++; if (session->retransmitcount >= AC_MAX_RETRANSMIT) { - capwap_logging_info("Retransmition request packet timeout"); + log_printf(LOG_INFO, "Retransmition request packet timeout"); /* Timeout reset state */ ac_free_reference_last_request(session); ac_session_teardown(session); } else { /* Retransmit Request */ - capwap_logging_debug("Retransmition request packet"); + log_printf(LOG_DEBUG, "Retransmition request packet"); if (!capwap_crypt_sendto_fragmentpacket(&session->dtls, session->requestfragmentpacket)) { - capwap_logging_error("Error to send request packet"); + log_printf(LOG_ERR, "Error to send request packet"); } /* Update timeout */ @@ -1124,6 +1124,6 @@ void ac_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long } void ac_dfa_teardown_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) { - capwap_logging_info("Session timeout, teardown"); + log_printf(LOG_INFO, "Session timeout, teardown"); ac_session_teardown((struct ac_session_t*)context); } diff --git a/src/ac/ac_wlans.c b/src/ac/ac_wlans.c index daa930c..9a4cd6a 100644 --- a/src/ac/ac_wlans.c +++ b/src/ac/ac_wlans.c @@ -45,7 +45,7 @@ static void ac_stations_destroy_station(struct ac_session_t* session, struct ac_ ASSERT(station != NULL); /* */ - capwap_logging_info("Destroy station: %s", station->addrtext); + log_printf(LOG_INFO, "Destroy station: %s", station->addrtext); /* Remove reference from Authoritative Stations List */ capwap_rwlock_wrlock(&g_ac.authstationslock); @@ -166,7 +166,7 @@ int ac_wlans_assign_bssid(struct ac_session_t* session, struct ac_wlan* wlan) { capwap_itemlist_insert_after(session->wlans->devices[wlan->device->radioid - 1].wlans, NULL, wlan->wlanitem); /* */ - capwap_logging_info("Added new wlan with radioid: %d, wlanid: %d, bssid: %s", (int)wlan->device->radioid, (int)wlan->wlanid, capwap_printf_macaddress(buffer, wlan->address, MACADDRESS_EUI48_LENGTH)); + log_printf(LOG_INFO, "Added new wlan with radioid: %d, wlanid: %d, bssid: %s", (int)wlan->device->radioid, (int)wlan->wlanid, capwap_printf_macaddress(buffer, wlan->address, MACADDRESS_EUI48_LENGTH)); return 0; } @@ -342,7 +342,7 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint /* */ capwap_printf_macaddress(buffer1, bssid, MACADDRESS_EUI48_LENGTH); capwap_printf_macaddress(buffer2, address, MACADDRESS_EUI48_LENGTH); - capwap_logging_info("Create station to radioid: %d, bssid: %s, station address: %s", (int)radioid, buffer1, buffer2); + log_printf(LOG_INFO, "Create station to radioid: %d, bssid: %s, station address: %s", (int)radioid, buffer1, buffer2); /* */ wlan = ac_wlans_get_bssid(session, radioid, bssid); @@ -392,7 +392,7 @@ struct ac_station* ac_stations_create_station(struct ac_session_t* session, uint } } } else { - capwap_logging_warning("Unable to find radioid: %d, bssid: %s", (int)radioid, buffer1); + log_printf(LOG_WARNING, "Unable to find radioid: %d, bssid: %s", (int)radioid, buffer1); } return station; @@ -479,7 +479,7 @@ void ac_stations_timeout(struct capwap_timeout* timeout, unsigned long index, vo if (station->idtimeout == index) { switch (station->timeoutaction) { case AC_STATION_TIMEOUT_ACTION_DEAUTHENTICATE: { - capwap_logging_warning("The %s station has not completed the association in time", station->addrtext); + log_printf(LOG_WARNING, "The %s station has not completed the association in time", station->addrtext); ac_stations_delete_station((struct ac_session_t*)param, station); break; } diff --git a/src/common/capwap.h b/src/common/capwap.h index 0dcb42c..4011c3c 100644 --- a/src/common/capwap.h +++ b/src/common/capwap.h @@ -76,7 +76,7 @@ void capwap_daemon(void); /* */ #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); \ } while(0) diff --git a/src/common/capwap_debug.c b/src/common/capwap_debug.c index 74c378b..82d6425 100644 --- a/src/common/capwap_debug.c +++ b/src/common/capwap_debug.c @@ -36,14 +36,14 @@ void* capwap_alloc_debug(size_t size, const char* file, const int line) { /* Request 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); } /* Alloc block with memory block */ block = (struct capwap_memory_block*)malloc(sizeof(struct capwap_memory_block) + size); 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); } @@ -69,19 +69,19 @@ void capwap_free_debug(void* p, const char* file, const int line) { struct capwap_memory_block* prevblock; 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); } /* 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); } block = (struct capwap_memory_block*)((char*)p - sizeof(struct capwap_memory_block)); 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); } @@ -107,7 +107,7 @@ void capwap_free_debug(void* p, const char* file, const int line) { 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 */ @@ -119,7 +119,7 @@ void capwap_dump_memory(void) { findblock = g_memoryblocks; 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); #ifdef USE_DEBUG_BACKTRACE @@ -129,7 +129,7 @@ void capwap_dump_memory(void) { /* Skipping capwap_alloc_debug function print out */ 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); @@ -144,9 +144,9 @@ void capwap_dump_memory(void) { /* Check if all memory is free */ int capwap_check_memory_leak(int verbose) { if ((g_memoryblocks != NULL) && (verbose != 0)) { - capwap_logging_debug("*** Detected memory leaks ! ***"); + log_printf(LOG_DEBUG, "*** Detected memory leaks ! ***"); capwap_dump_memory(); - capwap_logging_debug("*******************************"); + log_printf(LOG_DEBUG, "*******************************"); } return ((g_memoryblocks != NULL) ? 1 : 0); @@ -168,7 +168,7 @@ void capwap_backtrace_callstack(void) { /* Skipping capwap_backtrace_callstack function print out */ for (i = 1; i < count; i++) { - capwap_logging_debug("\t%s", functions[i]); + log_printf(LOG_DEBUG, "\t%s", functions[i]); } free(functions); diff --git a/src/common/capwap_debug.h b/src/common/capwap_debug.h index 5c26fbc..1f61e0f 100644 --- a/src/common/capwap_debug.h +++ b/src/common/capwap_debug.h @@ -6,7 +6,7 @@ #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 */ #define capwap_alloc(x) capwap_alloc_debug(x, __FILE__, __LINE__) diff --git a/src/common/capwap_dtls.c b/src/common/capwap_dtls.c index 4b4de08..f008f58 100644 --- a/src/common/capwap_dtls.c +++ b/src/common/capwap_dtls.c @@ -33,7 +33,7 @@ static int capwap_bio_method_recv(WOLFSSL* ssl, char* buffer, int length, void* /* Check DTLS Capwap Preamble */ dtlspreamble = (struct capwap_dtls_header*)dtls->buffer; 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 */ } @@ -75,7 +75,7 @@ static int capwap_bio_method_send(WOLFSSL* ssl, char* buffer, int length, void* /* Send packet */ err = capwap_sendto(dtls->sock, data, length + sizeof(struct capwap_dtls_header), &dtls->peeraddr); 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; } @@ -236,7 +236,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c /* Alloc context */ dtlscontext->sslcontext = (void*)wolfSSL_CTX_new(((param->type == CAPWAP_DTLS_SERVER) ? wolfDTLSv1_server_method() : wolfDTLSv1_client_method())); if (!dtlscontext->sslcontext) { - capwap_logging_debug("Error to initialize dtls context"); + log_printf(LOG_DEBUG, "Error to initialize dtls context"); return 0; } @@ -249,42 +249,42 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c if (dtlscontext->mode == CAPWAP_DTLS_MODE_CERTIFICATE) { /* Check context */ 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); return 0; } 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); return 0; } 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); return 0; } /* Public certificate */ 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); return 0; } /* Private key */ 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); return 0; } 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); return 0; } /* Certificate Authority */ 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); 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 */ 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); 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 */ 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); return 0; } @@ -321,7 +321,7 @@ int capwap_crypt_createcontext(struct capwap_dtls_context* dtlscontext, struct c if (param->presharedkey.hint) { wolfSSL_CTX_use_psk_identity_hint((WOLFSSL_CTX*)dtlscontext->sslcontext, param->presharedkey.hint); } else { - capwap_logging_debug("Error to presharedkey hint"); + log_printf(LOG_DEBUG, "Error to presharedkey hint"); capwap_crypt_freecontext(dtlscontext); 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.pskkeylength = capwap_crypt_psk_to_bin(param->presharedkey.pskkey, &dtlscontext->presharedkey.pskkey); if (!dtlscontext->presharedkey.pskkeylength) { - capwap_logging_debug("Error to presharedkey"); + log_printf(LOG_DEBUG, "Error to presharedkey"); capwap_crypt_freecontext(dtlscontext); 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); } } else { - capwap_logging_debug("Invalid DTLS mode"); + log_printf(LOG_DEBUG, "Invalid DTLS mode"); capwap_crypt_freecontext(dtlscontext); return 0; } @@ -383,7 +383,7 @@ int capwap_crypt_createsession(struct capwap_dtls* dtls, struct capwap_dtls_cont /* Create ssl session */ dtls->sslsession = (void*)wolfSSL_new((WOLFSSL_CTX*)dtlscontext->sslcontext); if (!dtls->sslsession) { - capwap_logging_debug("Error to initialize dtls session"); + log_printf(LOG_DEBUG, "Error to initialize dtls session"); return 0; } @@ -498,7 +498,7 @@ int capwap_crypt_sendto(struct capwap_dtls* dtls, void* buffer, int size) { if (!dtls->enable) { err = capwap_sendto(dtls->sock, buffer, size, &dtls->peeraddr); 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; @@ -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); 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; } @@ -572,7 +572,7 @@ int capwap_decrypt_packet(struct capwap_dtls* dtls, void* encrybuffer, int size, /* */ if (dtls->action == CAPWAP_DTLS_ACTION_HANDSHAKE) { 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 */ } else { result = CAPWAP_ERROR_AGAIN; /* Don't parsing DTLS packet */ diff --git a/src/common/capwap_element.c b/src/common/capwap_element.c index 3f7a0dd..42bbae3 100644 --- a/src/common/capwap_element.c +++ b/src/common/capwap_element.c @@ -212,27 +212,27 @@ int capwap_parsing_packet(struct capwap_packet_rxmng* rxmngpacket, struct capwap (binding != CAPWAP_WIRELESS_BINDING_IEEE80211)) 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) { struct capwap_message_element_id vendor_id; 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; } 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; } 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); - 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); - capwap_logging_debug("vendor read_ops: %p", read_ops); + log_printf(LOG_DEBUG, "vendor read_ops: %p", read_ops); if (read_ops) { id = vendor_id; 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 { /* Reader function */ 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) return UNRECOGNIZED_MESSAGE_ELEMENT; diff --git a/src/common/capwap_element_80211_addwlan.c b/src/common/capwap_element_80211_addwlan.c index 7091fdf..f69db10 100644 --- a/src/common/capwap_element_80211_addwlan.c +++ b/src/common/capwap_element_80211_addwlan.c @@ -99,7 +99,7 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); 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; } @@ -113,11 +113,11 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if (!IS_VALID_WLANID(data->wlanid)) { 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; } @@ -141,7 +141,7 @@ static void* capwap_80211_addwlan_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (!length || (length > CAPWAP_ADD_WLAN_SSID_LENGTH)) { 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; } diff --git a/src/common/capwap_element_80211_antenna.c b/src/common/capwap_element_80211_antenna.c index e545592..faa3480 100644 --- a/src/common/capwap_element_80211_antenna.c +++ b/src/common/capwap_element_80211_antenna.c @@ -75,13 +75,13 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length < 5) { - capwap_logging_debug("Invalid IEEE 802.11 Antenna element"); + log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Antenna element"); return NULL; } length -= 4; 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; } @@ -94,7 +94,7 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle func->read_u8(handle, &data->radioid); if (!IS_VALID_RADIOID(data->radioid)) { 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; } @@ -104,7 +104,7 @@ static void* capwap_80211_antenna_element_parsing(capwap_message_elements_handle /* Check */ 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); return NULL; } diff --git a/src/common/capwap_element_80211_assignbssid.c b/src/common/capwap_element_80211_assignbssid.c index 5a10ae6..43862d0 100644 --- a/src/common/capwap_element_80211_assignbssid.c +++ b/src/common/capwap_element_80211_assignbssid.c @@ -36,7 +36,7 @@ static void* capwap_80211_assignbssid_element_parsing(capwap_message_elements_ha ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_deletewlan.c b/src/common/capwap_element_80211_deletewlan.c index 2575ca0..75825dd 100644 --- a/src/common/capwap_element_80211_deletewlan.c +++ b/src/common/capwap_element_80211_deletewlan.c @@ -33,7 +33,7 @@ static void* capwap_80211_deletewlan_element_parsing(capwap_message_elements_han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_directsequencecontrol.c b/src/common/capwap_element_80211_directsequencecontrol.c index 45489db..1340776 100644 --- a/src/common/capwap_element_80211_directsequencecontrol.c +++ b/src/common/capwap_element_80211_directsequencecontrol.c @@ -54,7 +54,7 @@ static void* capwap_80211_directsequencecontrol_element_parsing(capwap_message_e ASSERT(func != NULL); 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; } @@ -66,7 +66,7 @@ static void* capwap_80211_directsequencecontrol_element_parsing(capwap_message_e func->read_u8(handle, &data->radioid); if (!IS_VALID_RADIOID(data->radioid)) { 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; } diff --git a/src/common/capwap_element_80211_ie.c b/src/common/capwap_element_80211_ie.c index 376616f..9b5d87f 100644 --- a/src/common/capwap_element_80211_ie.c +++ b/src/common/capwap_element_80211_ie.c @@ -37,7 +37,7 @@ static void* capwap_80211_ie_element_parsing(capwap_message_elements_handle hand length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_80211_macoperation.c b/src/common/capwap_element_80211_macoperation.c index 849ce78..65b8094 100644 --- a/src/common/capwap_element_80211_macoperation.c +++ b/src/common/capwap_element_80211_macoperation.c @@ -46,7 +46,7 @@ static void* capwap_80211_macoperation_element_parsing(capwap_message_elements_h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_miccountermeasures.c b/src/common/capwap_element_80211_miccountermeasures.c index adfbeaa..7340f89 100644 --- a/src/common/capwap_element_80211_miccountermeasures.c +++ b/src/common/capwap_element_80211_miccountermeasures.c @@ -36,7 +36,7 @@ static void* capwap_80211_miccountermeasures_element_parsing(capwap_message_elem ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_multidomaincapability.c b/src/common/capwap_element_80211_multidomaincapability.c index 62ef1e7..83a626b 100644 --- a/src/common/capwap_element_80211_multidomaincapability.c +++ b/src/common/capwap_element_80211_multidomaincapability.c @@ -39,7 +39,7 @@ static void* capwap_80211_multidomaincapability_element_parsing(capwap_message_e ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_ofdmcontrol.c b/src/common/capwap_element_80211_ofdmcontrol.c index cf023bf..7a4df34 100644 --- a/src/common/capwap_element_80211_ofdmcontrol.c +++ b/src/common/capwap_element_80211_ofdmcontrol.c @@ -39,7 +39,7 @@ static void* capwap_80211_ofdmcontrol_element_parsing(capwap_message_elements_ha ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_rateset.c b/src/common/capwap_element_80211_rateset.c index 8dd0a38..947285f 100644 --- a/src/common/capwap_element_80211_rateset.c +++ b/src/common/capwap_element_80211_rateset.c @@ -35,13 +35,13 @@ static void* capwap_80211_rateset_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); 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; } length -= 1; 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; } diff --git a/src/common/capwap_element_80211_rsnaerrorreport.c b/src/common/capwap_element_80211_rsnaerrorreport.c index 6511ee0..2086759 100644 --- a/src/common/capwap_element_80211_rsnaerrorreport.c +++ b/src/common/capwap_element_80211_rsnaerrorreport.c @@ -61,7 +61,7 @@ static void* capwap_80211_rsnaerrorreport_element_parsing(capwap_message_element ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_station.c b/src/common/capwap_element_80211_station.c index 6e91fc5..0bc64ca 100644 --- a/src/common/capwap_element_80211_station.c +++ b/src/common/capwap_element_80211_station.c @@ -46,13 +46,13 @@ static void* capwap_80211_station_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length < 14) { - capwap_logging_debug("Invalid IEEE 802.11 Station element"); + log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Station element"); return NULL; } length -= 13; 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; } diff --git a/src/common/capwap_element_80211_stationkey.c b/src/common/capwap_element_80211_stationkey.c index 9e88204..85e1a47 100644 --- a/src/common/capwap_element_80211_stationkey.c +++ b/src/common/capwap_element_80211_stationkey.c @@ -48,7 +48,7 @@ static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_han length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_80211_stationqos.c b/src/common/capwap_element_80211_stationqos.c index a478903..ba3e882 100644 --- a/src/common/capwap_element_80211_stationqos.c +++ b/src/common/capwap_element_80211_stationqos.c @@ -36,7 +36,7 @@ static void* capwap_80211_stationqos_element_parsing(capwap_message_elements_han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_statistics.c b/src/common/capwap_element_80211_statistics.c index 8f6a8cb..c45ad53 100644 --- a/src/common/capwap_element_80211_statistics.c +++ b/src/common/capwap_element_80211_statistics.c @@ -91,7 +91,7 @@ static void* capwap_80211_statistics_element_parsing(capwap_message_elements_han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_supportedrates.c b/src/common/capwap_element_80211_supportedrates.c index 77243a2..fc198b5 100644 --- a/src/common/capwap_element_80211_supportedrates.c +++ b/src/common/capwap_element_80211_supportedrates.c @@ -35,13 +35,13 @@ static void* capwap_80211_supportedrates_element_parsing(capwap_message_elements length = func->read_ready(handle); 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; } length -= 1; 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; } diff --git a/src/common/capwap_element_80211_txpower.c b/src/common/capwap_element_80211_txpower.c index dfc0d31..36d8aa5 100644 --- a/src/common/capwap_element_80211_txpower.c +++ b/src/common/capwap_element_80211_txpower.c @@ -35,7 +35,7 @@ static void* capwap_80211_txpower_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_txpowerlevel.c b/src/common/capwap_element_80211_txpowerlevel.c index a54cab2..f80fdc6 100644 --- a/src/common/capwap_element_80211_txpowerlevel.c +++ b/src/common/capwap_element_80211_txpowerlevel.c @@ -40,13 +40,13 @@ static void* capwap_80211_txpowerlevel_element_parsing(capwap_message_elements_h length = func->read_ready(handle); 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; } length -= 2; 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; } @@ -60,7 +60,7 @@ static void* capwap_80211_txpowerlevel_element_parsing(capwap_message_elements_h /* Check */ 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); return NULL; } diff --git a/src/common/capwap_element_80211_updatestationqos.c b/src/common/capwap_element_80211_updatestationqos.c index 6631d01..623ea65 100644 --- a/src/common/capwap_element_80211_updatestationqos.c +++ b/src/common/capwap_element_80211_updatestationqos.c @@ -47,7 +47,7 @@ static void* capwap_80211_updatestationqos_element_parsing(capwap_message_elemen ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_updatewlan.c b/src/common/capwap_element_80211_updatewlan.c index 1a4532c..241897e 100644 --- a/src/common/capwap_element_80211_updatewlan.c +++ b/src/common/capwap_element_80211_updatewlan.c @@ -73,7 +73,7 @@ static void* capwap_80211_updatewlan_element_parsing(capwap_message_elements_han length = func->read_ready(handle); 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; } @@ -93,7 +93,7 @@ static void* capwap_80211_updatewlan_element_parsing(capwap_message_elements_han if (length != data->keylength) { 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; } else if (data->keylength > 0) { data->key = (uint8_t*)capwap_alloc(data->keylength); diff --git a/src/common/capwap_element_80211_wtpqos.c b/src/common/capwap_element_80211_wtpqos.c index aded88a..bb7cb53 100644 --- a/src/common/capwap_element_80211_wtpqos.c +++ b/src/common/capwap_element_80211_wtpqos.c @@ -51,7 +51,7 @@ static void* capwap_80211_wtpqos_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_wtpradioconf.c b/src/common/capwap_element_80211_wtpradioconf.c index 1200ef1..b9288e3 100644 --- a/src/common/capwap_element_80211_wtpradioconf.c +++ b/src/common/capwap_element_80211_wtpradioconf.c @@ -44,7 +44,7 @@ static void* capwap_80211_wtpradioconf_element_parsing(capwap_message_elements_h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_wtpradiofailalarm.c b/src/common/capwap_element_80211_wtpradiofailalarm.c index 0fa4beb..047d7fa 100644 --- a/src/common/capwap_element_80211_wtpradiofailalarm.c +++ b/src/common/capwap_element_80211_wtpradiofailalarm.c @@ -35,7 +35,7 @@ static void* capwap_80211_wtpradiofailalarm_element_parsing(capwap_message_eleme ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211_wtpradioinformation.c b/src/common/capwap_element_80211_wtpradioinformation.c index e59e3ed..4a7fb69 100644 --- a/src/common/capwap_element_80211_wtpradioinformation.c +++ b/src/common/capwap_element_80211_wtpradioinformation.c @@ -36,7 +36,7 @@ static void* capwap_80211_wtpradioinformation_element_parsing(capwap_message_ele ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211n_radioconf.c b/src/common/capwap_element_80211n_radioconf.c index 20724e1..f835a7f 100644 --- a/src/common/capwap_element_80211n_radioconf.c +++ b/src/common/capwap_element_80211n_radioconf.c @@ -45,7 +45,7 @@ capwap_80211n_radioconf_element_parsing(capwap_message_elements_handle handle, ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_80211n_station_information.c b/src/common/capwap_element_80211n_station_information.c index f7459dc..67302d2 100644 --- a/src/common/capwap_element_80211n_station_information.c +++ b/src/common/capwap_element_80211n_station_information.c @@ -53,7 +53,7 @@ capwap_80211n_station_info_element_parsing(capwap_message_elements_handle handle ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_acdescriptor.c b/src/common/capwap_element_acdescriptor.c index d51293b..bdc2b13 100644 --- a/src/common/capwap_element_acdescriptor.c +++ b/src/common/capwap_element_acdescriptor.c @@ -118,7 +118,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -135,11 +135,11 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle /* Check */ 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); return NULL; } 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); return NULL; } @@ -152,15 +152,15 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle /* */ 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); return NULL; } 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); return NULL; } 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); return NULL; } @@ -176,7 +176,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle func->read_u16(handle, &desc->length); 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); return NULL; } @@ -184,7 +184,7 @@ static void* capwap_acdescriptor_element_parsing(capwap_message_elements_handle /* Check buffer size */ length = func->read_ready(handle); 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); return NULL; } diff --git a/src/common/capwap_element_acipv4list.c b/src/common/capwap_element_acipv4list.c index 2beacde..10d7166 100644 --- a/src/common/capwap_element_acipv4list.c +++ b/src/common/capwap_element_acipv4list.c @@ -38,7 +38,7 @@ static void* capwap_acipv4list_element_parsing(capwap_message_elements_handle ha length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_acipv6list.c b/src/common/capwap_element_acipv6list.c index e592fcd..a5cc0c8 100644 --- a/src/common/capwap_element_acipv6list.c +++ b/src/common/capwap_element_acipv6list.c @@ -44,7 +44,7 @@ static void* capwap_acipv6list_element_parsing(capwap_message_elements_handle ha length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_acname.c b/src/common/capwap_element_acname.c index 6fe27a6..6d2c125 100644 --- a/src/common/capwap_element_acname.c +++ b/src/common/capwap_element_acname.c @@ -35,7 +35,7 @@ static void* capwap_acname_element_parsing(capwap_message_elements_handle handle length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_acnamepriority.c b/src/common/capwap_element_acnamepriority.c index 6a2dfae..e2b14ec 100644 --- a/src/common/capwap_element_acnamepriority.c +++ b/src/common/capwap_element_acnamepriority.c @@ -35,7 +35,7 @@ static void* capwap_acnamepriority_element_parsing(capwap_message_elements_handl length = func->read_ready(handle) - 1; 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; } diff --git a/src/common/capwap_element_actimestamp.c b/src/common/capwap_element_actimestamp.c index 8fc3825..f2ae237 100644 --- a/src/common/capwap_element_actimestamp.c +++ b/src/common/capwap_element_actimestamp.c @@ -33,7 +33,7 @@ static void* capwap_actimestamp_element_parsing(capwap_message_elements_handle h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_addmacacl.c b/src/common/capwap_element_addmacacl.c index 90a53b2..4c5036b 100644 --- a/src/common/capwap_element_addmacacl.c +++ b/src/common/capwap_element_addmacacl.c @@ -65,7 +65,7 @@ static void* capwap_addmacacl_element_parsing(capwap_message_elements_handle han length = func->read_ready(handle); 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; } @@ -81,17 +81,17 @@ static void* capwap_addmacacl_element_parsing(capwap_message_elements_handle han if (!data->entry) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { 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; } if (length != (data->entry * data->length)) { 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; } diff --git a/src/common/capwap_element_addstation.c b/src/common/capwap_element_addstation.c index 036b687..b5366ae 100644 --- a/src/common/capwap_element_addstation.c +++ b/src/common/capwap_element_addstation.c @@ -82,7 +82,7 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha length = func->read_ready(handle); if (length < 8) { - capwap_logging_debug("Invalid Add Station element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Add Station element: underbuffer"); return NULL; } @@ -98,11 +98,11 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length < data->length)) { 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; } @@ -117,7 +117,7 @@ static void* capwap_addstation_element_parsing(capwap_message_elements_handle ha data->vlan[length] = 0; } else { 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; } } diff --git a/src/common/capwap_element_controlipv4.c b/src/common/capwap_element_controlipv4.c index 79914d1..6182368 100644 --- a/src/common/capwap_element_controlipv4.c +++ b/src/common/capwap_element_controlipv4.c @@ -36,7 +36,7 @@ static void* capwap_controlipv4_element_parsing(capwap_message_elements_handle h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_controlipv6.c b/src/common/capwap_element_controlipv6.c index 17ef1a2..2f04196 100644 --- a/src/common/capwap_element_controlipv6.c +++ b/src/common/capwap_element_controlipv6.c @@ -42,7 +42,7 @@ static void* capwap_controlipv6_element_parsing(capwap_message_elements_handle h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_datatransferdata.c b/src/common/capwap_element_datatransferdata.c index 82f71bc..8b864c4 100644 --- a/src/common/capwap_element_datatransferdata.c +++ b/src/common/capwap_element_datatransferdata.c @@ -69,7 +69,7 @@ static void* capwap_datatransferdata_element_parsing(capwap_message_elements_han length = func->read_ready(handle); if (length < 5) { - capwap_logging_debug("Invalid Data Transfer Data element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Data Transfer Data element: underbuffer"); 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)) { 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; } else if ((data->mode != CAPWAP_DATATRANSFERDATA_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERDATA_MODE_MEMORY_DUMP)) { 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; } else if (length != data->length) { 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; } diff --git a/src/common/capwap_element_datatransfermode.c b/src/common/capwap_element_datatransfermode.c index 12dc1d6..bea0527 100644 --- a/src/common/capwap_element_datatransfermode.c +++ b/src/common/capwap_element_datatransfermode.c @@ -48,7 +48,7 @@ static void* capwap_datatransfermode_element_parsing(capwap_message_elements_han ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_datatransfermode_element_parsing(capwap_message_elements_han func->read_u8(handle, &data->mode); if ((data->mode != CAPWAP_DATATRANSFERMODE_MODE_CRASH_DUMP) && (data->mode != CAPWAP_DATATRANSFERMODE_MODE_MEMORY_DUMP)) { 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; } diff --git a/src/common/capwap_element_decrypterrorreport.c b/src/common/capwap_element_decrypterrorreport.c index 31b3efa..3e4fcb2 100644 --- a/src/common/capwap_element_decrypterrorreport.c +++ b/src/common/capwap_element_decrypterrorreport.c @@ -67,7 +67,7 @@ static void* capwap_decrypterrorreport_element_parsing(capwap_message_elements_h length = func->read_ready(handle); if (length < 9) { - capwap_logging_debug("Invalid Decryption Error Report element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Decryption Error Report element: underbuffer"); return NULL; } @@ -84,21 +84,21 @@ static void* capwap_decrypterrorreport_element_parsing(capwap_message_elements_h if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if (!data->entry) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { 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; } if (length != (data->entry * data->length)) { 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; } diff --git a/src/common/capwap_element_decrypterrorreportperiod.c b/src/common/capwap_element_decrypterrorreportperiod.c index 560bf55..acbf937 100644 --- a/src/common/capwap_element_decrypterrorreportperiod.c +++ b/src/common/capwap_element_decrypterrorreportperiod.c @@ -49,7 +49,7 @@ static void* capwap_decrypterrorreportperiod_element_parsing(capwap_message_elem ASSERT(func != NULL); 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; } @@ -60,7 +60,7 @@ static void* capwap_decrypterrorreportperiod_element_parsing(capwap_message_elem if (!IS_VALID_RADIOID(data->radioid)) { 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; } diff --git a/src/common/capwap_element_deletemacacl.c b/src/common/capwap_element_deletemacacl.c index 5ad2ac8..7ea9318 100644 --- a/src/common/capwap_element_deletemacacl.c +++ b/src/common/capwap_element_deletemacacl.c @@ -65,7 +65,7 @@ static void* capwap_deletemacacl_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); 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; } @@ -81,17 +81,17 @@ static void* capwap_deletemacacl_element_parsing(capwap_message_elements_handle if (!data->entry) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length)) { 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; } if (length != (data->entry * data->length)) { 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; } diff --git a/src/common/capwap_element_deletestation.c b/src/common/capwap_element_deletestation.c index 99ae48b..56d1238 100644 --- a/src/common/capwap_element_deletestation.c +++ b/src/common/capwap_element_deletestation.c @@ -65,7 +65,7 @@ static void* capwap_deletestation_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length < 8) { - capwap_logging_debug("Invalid Delete Station element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Delete Station element: underbuffer"); return NULL; } @@ -81,11 +81,11 @@ static void* capwap_deletestation_element_parsing(capwap_message_elements_handle if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { 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; } diff --git a/src/common/capwap_element_discoverytype.c b/src/common/capwap_element_discoverytype.c index a7c3738..f275ea0 100644 --- a/src/common/capwap_element_discoverytype.c +++ b/src/common/capwap_element_discoverytype.c @@ -50,7 +50,7 @@ static void* capwap_discoverytype_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -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_ACREFERRAL)) { 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; } diff --git a/src/common/capwap_element_duplicateipv4.c b/src/common/capwap_element_duplicateipv4.c index f14af99..34ec3a5 100644 --- a/src/common/capwap_element_duplicateipv4.c +++ b/src/common/capwap_element_duplicateipv4.c @@ -68,7 +68,7 @@ static void* capwap_duplicateipv4_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length < 12) { - capwap_logging_debug("Invalid Duplicate IPv4 Address element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Duplicate IPv4 Address element: underbuffer"); 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)) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { 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; } diff --git a/src/common/capwap_element_duplicateipv6.c b/src/common/capwap_element_duplicateipv6.c index 533f7b7..1aa20f8 100644 --- a/src/common/capwap_element_duplicateipv6.c +++ b/src/common/capwap_element_duplicateipv6.c @@ -74,7 +74,7 @@ static void* capwap_duplicateipv6_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length < 24) { - capwap_logging_debug("Invalid Duplicate IPv6 Address element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Duplicate IPv6 Address element: underbuffer"); 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)) { 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; } else if (!IS_VALID_MACADDRESS_LENGTH(data->length) || (length != data->length)) { 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; } diff --git a/src/common/capwap_element_ecnsupport.c b/src/common/capwap_element_ecnsupport.c index c68d68f..79a8c71 100644 --- a/src/common/capwap_element_ecnsupport.c +++ b/src/common/capwap_element_ecnsupport.c @@ -48,7 +48,7 @@ static void* capwap_ecnsupport_element_parsing(capwap_message_elements_handle ha ASSERT(func != NULL); 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; } @@ -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)) { 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; } diff --git a/src/common/capwap_element_idletimeout.c b/src/common/capwap_element_idletimeout.c index f3fd47b..a5177c4 100644 --- a/src/common/capwap_element_idletimeout.c +++ b/src/common/capwap_element_idletimeout.c @@ -32,7 +32,7 @@ static void* capwap_idletimeout_element_parsing(capwap_message_elements_handle h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_imagedata.c b/src/common/capwap_element_imagedata.c index 7104402..2318328 100644 --- a/src/common/capwap_element_imagedata.c +++ b/src/common/capwap_element_imagedata.c @@ -66,7 +66,7 @@ static void* capwap_imagedata_element_parsing(capwap_message_elements_handle han length = func->read_ready(handle); if (length < 1) { - capwap_logging_debug("Invalid Image Data element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Image Data element: underbuffer"); return NULL; } @@ -80,15 +80,15 @@ static void* capwap_imagedata_element_parsing(capwap_message_elements_handle han 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)) { 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; } else if ((data->type == CAPWAP_IMAGEDATA_TYPE_ERROR) && (length > 0)) { 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; } else if (length > CAPWAP_IMAGEDATA_DATA_MAX_LENGTH) { 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; } diff --git a/src/common/capwap_element_imageidentifier.c b/src/common/capwap_element_imageidentifier.c index 085bcfc..f3d65a0 100644 --- a/src/common/capwap_element_imageidentifier.c +++ b/src/common/capwap_element_imageidentifier.c @@ -66,13 +66,13 @@ static void* capwap_imageidentifier_element_parsing(capwap_message_elements_hand length = func->read_ready(handle); if (length < 5) { - capwap_logging_debug("Invalid Image Indentifier element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Image Indentifier element: underbuffer"); return NULL; } length -= 4; 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; } diff --git a/src/common/capwap_element_imageinfo.c b/src/common/capwap_element_imageinfo.c index 7372c99..3f3ebd6 100644 --- a/src/common/capwap_element_imageinfo.c +++ b/src/common/capwap_element_imageinfo.c @@ -55,7 +55,7 @@ static void* capwap_imageinfo_element_parsing(capwap_message_elements_handle han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_initdownload.c b/src/common/capwap_element_initdownload.c index 85188e7..5982c53 100644 --- a/src/common/capwap_element_initdownload.c +++ b/src/common/capwap_element_initdownload.c @@ -21,7 +21,7 @@ static void* capwap_initdownload_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); if (func->read_ready(handle) != 0) { - capwap_logging_debug("Invalid Initiate Download element"); + log_printf(LOG_DEBUG, "Invalid Initiate Download element"); return NULL; } diff --git a/src/common/capwap_element_localipv4.c b/src/common/capwap_element_localipv4.c index 0cc2d24..e7d6a37 100644 --- a/src/common/capwap_element_localipv4.c +++ b/src/common/capwap_element_localipv4.c @@ -33,7 +33,7 @@ static void* capwap_localipv4_element_parsing(capwap_message_elements_handle han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_localipv6.c b/src/common/capwap_element_localipv6.c index 574cd16..7c3e9a6 100644 --- a/src/common/capwap_element_localipv6.c +++ b/src/common/capwap_element_localipv6.c @@ -38,7 +38,7 @@ static void* capwap_localipv6_element_parsing(capwap_message_elements_handle han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_location.c b/src/common/capwap_element_location.c index 2484d01..2de8edb 100644 --- a/src/common/capwap_element_location.c +++ b/src/common/capwap_element_location.c @@ -63,7 +63,7 @@ static void* capwap_location_element_parsing(capwap_message_elements_handle hand length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_maximumlength.c b/src/common/capwap_element_maximumlength.c index 82aae76..4cfeadb 100644 --- a/src/common/capwap_element_maximumlength.c +++ b/src/common/capwap_element_maximumlength.c @@ -33,7 +33,7 @@ static void* capwap_maximumlength_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_mtudiscovery.c b/src/common/capwap_element_mtudiscovery.c index 80fd053..f5fa080 100644 --- a/src/common/capwap_element_mtudiscovery.c +++ b/src/common/capwap_element_mtudiscovery.c @@ -40,7 +40,7 @@ static void* capwap_mtudiscovery_element_parsing(capwap_message_elements_handle length = func->read_ready(handle); if (length > 0) { - capwap_logging_debug("Invalid MTU Discovery Padding element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid MTU Discovery Padding element: underbuffer"); return NULL; } diff --git a/src/common/capwap_element_radioadmstate.c b/src/common/capwap_element_radioadmstate.c index 170970e..9aed6a1 100644 --- a/src/common/capwap_element_radioadmstate.c +++ b/src/common/capwap_element_radioadmstate.c @@ -50,7 +50,7 @@ static void* capwap_radioadmstate_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -61,11 +61,11 @@ static void* capwap_radioadmstate_element_parsing(capwap_message_elements_handle if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if ((data->state != CAPWAP_RADIO_ADMIN_STATE_ENABLED) && (data->state != CAPWAP_RADIO_ADMIN_STATE_DISABLED)) { 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; } diff --git a/src/common/capwap_element_radiooprstate.c b/src/common/capwap_element_radiooprstate.c index 141f96e..9c0b1cb 100644 --- a/src/common/capwap_element_radiooprstate.c +++ b/src/common/capwap_element_radiooprstate.c @@ -53,7 +53,7 @@ static void* capwap_radiooprstate_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -65,18 +65,18 @@ static void* capwap_radiooprstate_element_parsing(capwap_message_elements_handle if (!IS_VALID_RADIOID(data->radioid)) { 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; } else if ((data->state != CAPWAP_RADIO_OPERATIONAL_STATE_ENABLED) && (data->state != CAPWAP_RADIO_OPERATIONAL_STATE_DISABLED)) { 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; } else if ((data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_NORMAL) && (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_RADIOFAILURE) && (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_SOFTWAREFAILURE) && (data->cause != CAPWAP_RADIO_OPERATIONAL_CAUSE_ADMINSET)) { 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; } diff --git a/src/common/capwap_element_resultcode.c b/src/common/capwap_element_resultcode.c index aca6053..6b20e4d 100644 --- a/src/common/capwap_element_resultcode.c +++ b/src/common/capwap_element_resultcode.c @@ -48,7 +48,7 @@ static void* capwap_resultcode_element_parsing(capwap_message_elements_handle ha ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_resultcode_element_parsing(capwap_message_elements_handle ha func->read_u32(handle, &data->code); if ((data->code < CAPWAP_RESULTCODE_FIRST) || (data->code > CAPWAP_RESULTCODE_LAST)) { 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; } diff --git a/src/common/capwap_element_returnedmessage.c b/src/common/capwap_element_returnedmessage.c index e9b8449..440c066 100644 --- a/src/common/capwap_element_returnedmessage.c +++ b/src/common/capwap_element_returnedmessage.c @@ -66,13 +66,13 @@ static void* capwap_returnedmessage_element_parsing(capwap_message_elements_hand length = func->read_ready(handle); if (length < 6) { - capwap_logging_debug("Invalid Returned Message element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Returned Message element: underbuffer"); return NULL; } length -= 2; 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; } @@ -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_UNSUPPORTED_MESSAGE_ELEMENT_VALUE)) { 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; } else if (data->length != length) { 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; } diff --git a/src/common/capwap_element_sessionid.c b/src/common/capwap_element_sessionid.c index bd2b811..c581724 100644 --- a/src/common/capwap_element_sessionid.c +++ b/src/common/capwap_element_sessionid.c @@ -65,7 +65,7 @@ static void* capwap_sessionid_element_parsing(capwap_message_elements_handle han ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_statisticstimer.c b/src/common/capwap_element_statisticstimer.c index be72d80..d7d66d6 100644 --- a/src/common/capwap_element_statisticstimer.c +++ b/src/common/capwap_element_statisticstimer.c @@ -33,7 +33,7 @@ static void* capwap_statisticstimer_element_parsing(capwap_message_elements_hand ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_timers.c b/src/common/capwap_element_timers.c index ee0567f..b8fdb07 100644 --- a/src/common/capwap_element_timers.c +++ b/src/common/capwap_element_timers.c @@ -34,7 +34,7 @@ static void* capwap_timers_element_parsing(capwap_message_elements_handle handle ASSERT(func != NULL); if (func->read_ready(handle) != 2) { - capwap_logging_debug("Invalid Timers element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Timers element: underbuffer"); return NULL; } diff --git a/src/common/capwap_element_transport.c b/src/common/capwap_element_transport.c index fe5b268..8f133e8 100644 --- a/src/common/capwap_element_transport.c +++ b/src/common/capwap_element_transport.c @@ -48,7 +48,7 @@ static void* capwap_transport_element_parsing(capwap_message_elements_handle han ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_transport_element_parsing(capwap_message_elements_handle han func->read_u8(handle, &data->type); if ((data->type != CAPWAP_UDPLITE_TRANSPORT) && (data->type != CAPWAP_UDP_TRANSPORT)) { 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; } diff --git a/src/common/capwap_element_vendorpayload.c b/src/common/capwap_element_vendorpayload.c index d05a879..bcf1b98 100644 --- a/src/common/capwap_element_vendorpayload.c +++ b/src/common/capwap_element_vendorpayload.c @@ -84,13 +84,13 @@ capwap_vendorpayload_element_parsing(capwap_message_elements_handle handle, length = func->read_ready(handle); if (length < 7) { - capwap_logging_debug("Invalid Vendor Specific Payload element: underbuffer"); + log_printf(LOG_DEBUG, "Invalid Vendor Specific Payload element: underbuffer"); return NULL; } length -= 6; 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; } diff --git a/src/common/capwap_element_wtpboarddata.c b/src/common/capwap_element_wtpboarddata.c index 665c7da..077ba9c 100644 --- a/src/common/capwap_element_wtpboarddata.c +++ b/src/common/capwap_element_wtpboarddata.c @@ -103,7 +103,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -115,7 +115,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle func->read_u32(handle, &data->vendor); if (!data->vendor) { 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; } @@ -129,7 +129,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle func->read_u16(handle, &desc->length); 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); return NULL; } @@ -137,7 +137,7 @@ static void* capwap_wtpboarddata_element_parsing(capwap_message_elements_handle /* Check buffer size */ length = func->read_ready(handle); 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); return NULL; } diff --git a/src/common/capwap_element_wtpdescriptor.c b/src/common/capwap_element_wtpdescriptor.c index 154123b..19a1cb5 100644 --- a/src/common/capwap_element_wtpdescriptor.c +++ b/src/common/capwap_element_wtpdescriptor.c @@ -138,7 +138,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -155,11 +155,11 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle /* Check */ if (!encryptlength) { 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; } else if (data->maxradios < data->radiosinuse) { 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; } @@ -169,7 +169,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle /* Check */ 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); 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) { 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; } } @@ -194,7 +194,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle /* Check */ 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); return NULL; } @@ -206,7 +206,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle func->read_u16(handle, &lengthdesc); 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); return NULL; } @@ -214,7 +214,7 @@ static void* capwap_wtpdescriptor_element_parsing(capwap_message_elements_handle /* Check buffer size */ length = func->read_ready(handle); 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); return NULL; } diff --git a/src/common/capwap_element_wtpfallback.c b/src/common/capwap_element_wtpfallback.c index 2c7f867..fce872f 100644 --- a/src/common/capwap_element_wtpfallback.c +++ b/src/common/capwap_element_wtpfallback.c @@ -48,7 +48,7 @@ static void* capwap_wtpfallback_element_parsing(capwap_message_elements_handle h ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_wtpfallback_element_parsing(capwap_message_elements_handle h func->read_u8(handle, &data->mode); if ((data->mode != CAPWAP_WTP_FALLBACK_ENABLED) && (data->mode != CAPWAP_WTP_FALLBACK_DISABLED)) { 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; } diff --git a/src/common/capwap_element_wtpframetunnelmode.c b/src/common/capwap_element_wtpframetunnelmode.c index 63b78ab..25a6f6b 100644 --- a/src/common/capwap_element_wtpframetunnelmode.c +++ b/src/common/capwap_element_wtpframetunnelmode.c @@ -48,7 +48,7 @@ static void* capwap_wtpframetunnelmode_element_parsing(capwap_message_elements_h ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_wtpframetunnelmode_element_parsing(capwap_message_elements_h func->read_u8(handle, &data->mode); if ((data->mode & CAPWAP_WTP_FRAME_TUNNEL_MODE_MASK) != data->mode) { 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; } diff --git a/src/common/capwap_element_wtpmactype.c b/src/common/capwap_element_wtpmactype.c index d8b84dd..da5e687 100644 --- a/src/common/capwap_element_wtpmactype.c +++ b/src/common/capwap_element_wtpmactype.c @@ -48,7 +48,7 @@ static void* capwap_wtpmactype_element_parsing(capwap_message_elements_handle ha ASSERT(func != NULL); 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; } @@ -57,7 +57,7 @@ static void* capwap_wtpmactype_element_parsing(capwap_message_elements_handle ha func->read_u8(handle, &data->type); if ((data->type != CAPWAP_LOCALMAC) && (data->type != CAPWAP_SPLITMAC) && (data->type != CAPWAP_LOCALANDSPLITMAC)) { 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; } diff --git a/src/common/capwap_element_wtpname.c b/src/common/capwap_element_wtpname.c index 1843db1..72b2026 100644 --- a/src/common/capwap_element_wtpname.c +++ b/src/common/capwap_element_wtpname.c @@ -38,7 +38,7 @@ static void* capwap_wtpname_element_parsing(capwap_message_elements_handle handl length = func->read_ready(handle); 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; } diff --git a/src/common/capwap_element_wtpradiostat.c b/src/common/capwap_element_wtpradiostat.c index edfaea6..c7e9236 100644 --- a/src/common/capwap_element_wtpradiostat.c +++ b/src/common/capwap_element_wtpradiostat.c @@ -66,7 +66,7 @@ static void* capwap_wtpradiostat_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } @@ -75,7 +75,7 @@ static void* capwap_wtpradiostat_element_parsing(capwap_message_elements_handle func->read_u8(handle, &data->radioid); if (!IS_VALID_RADIOID(data->radioid)) { 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; } diff --git a/src/common/capwap_element_wtprebootstat.c b/src/common/capwap_element_wtprebootstat.c index 142bf3e..ce4eea1 100644 --- a/src/common/capwap_element_wtprebootstat.c +++ b/src/common/capwap_element_wtprebootstat.c @@ -46,7 +46,7 @@ static void* capwap_wtprebootstat_element_parsing(capwap_message_elements_handle ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_element_wtpstaticipaddress.c b/src/common/capwap_element_wtpstaticipaddress.c index c07f0ad..b807e11 100644 --- a/src/common/capwap_element_wtpstaticipaddress.c +++ b/src/common/capwap_element_wtpstaticipaddress.c @@ -42,7 +42,7 @@ static void* capwap_wtpstaticipaddress_element_parsing(capwap_message_elements_h ASSERT(func != NULL); 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; } diff --git a/src/common/capwap_lock.c b/src/common/capwap_lock.c index a63bbd3..1cccbde 100644 --- a/src/common/capwap_lock.c +++ b/src/common/capwap_lock.c @@ -29,10 +29,10 @@ void capwap_lock_destroy_debug(capwap_lock_t* lock, const char* file, const int if (!res) { pthread_mutex_unlock(&lock->mutex); } 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(); } 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(); } @@ -57,7 +57,7 @@ void capwap_lock_enter_debug(capwap_lock_t* lock, const char* file, const int li waittime = time(NULL) - starttime; if (!(waittime % 5) && (waittime > lasttime)) { 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(); } @@ -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)) { - capwap_logging_debug("Error releasing mutex '%s' (%d)", file, line); + log_printf(LOG_DEBUG, "Error releasing mutex '%s' (%d)", file, line); capwap_backtrace_callstack(); } } diff --git a/src/common/capwap_logging.c b/src/common/capwap_logging.c index 0aa8413..7a91055 100644 --- a/src/common/capwap_logging.c +++ b/src/common/capwap_logging.c @@ -107,7 +107,7 @@ void capwap_logging_disable_console(void) { /* */ #ifdef ENABLE_LOGGING -void capwap_logging_printf(int level, const char* format, ...) +void __log_printf(int level, const char* format, ...) { int errsv = errno; va_list args; @@ -141,7 +141,7 @@ void capwap_logging_printf(int level, const char* format, ...) 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; char prefix[256]; diff --git a/src/common/capwap_logging.h b/src/common/capwap_logging.h index bce83d0..9d0ab0b 100644 --- a/src/common/capwap_logging.h +++ b/src/common/capwap_logging.h @@ -20,32 +20,35 @@ void capwap_logging_disable_console(void); /* */ #ifdef ENABLE_LOGGING -void log_printf(int level, const char *format, ...) +void __log_printf(int level, const char *format, ...) __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 #define log_printf(l, f, args...) do { } while (0) #define log_hexdump(l, t, d, len) do { } while (0) #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__ */ diff --git a/src/common/capwap_network.c b/src/common/capwap_network.c index 19e7e69..1f94a2d 100644 --- a/src/common/capwap_network.c +++ b/src/common/capwap_network.c @@ -24,13 +24,13 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi #ifdef IP_PKTINFO flag = 1; 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; } #elif defined IP_RECVDSTADDR flag = 1; 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; } #else @@ -39,7 +39,7 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi } else if (socketfamily == AF_INET6) { flag = 1; 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; } } @@ -47,21 +47,21 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi /* Reuse address */ flag = 1; 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; } /* Broadcast */ flag = 1; 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; } /* Bind to interface */ if ((bindinterface != NULL) && (bindinterface[0] != 0)) { 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; } } @@ -70,7 +70,7 @@ static int capwap_configure_socket(int sock, int socketfamily, const char* bindi if (socketfamily == AF_INET) { flag = 1; 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; } } @@ -269,14 +269,14 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len, if (r < 0) { 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; } /* Check if IPv4 is mapped into IPv6 */ if (fromaddr->ss.ss_family == AF_INET6) { 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; } } @@ -306,7 +306,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len, /* Check if IPv4 is mapped into IPv6 */ if (fromaddr->ss.ss_family == AF_INET) { 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; } } @@ -320,7 +320,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len, { char strfromaddr[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), (int)CAPWAP_GET_NETWORK_PORT(fromaddr), 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 { result = sendto(sock, buffer, size, 0, &toaddr->sa, sizeof(union sockaddr_capwap)); 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; } 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; } } while (result < 0); @@ -384,7 +384,7 @@ int capwap_sendto(int sock, void* buffer, int size, union sockaddr_capwap* toadd #ifdef DEBUG { 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 @@ -408,7 +408,7 @@ int capwap_sendto_fragmentpacket(int sock, struct capwap_list* fragmentlist, uni err = capwap_sendto(sock, fragmentpacket->buffer, fragmentpacket->offset, toaddr); 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; } diff --git a/src/common/capwap_protocol.c b/src/common/capwap_protocol.c index c48f11f..a38e325 100644 --- a/src/common/capwap_protocol.c +++ b/src/common/capwap_protocol.c @@ -459,7 +459,7 @@ struct capwap_packet_txmng* capwap_packet_txmng_create_ctrl_message(struct capwa /* Check MTU */ 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; } @@ -618,7 +618,7 @@ static int capwap_fragment_read_block_from_pos(uint8_t* data, unsigned short len if (!readpos->item) { readpos->pos = 0; 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 { 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 */ 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; } @@ -770,7 +770,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket, headersearch = (struct capwap_header*)packetsearch->buffer; 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; } } @@ -794,12 +794,12 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket, } else { /* Check duplicate packet */ 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; } 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; } @@ -831,7 +831,7 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket, return CAPWAP_REQUEST_MORE_FRAGMENT; } else if (sanityfragoffset > fragoffsetsearch) { capwap_list_flush(rxmngpacket->fragmentlist); - capwap_logging_debug("Wrong fragment offset"); + log_printf(LOG_DEBUG, "Wrong fragment offset"); 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 */ if (rxmngpacket->fragmentlist->count > 0) { /* 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; } else { struct capwap_header* header; diff --git a/src/common/capwap_socket.c b/src/common/capwap_socket.c index 00156e1..c5b2fbd 100644 --- a/src/common/capwap_socket.c +++ b/src/common/capwap_socket.c @@ -99,27 +99,27 @@ void* capwap_socket_crypto_createcontext(char* calist, char* cert, char* private if (context) { /* Public certificate */ 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); return NULL; } /* Private key */ 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); return NULL; } 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); return NULL; } /* Certificate Authority */ 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); return NULL; } @@ -129,7 +129,7 @@ void* capwap_socket_crypto_createcontext(char* calist, char* cert, char* private /* Set only high security cipher list */ 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); return NULL; } diff --git a/src/common/capwap_timeout.c b/src/common/capwap_timeout.c index cad8be5..642cab7 100644 --- a/src/common/capwap_timeout.c +++ b/src/common/capwap_timeout.c @@ -135,7 +135,7 @@ unsigned long capwap_timeout_createtimer(struct capwap_timeout* timeout) { index = capwap_timeout_set_bitfield(timeout); #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG - capwap_logging_debug("Create new timer: %lu", index); + log_printf(LOG_DEBUG, "Create new timer: %lu", index); #endif return index; @@ -147,7 +147,7 @@ void capwap_timeout_deletetimer(struct capwap_timeout* timeout, unsigned long in if (index != CAPWAP_TIMEOUT_INDEX_NO_SET) { #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG - capwap_logging_debug("Delete timer: %lu", index); + log_printf(LOG_DEBUG, "Delete timer: %lu", index); #endif /* Unset timeout timer */ @@ -187,7 +187,7 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i item->param = param; #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 /* Add itemlist into order list */ @@ -209,7 +209,7 @@ unsigned long capwap_timeout_set(struct capwap_timeout* timeout, unsigned long i item->param = param; #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 /* 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); if (itemlist) { #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG - capwap_logging_debug("Unset timeout: %lu", index); + log_printf(LOG_DEBUG, "Unset timeout: %lu", index); #endif /* */ @@ -307,7 +307,7 @@ unsigned long capwap_timeout_hasexpired(struct capwap_timeout* timeout) { item = (struct capwap_timeout_item*)itemlist->item; #ifdef CAPWAP_TIMEOUT_LOGGING_DEBUG - capwap_logging_debug("Expired timeout: %lu", item->index); + log_printf(LOG_DEBUG, "Expired timeout: %lu", item->index); #endif /* Cache callback before release timeout timer */ diff --git a/src/wtp/binding/ieee80211/wifi_drivers.c b/src/wtp/binding/ieee80211/wifi_drivers.c index bbebf6c..fa3076c 100644 --- a/src/wtp/binding/ieee80211/wifi_drivers.c +++ b/src/wtp/binding/ieee80211/wifi_drivers.c @@ -53,19 +53,19 @@ static void wifi_wlan_getrates(struct wifi_device* device, /* Retrieve capability */ capability = wifi_device_getcapability(device); if (!capability) { - capwap_logging_debug("getrates: getcapability failed"); + log_printf(LOG_DEBUG, "getrates: getcapability failed"); return; } /* Get radio type for basic rate */ radiotype = wifi_frequency_to_radiotype(device->currentfrequency.frequency); if (radiotype < 0) { - capwap_logging_debug("getrates: no radiotype for freq %d", device->currentfrequency.frequency); + log_printf(LOG_DEBUG, "getrates: no radiotype for freq %d", device->currentfrequency.frequency); return; } - capwap_logging_debug("getrates: radiotype %d, freq: %d", radiotype, device->currentfrequency.frequency); + log_printf(LOG_DEBUG, "getrates: radiotype %d, freq: %d", radiotype, device->currentfrequency.frequency); - capwap_logging_debug("getrates: Band %d", device->currentfrequency.band); + log_printf(LOG_DEBUG, "getrates: Band %d", device->currentfrequency.band); /* Check type of rate mode */ for (i = 0; i < ratescount; i++) { @@ -86,7 +86,7 @@ static void wifi_wlan_getrates(struct wifi_device* device, } } - capwap_logging_debug("getrates: Mode %d", mode); + log_printf(LOG_DEBUG, "getrates: Mode %d", mode); #if 0 /* WTF: the AC should know what it's doing and set those rate when it want's them */ @@ -102,14 +102,14 @@ static void wifi_wlan_getrates(struct wifi_device* device, } #endif - capwap_logging_debug("getrates: Bands Count %lu", capability->bands->count); + log_printf(LOG_DEBUG, "getrates: Bands Count %lu", capability->bands->count); /* Filter band */ for (i = 0; i < capability->bands->count; i++) { struct wifi_band_capability* bandcap = (struct wifi_band_capability*)capwap_array_get_item_pointer(capability->bands, i); - capwap_logging_debug("getrates: Bandcap Band %lu", bandcap->band); + log_printf(LOG_DEBUG, "getrates: Bandcap Band %lu", bandcap->band); if (bandcap->band != device->currentfrequency.band) continue; @@ -166,7 +166,7 @@ static void wifi_wlan_getrates(struct wifi_device* device, } for (i = 0; i < device_params->basicratescount; i++) { - capwap_logging_debug("getrates: Basic Rate %d: %d", i, device_params->basicrates[i]); + log_printf(LOG_DEBUG, "getrates: Basic Rate %d: %d", i, device_params->basicrates[i]); } for (i = 0; i < device_params->supportedratescount; i++) { log_printf(LOG_DEBUG, "getrates: Supported Rate %d: %.1f Mbit (%d)", @@ -199,7 +199,7 @@ static void wifi_hash_station_free(void* data) { ASSERT(data != NULL); /* */ - capwap_logging_info("Destroy station: %s", station->addrtext); + log_printf(LOG_INFO, "Destroy station: %s", station->addrtext); capwap_free(station); } @@ -282,7 +282,7 @@ static void wifi_station_delete(struct wifi_station* station) ASSERT(station != NULL); /* */ - capwap_logging_info("Delete station: %s", station->addrtext); + log_printf(LOG_INFO, "Delete station: %s", station->addrtext); /* */ wifi_station_clean(station); @@ -309,23 +309,23 @@ static struct wifi_station* wifi_station_create(struct wifi_wlan* wlan, const ui station = wifi_station_get(NULL, address); if (station) { if (station->wlan && (station->wlan != wlan)) { - capwap_logging_info("Roaming station: %s", buffer); + log_printf(LOG_INFO, "Roaming station: %s", buffer); wifi_wlan_deauthentication_station(station->wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 1); } else { - capwap_logging_info("Reuse station: %s", buffer); + log_printf(LOG_INFO, "Reuse station: %s", buffer); wifi_station_clean(station); } } /* Checks if it has reached the maximum number of stations */ if (wlan->stationscount >= wlan->maxstationscount) { - capwap_logging_warning("Unable create station: reached the maximum number of stations"); + log_printf(LOG_WARNING, "Unable create station: reached the maximum number of stations"); return NULL; } /* Create new station */ if (!station) { - capwap_logging_info("Create new station: %s", buffer); + log_printf(LOG_INFO, "Create new station: %s", buffer); /* */ station = (struct wifi_station*)capwap_alloc(sizeof(struct wifi_station)); @@ -364,15 +364,15 @@ static void wifi_wlan_send_mgmt_deauthentication(struct wifi_wlan* wlan, const u responselength = ieee80211_create_deauthentication(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), &ieee80211_params); if (responselength > 0) { if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) { - capwap_logging_info("Sent IEEE802.11 Deuthentication to %s station", stationaddress); + log_printf(LOG_INFO, "Sent IEEE802.11 Deuthentication to %s station", stationaddress); /* Forwards the station deauthentication also to AC */ wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0); } else { - capwap_logging_warning("Unable to send IEEE802.11 Deuthentication to %s station", stationaddress); + log_printf(LOG_WARNING, "Unable to send IEEE802.11 Deuthentication to %s station", stationaddress); } } else { - capwap_logging_warning("Unable to create IEEE802.11 Deauthentication to %s station", stationaddress); + log_printf(LOG_WARNING, "Unable to create IEEE802.11 Deauthentication to %s station", stationaddress); } } @@ -415,7 +415,7 @@ static void wifi_station_timeout_deauth(EV_P_ ev_timer *w, int revents) (((char *)w) - offsetof(struct wifi_station, timeout)); struct wifi_wlan* wlan = (struct wifi_wlan *)w->data; - capwap_logging_warning("The %s station has not completed the association in time", + log_printf(LOG_WARNING, "The %s station has not completed the association in time", station->addrtext); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0); } @@ -483,7 +483,7 @@ static void wifi_wlan_receive_station_mgmt_probe_request(struct wifi_wlan* wlan, wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate); } } else { - capwap_logging_warning("Unable to send IEEE802.11 Probe Response"); + log_printf(LOG_WARNING, "Unable to send IEEE802.11 Probe Response"); } } @@ -569,13 +569,13 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan /* Information Elements packet length */ ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->authetication)); if (ielength < 0) { - capwap_logging_info("Receive invalid IEEE802.11 Authentication Request"); + log_printf(LOG_INFO, "Receive invalid IEEE802.11 Authentication Request"); return; } /* Ignore authentication packet from same AP */ if (!memcmp(frame->sa, wlan->address, MACADDRESS_EUI48_LENGTH)) { - capwap_logging_info("Ignore IEEE802.11 Authentication Request from same AP"); + log_printf(LOG_INFO, "Ignore IEEE802.11 Authentication Request from same AP"); return; } @@ -585,18 +585,18 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan /* Get ACL Station */ acl = wtp_radio_acl_station(frame->sa); if (acl == WTP_RADIO_ACL_STATION_DENY) { - capwap_logging_info("Denied IEEE802.11 Authentication Request from %s station", stationaddress); + log_printf(LOG_INFO, "Denied IEEE802.11 Authentication Request from %s station", stationaddress); return; } /* Parsing Information Elements */ if (ieee80211_retrieve_information_elements_position(&ieitems, &frame->authetication.ie[0], ielength)) { - capwap_logging_info("Invalid IEEE802.11 Authentication Request from %s station", stationaddress); + log_printf(LOG_INFO, "Invalid IEEE802.11 Authentication Request from %s station", stationaddress); return; } /* */ - capwap_logging_info("Receive IEEE802.11 Authentication Request from %s station", stationaddress); + log_printf(LOG_INFO, "Receive IEEE802.11 Authentication Request from %s station", stationaddress); /* Create station reference */ station = wifi_station_create(wlan, frame->sa); @@ -644,7 +644,7 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan if (responselength > 0) { /* Send authentication response */ if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) { - capwap_logging_info("Sent IEEE802.11 Authentication Response to %s station with %d status code", stationaddress, (int)responsestatuscode); + log_printf(LOG_INFO, "Sent IEEE802.11 Authentication Response to %s station with %d status code", stationaddress, (int)responsestatuscode); /* Notify authentication request message also to AC */ wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate); @@ -652,11 +652,11 @@ static void wifi_wlan_receive_station_mgmt_authentication(struct wifi_wlan* wlan /* Forwards the authentication response message also to AC */ wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0); } else if (station) { - capwap_logging_warning("Unable to send IEEE802.11 Authentication Response to %s station", stationaddress); + log_printf(LOG_WARNING, "Unable to send IEEE802.11 Authentication Response to %s station", stationaddress); wifi_station_delete(station); } } else if (station) { - capwap_logging_warning("Unable to create IEEE802.11 Authentication Response to %s station", stationaddress); + log_printf(LOG_WARNING, "Unable to create IEEE802.11 Authentication Response to %s station", stationaddress); wifi_station_delete(station); } } else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) { @@ -676,7 +676,7 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* /* Information Elements packet length */ ielength = length - (sizeof(struct ieee80211_header) + sizeof(frame->associationrequest)); if (ielength < 0) { - capwap_logging_info("Receive invalid IEEE802.11 Association Request"); + log_printf(LOG_INFO, "Receive invalid IEEE802.11 Association Request"); return; } @@ -686,7 +686,7 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* char buffer[CAPWAP_MACADDRESS_EUI48_BUFFER]; /* Invalid station, send deauthentication message */ - capwap_logging_info("Receive IEEE802.11 Association Request from %s unknown station", capwap_printf_macaddress(buffer, frame->sa, MACADDRESS_EUI48_LENGTH)); + log_printf(LOG_INFO, "Receive IEEE802.11 Association Request from %s unknown station", capwap_printf_macaddress(buffer, frame->sa, MACADDRESS_EUI48_LENGTH)); wifi_wlan_send_mgmt_deauthentication(wlan, frame->sa, IEEE80211_REASON_CLASS2_FRAME_FROM_NONAUTH_STA); return; } @@ -694,20 +694,20 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* /* */ if (!(station->flags & WIFI_STATION_FLAGS_AUTHENTICATED)) { /* Invalid station, send deauthentication message */ - 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); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_CLASS2_FRAME_FROM_NONAUTH_STA, 0); return; } /* Parsing Information Elements */ if (ieee80211_retrieve_information_elements_position(&ieitems, &frame->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); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0); return; } /* */ - 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); if (ieitems.wmm_ie != NULL && ieitems.wmm_ie->version == 1) { station->flags |= WIFI_STATION_FLAGS_WMM; @@ -750,7 +750,7 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* responselength = ieee80211_create_associationresponse_response(g_bufferIEEE80211, sizeof(g_bufferIEEE80211), ¶ms); if (responselength > 0) { if (!wlan->device->instance->ops->wlan_sendframe(wlan, g_bufferIEEE80211, responselength, wlan->device->currentfrequency.frequency, 0, 0, 0, 0)) { - 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); /* Notify association request message also to AC */ wifi_wlan_send_frame(wlan, (uint8_t*)frame, length, rssi, snr, rate); @@ -758,11 +758,11 @@ static void wifi_wlan_receive_station_mgmt_association_request(struct wifi_wlan* /* Forwards the association response message also to AC */ wifi_wlan_send_frame(wlan, (uint8_t*)g_bufferIEEE80211, responselength, 0, 0, 0); } else { - 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); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0); } } 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); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0); } } else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) { @@ -903,7 +903,7 @@ static void wifi_wlan_receive_station_mgmt_authentication_ack(struct wifi_wlan* /* Check if authenticate */ if ((algorithm == IEEE80211_AUTHENTICATION_ALGORITHM_OPEN) && (transactionseqnumber == 2)) { - capwap_logging_info("IEEE802.11 Authentication complete to %s station", station->addrtext); + log_printf(LOG_INFO, "IEEE802.11 Authentication complete to %s station", station->addrtext); station->flags |= WIFI_STATION_FLAGS_AUTHENTICATED; } else if ((algorithm == IEEE80211_AUTHENTICATION_ALGORITHM_SHARED_KEY) && (transactionseqnumber == 4)) { /* TODO */ @@ -930,7 +930,7 @@ static void wifi_wlan_receive_station_mgmt_association_response_ack(struct wifi_ /* */ statuscode = __le16_to_cpu(frame->associationresponse.statuscode); if (statuscode == IEEE80211_STATUS_SUCCESS) { - capwap_logging_info("IEEE802.11 Association complete to %s station", station->addrtext); + log_printf(LOG_INFO, "IEEE802.11 Association complete to %s station", station->addrtext); /* */ station->flags |= WIFI_STATION_FLAGS_ASSOCIATE; @@ -1018,7 +1018,7 @@ static int wifi_wlan_receive_ac_mgmt_association_response(struct wifi_wlan* wlan if (station) { if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_LOCAL) { if (frame->associationresponse.statuscode != IEEE80211_STATUS_SUCCESS) { - capwap_logging_info("AC request deauthentication of station: %s", station->addrtext); + log_printf(LOG_INFO, "AC request deauthentication of station: %s", station->addrtext); wifi_wlan_deauthentication_station(wlan, station, IEEE80211_REASON_PREV_AUTH_NOT_VALID, 0); } } else if (wlan->macmode == CAPWAP_ADD_WLAN_MACMODE_SPLIT) { @@ -1287,7 +1287,7 @@ struct wifi_device* wifi_device_connect(const char* ifname, const char* driver) /* Check */ length = strlen(ifname); if ((length <= 0) || (length >= IFNAMSIZ)) { - capwap_logging_warning("Wifi device name error: %s", ifname); + log_printf(LOG_WARNING, "Wifi device name error: %s", ifname); return NULL; } @@ -1457,10 +1457,10 @@ int wifi_device_updaterates(struct wifi_device* device, uint8_t* rates, int rate /* */ wifi_wlan_getrates(device, rates, ratescount, &buildrate); if (!buildrate.supportedratescount || (buildrate.supportedratescount > IEEE80211_SUPPORTEDRATE_MAX_COUNT)) { - capwap_logging_debug("update rates: supported rates failed, (%d .. %d)", buildrate.supportedratescount, IEEE80211_SUPPORTEDRATE_MAX_COUNT); + log_printf(LOG_DEBUG, "update rates: supported rates failed, (%d .. %d)", buildrate.supportedratescount, IEEE80211_SUPPORTEDRATE_MAX_COUNT); return -1; } else if (!buildrate.basicratescount || (buildrate.basicratescount > IEEE80211_SUPPORTEDRATE_MAX_COUNT)) { - capwap_logging_debug("update rates: basic rates failed: %d", buildrate.basicratescount); + log_printf(LOG_DEBUG, "update rates: basic rates failed: %d", buildrate.basicratescount); return -1; } @@ -1492,7 +1492,7 @@ struct wifi_wlan* wifi_wlan_create(struct wifi_device* device, const char* ifnam /* Check */ length = strlen(ifname); if ((length <= 0) || (length >= IFNAMSIZ)) { - capwap_logging_warning("Wifi device name error: %s", ifname); + log_printf(LOG_WARNING, "Wifi device name error: %s", ifname); return NULL; } @@ -1512,7 +1512,7 @@ struct wifi_wlan* wifi_wlan_create(struct wifi_device* device, const char* ifnam /* Create interface */ wlan->handle = device->instance->ops->wlan_create(device, wlan); if (!wlan->handle) { - capwap_logging_warning("Unable to create virtual interface: %s", ifname); + log_printf(LOG_WARNING, "Unable to create virtual interface: %s", ifname); wifi_wlan_destroy(wlan); return NULL; } @@ -1520,7 +1520,7 @@ struct wifi_wlan* wifi_wlan_create(struct wifi_device* device, const char* ifnam /* Interface info */ wlan->virtindex = wifi_iface_index(ifname); if (wifi_iface_hwaddr(g_wifiglobal.sock_util, wlan->virtname, wlan->address)) { - capwap_logging_warning("Unable to get macaddress: %s", ifname); + log_printf(LOG_WARNING, "Unable to get macaddress: %s", ifname); wifi_wlan_destroy(wlan); return NULL; } @@ -1652,7 +1652,7 @@ int wifi_wlan_startap(struct wifi_wlan* wlan, struct wlan_startap_params* params result = wlan->device->instance->ops->wlan_startap(wlan); if (!result) { wlan->device->wlanactive++; - capwap_logging_info("Configured interface: %s, SSID: '%s'", wlan->virtname, wlan->ssid); + log_printf(LOG_INFO, "Configured interface: %s, SSID: '%s'", wlan->virtname, wlan->ssid); } else { wifi_wlan_stopap(wlan); } @@ -1839,7 +1839,7 @@ int wifi_wlan_send_frame(struct wifi_wlan* wlan, const uint8_t* data, int length /* Send packet to AC */ result = wtp_kmod_send_data(wlan->radioid, data, length, rssi, snr, rate); if (result) { - capwap_logging_warning("Unable to sent packet to AC: %d error code", result); + log_printf(LOG_WARNING, "Unable to sent packet to AC: %d error code", result); } return result; diff --git a/src/wtp/binding/ieee80211/wifi_nl80211.c b/src/wtp/binding/ieee80211/wifi_nl80211.c index 136e8cf..119f3b1 100644 --- a/src/wtp/binding/ieee80211/wifi_nl80211.c +++ b/src/wtp/binding/ieee80211/wifi_nl80211.c @@ -222,7 +222,7 @@ static int nl80211_get_multicast_id(struct nl80211_global_handle* globalhandle, if (!result) { result = resource.id; } else { - capwap_logging_error("Unable get multicast id, error code: %d", result); + log_printf(LOG_ERR, "Unable get multicast id, error code: %d", result); } /* */ @@ -250,7 +250,7 @@ static int nl80211_wlan_set_type(struct wifi_wlan* wlan, uint32_t type) { /* */ result = nl80211_send_and_recv_msg(wlanhandle->devicehandle->globalhandle, msg, NULL, NULL); if (result) { - capwap_logging_error("Unable set type, error code: %d", result); + log_printf(LOG_ERR, "Unable set type, error code: %d", result); } /* */ @@ -293,7 +293,7 @@ static uint32_t nl80211_wlan_get_type(struct wifi_wlan* wlan) { /* */ result = nl80211_send_and_recv_msg(wlanhandle->devicehandle->globalhandle, msg, cb_get_type, &type); if (result) { - capwap_logging_error("Unable get type, error code: %d", result); + log_printf(LOG_ERR, "Unable get type, error code: %d", result); type = NL80211_IFTYPE_UNSPECIFIED; } @@ -365,9 +365,9 @@ static int nl80211_device_changefrequency(struct wifi_device* device, struct wif /* Set wifi frequency */ result = nl80211_send_and_recv_msg(devicehandle->globalhandle, msg, NULL, NULL); if (!result) { - capwap_logging_info("Change %s frequency %d", wlan->virtname, (int)freq->frequency); + log_printf(LOG_INFO, "Change %s frequency %d", wlan->virtname, (int)freq->frequency); } else { - capwap_logging_error("Unable set frequency %d, error code: %d", (int)freq->frequency, result); + log_printf(LOG_ERR, "Unable set frequency %d, error code: %d", (int)freq->frequency, result); } /* */ @@ -421,7 +421,7 @@ static int nl80211_wlan_event(struct wifi_wlan* wlan, struct genlmsghdr* gnlh, s } default: { - capwap_logging_debug("*** nl80211_wlan_event: %d", (int)gnlh->cmd); + log_printf(LOG_DEBUG, "*** nl80211_wlan_event: %d", (int)gnlh->cmd); break; } } @@ -483,7 +483,7 @@ static int nl80211_global_destroy_virtdevice(struct nl80211_global_handle* globa /* Destroy virtual device */ result = nl80211_send_and_recv_msg(globalhandle, msg, NULL, NULL); if (result) { - capwap_logging_error("Unable destroy interface, error code: %d", result); + log_printf(LOG_ERR, "Unable destroy interface, error code: %d", result); } /* */ @@ -543,13 +543,13 @@ static void nl80211_global_destroy_all_virtdevice(struct nl80211_global_handle* wifi_iface_down(globalhandle->sock_util, virtitem->virtname); result = nl80211_global_destroy_virtdevice(globalhandle, virtitem->virtindex); if (result) { - capwap_logging_error("Unable to destroy virtual device, error code: %d", result); + log_printf(LOG_ERR, "Unable to destroy virtual device, error code: %d", result); } } } } else { /* Error get virtual devices */ - capwap_logging_error("Unable retrieve virtual device info, error code: %d", result); + log_printf(LOG_ERR, "Unable retrieve virtual device info, error code: %d", result); } /* */ @@ -592,7 +592,7 @@ static wifi_wlan_handle nl80211_wlan_create(struct wifi_device* device, struct w /* Check interface */ if (result || !wifi_iface_index(wlan->virtname)) { - capwap_logging_error("Unable create interface %s, error code: %d", wlan->virtname, result); + log_printf(LOG_ERR, "Unable create interface %s, error code: %d", wlan->virtname, result); return NULL; } @@ -612,11 +612,11 @@ static void nl80211_global_event_receive_cb(EV_P_ ev_io *w, int revents) (((char *)w) - offsetof(struct nl80211_global_handle, nl_event_ev)); int res; - capwap_logging_warning("nl80211_global_event_receive_cb on fd %d", w->fd); + log_printf(LOG_WARNING, "nl80211_global_event_receive_cb on fd %d", w->fd); /* */ res = nl_recvmsgs(globalhandle->nl_event, globalhandle->nl_cb); if (res) { - capwap_logging_warning("Receive nl80211 message failed: %d", res); + log_printf(LOG_WARNING, "Receive nl80211 message failed: %d", res); } } @@ -626,11 +626,11 @@ static void nl80211_wlan_event_receive_cb(EV_P_ ev_io *w, int revents) (((char *)w) - offsetof(struct nl80211_wlan_handle, nl_ev)); int res; - capwap_logging_warning("nl80211_wlan_event_receive_cb on fd %d", w->fd); + log_printf(LOG_WARNING, "nl80211_wlan_event_receive_cb on fd %d", w->fd); /* */ res = nl_recvmsgs(wlanhandle->nl, wlanhandle->nl_cb); if (res) { - capwap_logging_warning("Receive nl80211 message failed: %d", res); + log_printf(LOG_WARNING, "Receive nl80211 message failed: %d", res); } } @@ -727,7 +727,7 @@ static int nl80211_wlan_setbeacon(struct wifi_wlan* wlan) { /* Start AP */ result = nl80211_send_and_recv_msg(wlanhandle->devicehandle->globalhandle, msg, NULL, NULL); if (result) { - capwap_logging_error("Unable set beacon, error code: %d", result); + log_printf(LOG_ERR, "Unable set beacon, error code: %d", result); } nlmsg_free(msg); @@ -767,7 +767,7 @@ static int nl80211_wlan_setbeacon(struct wifi_wlan* wlan) { if (!result) { wlan->flags |= WIFI_WLAN_SET_BEACON; } else { - capwap_logging_error("Unable set BSS, error code: %d", result); + log_printf(LOG_ERR, "Unable set BSS, error code: %d", result); } nlmsg_free(msg); @@ -809,7 +809,7 @@ static int nl80211_wlan_startap(struct wifi_wlan* wlan) { for (i = 0; i < sizeof(g_stypes) / sizeof(g_stypes[0]); i++) { result = nl80211_wlan_registerframe(wlan, (IEEE80211_FRAMECONTROL_TYPE_MGMT << 2) | (g_stypes[i] << 4), NULL, 0); if (result) { - capwap_logging_error("Unable to register frame %d, error code: %d", g_stypes[i], result); + log_printf(LOG_ERR, "Unable to register frame %d, error code: %d", g_stypes[i], result); return -1; } } @@ -820,9 +820,9 @@ static int nl80211_wlan_startap(struct wifi_wlan* wlan) { uint32_t flags = ((wlan->tunnelmode == CAPWAP_ADD_WLAN_TUNNELMODE_80211) ? WTP_KMOD_FLAGS_TUNNEL_NATIVE : WTP_KMOD_FLAGS_TUNNEL_8023); if (!wtp_kmod_join_mac80211_device(wlan, flags)) { - capwap_logging_info("Joined the interface %d in kernel mode ", wlan->virtindex); + log_printf(LOG_INFO, "Joined the interface %d in kernel mode ", wlan->virtindex); } else { - capwap_logging_error("Unable to join the interface %d in kernel mode ", wlan->virtindex); + log_printf(LOG_ERR, "Unable to join the interface %d in kernel mode ", wlan->virtindex); return -1; } } @@ -974,7 +974,7 @@ static int nl80211_wlan_sendframe(struct wifi_wlan* wlan, uint8_t* frame, int le cookie = 0; result = nl80211_send_and_recv_msg(wlanhandle->devicehandle->globalhandle, msg, cb_wlan_send_frame, &cookie); if (result) { - capwap_logging_error("Unable send frame, error code: %d", result); + log_printf(LOG_ERR, "Unable send frame, error code: %d", result); } nlmsg_free(msg); @@ -1092,13 +1092,13 @@ int nl80211_station_authorize(struct wifi_wlan* wlan, struct wifi_station* stati if (result == -EEXIST) { result = 0; } else { - capwap_logging_error("Unable to authorized station, error code: %d", result); + log_printf(LOG_ERR, "Unable to authorized station, error code: %d", result); } } /* */ if (!result) { - capwap_logging_info("Authorized station: %s", station->addrtext); + log_printf(LOG_INFO, "Authorized station: %s", station->addrtext); } /* */ @@ -1134,14 +1134,14 @@ int nl80211_station_deauthorize(struct wifi_wlan* wlan, const uint8_t* address) if (result == -ENOENT) { result = 0; } else { - capwap_logging_error("Unable delete station, error code: %d", result); + log_printf(LOG_ERR, "Unable delete station, error code: %d", result); } } /* */ if (!result) { char addrtext[CAPWAP_MACADDRESS_EUI48_BUFFER]; - capwap_logging_info("Deauthorize station: %s", capwap_printf_macaddress(addrtext, address, MACADDRESS_EUI48_LENGTH)); + log_printf(LOG_INFO, "Deauthorize station: %s", capwap_printf_macaddress(addrtext, address, MACADDRESS_EUI48_LENGTH)); } /* */ @@ -1214,7 +1214,7 @@ int nl80211_device_init(wifi_global_handle handle, struct wifi_device* device) { } } else { /* Error get physical devices */ - capwap_logging_error("Unable retrieve physical device info, error code: %d", result); + log_printf(LOG_ERR, "Unable retrieve physical device info, error code: %d", result); } /* */ @@ -1442,7 +1442,7 @@ static int cb_get_phydevice_capability(struct nl_msg* msg, void* data) { if (bandcap->band == WIFI_BAND_UNKNOWN) { bandcap->band = band; } else if (bandcap->band != band) { - capwap_logging_warning("Multiple wireless band into logical band"); + log_printf(LOG_WARNING, "Multiple wireless band into logical band"); } /* Retrieve frequency and channel */ @@ -1552,7 +1552,7 @@ static int nl80211_device_getcapability(struct wifi_device* device, struct wifi_ capability->device = device; result = nl80211_send_and_recv_msg(devicehandle->globalhandle, msg, cb_get_phydevice_capability, capability); if (result) { - capwap_logging_error("Unable retrieve physical device capability, error code: %d", result); + log_printf(LOG_ERR, "Unable retrieve physical device capability, error code: %d", result); } /* */ @@ -1573,7 +1573,7 @@ static void nl80211_device_updatebeacons(struct wifi_device* device) { wlan = (struct wifi_wlan*)wlansearch->item; if (wlan->flags & WIFI_WLAN_SET_BEACON) { if (nl80211_wlan_setbeacon(wlan)) { - capwap_logging_warning("Unable to update beacon on interface %d", wlan->virtindex); + log_printf(LOG_WARNING, "Unable to update beacon on interface %d", wlan->virtindex); wifi_wlan_stopap(wlan); } } @@ -1648,7 +1648,7 @@ static int nl80211_device_settxqueue(struct wifi_device* device, int queue, int result = nl80211_send_and_recv_msg(devicehandle->globalhandle, msg, NULL, NULL); if (result) - capwap_logging_error("Unable set TX Queue, error code: %d", result); + log_printf(LOG_ERR, "Unable set TX Queue, error code: %d", result); nlmsg_free(msg); return result; @@ -1837,7 +1837,7 @@ static wifi_global_handle nl80211_global_init() /* Get nl80211 netlink family */ globalhandle->nl80211_id = genl_ctrl_resolve(globalhandle->nl, "nl80211"); if (globalhandle->nl80211_id < 0) { - capwap_logging_warning("Unable to found mac80211 kernel module"); + log_printf(LOG_WARNING, "Unable to found mac80211 kernel module"); nl80211_global_deinit((wifi_global_handle)globalhandle); return NULL; } diff --git a/src/wtp/wtp.c b/src/wtp/wtp.c index 8df783d..6f565ca 100644 --- a/src/wtp/wtp.c +++ b/src/wtp/wtp.c @@ -208,67 +208,67 @@ static int wtp_parsing_radio_80211n_cfg(config_setting_t *elem, sect = config_setting_get_member(elem, "ieee80211n"); if (!sect) { - capwap_logging_error("application.radio.ieee80211n not found"); + log_printf(LOG_ERR, "application.radio.ieee80211n not found"); return 0; } radio->n_radio_cfg.radioid = radio->radioid; if (config_setting_lookup_bool(sect, "a-msdu", &boolval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.a-msdu not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.a-msdu not found or wrong type"); return 0; } if (boolval) radio->n_radio_cfg.flags |= CAPWAP_80211N_RADIO_CONF_A_MSDU; if (config_setting_lookup_bool(sect, "a-mpdu", &boolval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.a-mpdu not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.a-mpdu not found or wrong type"); return 0; } if (boolval) radio->n_radio_cfg.flags |= CAPWAP_80211N_RADIO_CONF_A_MPDU; if (config_setting_lookup_bool(sect, "require-ht", &boolval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.require-ht not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.require-ht not found or wrong type"); return 0; } if (boolval) radio->n_radio_cfg.flags |= CAPWAP_80211N_RADIO_CONF_11N_ONLY; if (config_setting_lookup_bool(sect, "short-gi", &boolval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.short-gi not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.short-gi not found or wrong type"); return 0; } if (boolval) radio->n_radio_cfg.flags |= CAPWAP_80211N_RADIO_CONF_SHORT_GUARD_INTERVAL; if (config_setting_lookup_bool(sect, "ht40", &boolval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.ht40 not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.ht40 not found or wrong type"); return 0; } if (!boolval) radio->n_radio_cfg.flags |= CAPWAP_80211N_RADIO_CONF_20MHZ_BANDWITH; if (config_setting_lookup_int(sect, "max-sup-mcs", &intval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.max-sup-mcs not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.max-sup-mcs not found or wrong type"); return 0; } radio->n_radio_cfg.maxsupmcs = intval; if (config_setting_lookup_int(sect, "max-mand-mcs", &intval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.max-mand-mcs not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.max-mand-mcs not found or wrong type"); return 0; } radio->n_radio_cfg.maxmandmcs = intval; if (config_setting_lookup_int(sect, "tx-antenna", &intval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.tx-antenna not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.tx-antenna not found or wrong type"); return 0; } radio->n_radio_cfg.txant = intval; if (config_setting_lookup_int(sect, "rx-antenna", &intval) != CONFIG_TRUE) { - capwap_logging_error("application.radio.ieee80211n.rx-antenna not found or wrong type"); + log_printf(LOG_ERR, "application.radio.ieee80211n.rx-antenna not found or wrong type"); return 0; } radio->n_radio_cfg.rxant = intval; @@ -559,7 +559,7 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti for (i = 0; i < count; i++) { if (!IS_VALID_RADIOID(g_wtp.radios->count + 1)) { - capwap_logging_error("Exceeded max number of radio device"); + log_printf(LOG_ERR, "Exceeded max number of radio device"); return 0; } @@ -569,12 +569,12 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti continue; if (config_setting_lookup_string(configElement, "device", &configString) != CONFIG_TRUE) { - capwap_logging_error("Invalid configuration file, element application.radio.device not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.radio.device not found"); return 0; } if (*configString && (strlen(configString) >= IFNAMSIZ)) { - capwap_logging_error("Invalid configuration file, application.radio.device string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.radio.device string length exceeded"); return 0; } @@ -588,7 +588,7 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti /* Retrieve radio capability */ if (wtp_parsing_radio_configuration(configElement, radio) == 0) { - capwap_logging_error("Invalid configuration file, application.radio"); + log_printf(LOG_ERR, "Invalid configuration file, application.radio"); return 0; } @@ -601,11 +601,11 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti radio->devicehandle = wifi_device_connect(radio->device, configString); if (!radio->devicehandle) { radio->status = WTP_RADIO_HWFAILURE; - capwap_logging_warning("Unable to register radio device: %s - %s", radio->device, configString); + log_printf(LOG_WARNING, "Unable to register radio device: %s - %s", radio->device, configString); } radio->status = WTP_RADIO_ENABLED; - capwap_logging_info("Register radioid %d with radio device: %s - %s", radio->radioid, radio->device, configString); + log_printf(LOG_INFO, "Register radioid %d with radio device: %s - %s", radio->radioid, radio->device, configString); /* Update radio capability with device query */ capability = wifi_device_getcapability(radio->devicehandle); @@ -621,7 +621,7 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti sprintf(wlanname, "%s%02d.%02d", radio->wlanprefix, (int)radio->radioid, (int)bssid + 1); if (wifi_iface_index(wlanname)) { - capwap_logging_error("interface %s already exists", wlanname); + log_printf(LOG_ERR, "interface %s already exists", wlanname); return 0; } @@ -631,11 +631,11 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti wlan->radio = radio; wlan->wlanhandle = wifi_wlan_create(radio->devicehandle, wlanname); if (!wlan->wlanhandle) { - capwap_logging_error("Unable to create interface: %s", wlanname); + log_printf(LOG_ERR, "Unable to create interface: %s", wlanname); return 0; } - capwap_logging_debug("Created wlan interface: %s", wlanname); + log_printf(LOG_DEBUG, "Created wlan interface: %s", wlanname); } } @@ -670,18 +670,18 @@ static int wtp_parsing_cfg_boardinfo_element(config_t *config) continue; if (config_setting_lookup_string(configElement, "name", &configName) != CONFIG_TRUE) { - capwap_logging_error("Invalid configuration file, element application.boardinfo.element.name not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.boardinfo.element.name not found"); return 0; } if (config_setting_lookup_string(configElement, "value", &configValue) != CONFIG_TRUE) { - capwap_logging_error("Invalid configuration file, element application.boardinfo.element.value not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.boardinfo.element.value not found"); return 0; } lengthValue = strlen(configValue); if (lengthValue >= CAPWAP_BOARD_SUBELEMENT_MAXDATA) { - capwap_logging_error("Invalid configuration file, application.boardinfo.element.value string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.boardinfo.element.value string length exceeded"); return 0; } @@ -707,7 +707,7 @@ static int wtp_parsing_cfg_boardinfo_element(config_t *config) const char* configType; if (config_setting_lookup_string(configElement, "type", &configType) != CONFIG_TRUE) { - capwap_logging_error("Invalid configuration file, element application.boardinfo.element.type not found"); + log_printf(LOG_ERR, "Invalid configuration file, element application.boardinfo.element.type not found"); return 0; } @@ -718,17 +718,17 @@ static int wtp_parsing_cfg_boardinfo_element(config_t *config) element->type = CAPWAP_BOARD_SUBELEMENT_MACADDRESS; element->length = capwap_get_macaddress_from_interface(configValue, macaddress); if (!element->length || ((element->length != MACADDRESS_EUI64_LENGTH) && (element->length != MACADDRESS_EUI48_LENGTH))) { - capwap_logging_error("Invalid configuration file, unable found macaddress of interface: '%s'", configValue); + log_printf(LOG_ERR, "Invalid configuration file, unable found macaddress of interface: '%s'", configValue); return 0; } element->data = (uint8_t*)capwap_clone((void*)macaddress, element->length); } else { - capwap_logging_error("Invalid configuration file, unknown application.boardinfo.element.type value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.boardinfo.element.type value"); return 0; } } else { - capwap_logging_error("Invalid configuration file, unknown application.boardinfo.element.name value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.boardinfo.element.name value"); return 0; } } @@ -761,23 +761,23 @@ static int wtp_parsing_cfg_descriptor_info(config_t *config) continue; if (config_setting_lookup_int(configElement, "idvendor", &configVendor) != CONFIG_TRUE) { - 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; } if (config_setting_lookup_string(configElement, "type", &configType) != CONFIG_TRUE) { - 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; } if (config_setting_lookup_string(configElement, "value", &configValue) != CONFIG_TRUE) { - 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; } lengthValue = strlen(configValue); if (lengthValue >= CAPWAP_WTPDESC_SUBELEMENT_MAXDATA) { - 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; } @@ -790,7 +790,7 @@ static int wtp_parsing_cfg_descriptor_info(config_t *config) } else if (!strcmp(configType, "other")) { type = CAPWAP_WTPDESC_SUBELEMENT_OTHERVERSION; } 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; } @@ -829,7 +829,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "debug")) { capwap_logging_verboselevel(LOG_DEBUG); } else { - capwap_logging_error("Invalid configuration file, unknown logging.level value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown logging.level value"); return 0; } } @@ -851,7 +851,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "stderr")) { capwap_logging_enable_console(1); } else { - capwap_logging_error("Invalid configuration file, unknown logging.output value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown logging.output value"); return 0; } } @@ -868,7 +868,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { /* Set name of WTP */ if (config_lookup_string(config, "application.name", &configString) == CONFIG_TRUE) { if (strlen(configString) > CAPWAP_WTPNAME_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; } @@ -879,7 +879,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { /* Set location of WTP */ if (config_lookup_string(config, "application.location", &configString) == CONFIG_TRUE) { if (strlen(configString) > CAPWAP_LOCATION_MAXLENGTH) { - capwap_logging_error("Invalid configuration file, application.location string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.location string length exceeded"); return 0; } @@ -894,7 +894,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "EPCGlobal")) { g_wtp.binding = CAPWAP_WIRELESS_BINDING_EPCGLOBAL; } else { - capwap_logging_error("Invalid configuration file, unknown application.binding value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.binding value"); return 0; } } @@ -907,9 +907,9 @@ static int wtp_parsing_configuration_1_0(config_t* config) { case CAPWAP_WIRELESS_BINDING_IEEE80211: { /* Initialize wifi binding driver */ - capwap_logging_info("Initializing wifi binding engine"); + log_printf(LOG_INFO, "Initializing wifi binding engine"); if (wifi_driver_init()) { - capwap_logging_fatal("Unable initialize wifi binding engine"); + log_printf(LOG_EMERG, "Unable initialize wifi binding engine"); return 0; } @@ -917,7 +917,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } default: { - capwap_logging_fatal("Unable initialize unknown binding engine: %hu", g_wtp.binding); + log_printf(LOG_EMERG, "Unable initialize unknown binding engine: %hu", g_wtp.binding); return 0; } } @@ -951,7 +951,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "splitmac")) { g_wtp.mactype.type = CAPWAP_SPLITMAC; } else { - capwap_logging_error("Invalid configuration file, unknown application.mactype value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.mactype value"); return 0; } } @@ -972,7 +972,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { if ((length > 0) && (length < WTP_PREFIX_NAME_MAX_LENGTH)) { strcpy(g_wtp.wlanprefix, configString); } else { - capwap_logging_error("Invalid configuration file, wlan.prefix string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, wlan.prefix string length exceeded"); return 0; } } @@ -999,7 +999,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(encryption, "802.11_TKIP")) { capability |= 0; /* TODO */ } else { - capwap_logging_error("Invalid configuration file, invalid application.descriptor.encryption value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.descriptor.encryption value"); return 0; } } @@ -1011,7 +1011,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { encrypt->wbid = g_wtp.binding; encrypt->capabilities = capability; } else { - capwap_logging_error("Invalid configuration file, application.descriptor.encryption not found"); + log_printf(LOG_ERR, "Invalid configuration file, application.descriptor.encryption not found"); return 0; } @@ -1026,7 +1026,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "limited")) { g_wtp.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT; } else { - capwap_logging_error("Invalid configuration file, unknown application.ecn value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.ecn value"); return 0; } } @@ -1036,7 +1036,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_wtp.statisticstimer.timer = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, invalid application.timer.statistics value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.timer.statistics value"); return 0; } } @@ -1073,7 +1073,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "presharedkey")) { dtlsparam.mode = CAPWAP_DTLS_MODE_PRESHAREDKEY; } else { - capwap_logging_error("Invalid configuration file, unknown application.dtls.type value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.dtls.type value"); return 0; } } @@ -1156,7 +1156,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { /* Set interface binding of WTP */ if (config_lookup_string(config, "application.network.binding", &configString) == CONFIG_TRUE) { if (strlen(configString) > (IFNAMSIZ - 1)) { - capwap_logging_error("Invalid configuration file, application.network.binding string length exceeded"); + log_printf(LOG_ERR, "Invalid configuration file, application.network.binding string length exceeded"); return 0; } @@ -1168,7 +1168,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { if ((configInt > 0) && (configInt < 65536)) { g_wtp.mtu = (unsigned short)configInt; } else { - capwap_logging_error("Invalid configuration file, invalid application.network.mtu value"); + log_printf(LOG_ERR, "Invalid configuration file, invalid application.network.mtu value"); return 0; } } @@ -1180,7 +1180,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } else if (!strcmp(configString, "udplite")) { g_wtp.transport.type = CAPWAP_UDPLITE_TRANSPORT; } else { - capwap_logging_error("Invalid configuration file, unknown application.network.transport value"); + log_printf(LOG_ERR, "Invalid configuration file, unknown application.network.transport value"); return 0; } } @@ -1211,7 +1211,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { acaddr.resolved = 1; g_wtp.discoverytype.type = CAPWAP_DISCOVERYTYPE_TYPE_STATIC; } else { - capwap_logging_info("%s:%d Could not resolve application.acdiscovery.host %s", __FILE__, __LINE__, address); + log_printf(LOG_INFO, "%s:%d Could not resolve application.acdiscovery.host %s", __FILE__, __LINE__, address); } memcpy(capwap_array_get_item_pointer(g_wtp.acdiscoveryarray, g_wtp.acdiscoveryarray->count), &acaddr, sizeof(struct addr_capwap)); } @@ -1238,7 +1238,7 @@ static int wtp_parsing_configuration_1_0(config_t* config) { } acaddr.resolved = 1; } else { - capwap_logging_info("%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, acaddr.fqdn); + log_printf(LOG_INFO, "%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, acaddr.fqdn); } memcpy(capwap_array_get_item_pointer(g_wtp.acpreferedarray, g_wtp.acpreferedarray->count), &acaddr, sizeof(struct addr_capwap)); } @@ -1257,9 +1257,9 @@ static int wtp_parsing_configuration(config_t* config) { return wtp_parsing_configuration_1_0(config); } - capwap_logging_error("Invalid configuration file, '%s' is not supported", configString); + log_printf(LOG_ERR, "Invalid configuration file, '%s' is not supported", configString); } else { - capwap_logging_error("Invalid configuration file, unable to found version tag"); + log_printf(LOG_ERR, "Invalid configuration file, unable to found version tag"); } return 0; @@ -1287,7 +1287,7 @@ static int wtp_load_configuration(int argc, char **argv) { if (strlen(optarg) < sizeof(g_configurationfile)) { strcpy(g_configurationfile, optarg); } else { - capwap_logging_error("Invalid -%c argument", optopt); + log_printf(LOG_ERR, "Invalid -%c argument", optopt); return -1; } @@ -1296,9 +1296,9 @@ static int wtp_load_configuration(int argc, char **argv) { case '?': { if (optopt == 'c') { - capwap_logging_error("Option -%c requires an argument", optopt); + log_printf(LOG_ERR, "Option -%c requires an argument", optopt); } else { - capwap_logging_error("Unknown option character `\\x%x'", optopt); + log_printf(LOG_ERR, "Unknown option character `\\x%x'", optopt); } wtp_print_usage(); @@ -1315,7 +1315,7 @@ static int wtp_load_configuration(int argc, char **argv) { result = wtp_parsing_configuration(&config); } else { result = -1; - capwap_logging_error("Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config)); + log_printf(LOG_ERR, "Unable load the configuration file '%s': %s (%d)", g_configurationfile, config_error_text(&config), config_error_line(&config)); } /* Free libconfig */ @@ -1337,7 +1337,7 @@ static int wtp_configure(void) { /* Bind control address */ if (capwap_bind_sockets(&g_wtp.net)) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); return WTP_ERROR_NETWORK; } wtp_socket_io_start(); @@ -1382,7 +1382,7 @@ int main(int argc, char** argv) { /* Init capwap */ if (geteuid() != 0) { - capwap_logging_fatal("Request root privileges"); + log_printf(LOG_EMERG, "Request root privileges"); result = CAPWAP_REQUEST_ROOT; goto out_close_log; @@ -1394,7 +1394,7 @@ int main(int argc, char** argv) { /* Init crypt */ if (capwap_crypt_init()) { result = CAPWAP_CRYPT_ERROR; - capwap_logging_fatal("Error to init crypt engine"); + log_printf(LOG_EMERG, "Error to init crypt engine"); goto out_check_memory; } @@ -1402,7 +1402,7 @@ int main(int argc, char** argv) { /* Init WTP */ if (!wtp_init()) { result = WTP_ERROR_SYSTEM_FAILER; - capwap_logging_fatal("Error to init WTP engine"); + log_printf(LOG_EMERG, "Error to init WTP engine"); goto out_release_crypto; } @@ -1411,7 +1411,7 @@ int main(int argc, char** argv) { value = wtp_load_configuration(argc, argv); if (value < 0) { result = WTP_ERROR_LOAD_CONFIGURATION; - capwap_logging_fatal("Error to load configuration"); + log_printf(LOG_EMERG, "Error to load configuration"); goto out_destroy_wtp; } else if (value == 0) @@ -1423,23 +1423,23 @@ int main(int argc, char** argv) { /* Console logging is disabled in daemon mode */ capwap_logging_disable_console(); - capwap_logging_info("Running WTP in daemon mode"); + log_printf(LOG_INFO, "Running WTP in daemon mode"); } /* Wait the initialization of radio interfaces */ - capwap_logging_info("Wait for the initialization of radio interfaces"); + log_printf(LOG_INFO, "Wait for the initialization of radio interfaces"); wtp_wait_radio_ready(); /* Connect WTP with kernel module */ if (wtp_kmod_init()) { - capwap_logging_fatal("Unable to connect with kernel module"); + log_printf(LOG_EMERG, "Unable to connect with kernel module"); goto out_close_radio; } - capwap_logging_info("SmartCAPWAP kernel module connected"); + log_printf(LOG_INFO, "SmartCAPWAP kernel module connected"); /* */ - capwap_logging_info("Startup WTP"); + log_printf(LOG_INFO, "Startup WTP"); /* Complete configuration WTP */ result = wtp_configure(); @@ -1457,7 +1457,7 @@ int main(int argc, char** argv) { wtp_kmod_free(); /* */ - capwap_logging_info("Terminate WTP"); + log_printf(LOG_INFO, "Terminate WTP"); out_close_radio: /* Close radio */ @@ -1465,7 +1465,7 @@ out_close_radio: /* Free binding */ if (g_wtp.binding == CAPWAP_WIRELESS_BINDING_IEEE80211) { - capwap_logging_info("Free wifi binding engine"); + log_printf(LOG_INFO, "Free wifi binding engine"); wifi_driver_free(); } diff --git a/src/wtp/wtp_dfa.c b/src/wtp/wtp_dfa.c index 1072c65..236100d 100644 --- a/src/wtp/wtp_dfa.c +++ b/src/wtp/wtp_dfa.c @@ -139,7 +139,7 @@ static void wtp_dfa_execute(struct capwap_parsed_packet* packet) if (!is_valid_state(g_wtp.state) || !dfa_states[g_wtp.state].state_execute) { - capwap_logging_debug("Got packet in invalid WTP state: %lu", g_wtp.state); + log_printf(LOG_DEBUG, "Got packet in invalid WTP state: %lu", g_wtp.state); wtp_teardown_connection(); } else dfa_states[g_wtp.state].state_execute(packet); @@ -157,7 +157,7 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, /* Check source */ if (g_wtp.state != CAPWAP_DISCOVERY_STATE && capwap_compare_ip(&g_wtp.dtls.peeraddr, fromaddr)) { - capwap_logging_debug("CAPWAP packet from unknown WTP when not in DISCOVERY, drop packet"); + log_printf(LOG_DEBUG, "CAPWAP packet from unknown WTP when not in DISCOVERY, drop packet"); return; /* Unknown source */ } @@ -195,7 +195,7 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, } case CAPWAP_WRONG_PACKET: - capwap_logging_debug("Warning: sanity check failure"); + log_printf(LOG_DEBUG, "Warning: sanity check failure"); /* Drop packet */ return; @@ -203,7 +203,7 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, /* TODO: Really? Previosly, this was hidden in the * overly deep indention, check if that is correct */ - capwap_logging_debug("Warning: wtp_dfa_running took default fall through"); + log_printf(LOG_DEBUG, "Warning: wtp_dfa_running took default fall through"); return; } @@ -226,9 +226,9 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, g_wtp.remoteseqnumber == rxmngpacket->ctrlmsg.seq) { /* Retransmit response */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.responsefragmentpacket)) { - capwap_logging_error("Error to resend response packet"); + log_printf(LOG_ERR, "Error to resend response packet"); } else { - capwap_logging_debug("Retransmitted control packet"); + log_printf(LOG_DEBUG, "Retransmitted control packet"); } /* Discard fragments */ @@ -240,11 +240,11 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, res = capwap_check_message_type(rxmngpacket); if (res != VALID_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"); wtp_send_invalid_request(rxmngpacket, CAPWAP_RESULTCODE_MSG_UNEXPECTED_UNRECOGNIZED_REQUEST); } - capwap_logging_debug("Invalid message type"); + log_printf(LOG_DEBUG, "Invalid message type"); wtp_free_packet_rxmng(); return; } @@ -257,13 +257,13 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, if (res != PARSING_COMPLETE) { if (res == UNRECOGNIZED_MESSAGE_ELEMENT && capwap_is_request_type(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"); wtp_send_invalid_request(rxmngpacket, CAPWAP_RESULTCODE_FAILURE_UNRECOGNIZED_MESSAGE_ELEMENT); /* TODO: add the unrecognized message element */ } /* */ - capwap_logging_debug("Failed parsing packet"); + log_printf(LOG_DEBUG, "Failed parsing packet"); capwap_free_parsed_packet(&packet); wtp_free_packet_rxmng(); return; @@ -272,12 +272,12 @@ static void wtp_dfa_process_packet(void *buffer, int buffersize, /* Validate packet */ if (capwap_validate_parsed_packet(&packet, NULL)) { if (capwap_is_request_type(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"); wtp_send_invalid_request(rxmngpacket, CAPWAP_RESULTCODE_FAILURE_MISSING_MANDATORY_MSG_ELEMENT); } /* */ - capwap_logging_debug("Failed validation parsed packet"); + log_printf(LOG_DEBUG, "Failed validation parsed packet"); capwap_free_parsed_packet(&packet); wtp_free_packet_rxmng(); return; @@ -314,7 +314,7 @@ int wtp_dfa_running() void wtp_socket_io_start() { - capwap_logging_debug("Start EV_IO on socket %d", g_wtp.net.socket); + log_printf(LOG_DEBUG, "Start EV_IO on socket %d", g_wtp.net.socket); /* Configure libev struct */ ev_io_init (&g_wtp.socket_ev, capwap_control_cb, g_wtp.net.socket, EV_READ); @@ -323,7 +323,7 @@ void wtp_socket_io_start() void wtp_socket_io_stop() { - capwap_logging_debug("Stop EV_IO on socket %d", g_wtp.socket_ev.fd); + log_printf(LOG_DEBUG, "Stop EV_IO on socket %d", g_wtp.socket_ev.fd); ev_io_stop(EV_DEFAULT_UC_ &g_wtp.socket_ev); } @@ -338,14 +338,14 @@ static void capwap_control_cb(EV_P_ ev_io *w, int revents) while (42) { /* If request wait packet from AC */ do { - capwap_logging_debug("Receive CAPWAP Control Channel message"); + log_printf(LOG_DEBUG, "Receive CAPWAP Control Channel message"); r = capwap_recvfrom(w->fd, &buffer, sizeof(buffer), &fromaddr, &toaddr); } while (r < 0 && errno == EINTR); - capwap_logging_debug("WTP got data: r: %zd", r); + log_printf(LOG_DEBUG, "WTP got data: r: %zd", r); if (!g_wtp.running) { - capwap_logging_debug("Closing WTP, Teardown connection"); + log_printf(LOG_DEBUG, "Closing WTP, Teardown connection"); ev_io_stop (EV_A_ w); break; @@ -353,7 +353,7 @@ static void capwap_control_cb(EV_P_ ev_io *w, int revents) if (r < 0) { if (errno != EAGAIN) { - capwap_logging_debug("capwap_control_cb I/O error %m, exiting loop"); + log_printf(LOG_DEBUG, "capwap_control_cb I/O error %m, exiting loop"); ev_io_stop (EV_A_ w); ev_break (EV_A_ EVBREAK_ONE); } @@ -361,7 +361,7 @@ static void capwap_control_cb(EV_P_ ev_io *w, int revents) } if (g_wtp.teardown) { - capwap_logging_debug("WTP is in teardown, drop packet"); + log_printf(LOG_DEBUG, "WTP is in teardown, drop packet"); continue; /* Drop packet */ } @@ -372,7 +372,7 @@ static void capwap_control_cb(EV_P_ ev_io *w, int revents) /* Change WTP state machine */ void wtp_dfa_change_state(int state) { if (state != g_wtp.state) { - capwap_logging_debug("WTP change state from %s to %s", + log_printf(LOG_DEBUG, "WTP change state from %s to %s", capwap_dfa_getname(g_wtp.state), capwap_dfa_getname(state)); g_wtp.state = state; @@ -402,7 +402,7 @@ void wtp_free_reference_last_response(void) { static void wtp_dfa_retransmition_timeout_cb(EV_P_ ev_timer *w, int revents) { if (!g_wtp.requestfragmentpacket->count) { - capwap_logging_warning("Invalid retransmition request packet"); + log_printf(LOG_WARNING, "Invalid retransmition request packet"); wtp_teardown_connection(); return; @@ -410,7 +410,7 @@ static void wtp_dfa_retransmition_timeout_cb(EV_P_ ev_timer *w, int revents) g_wtp.retransmitcount++; if (g_wtp.retransmitcount >= WTP_MAX_RETRANSMIT) { - capwap_logging_info("Retransmition request packet timeout"); + log_printf(LOG_INFO, "Retransmition request packet timeout"); /* Timeout state */ wtp_free_reference_last_request(); @@ -420,9 +420,9 @@ static void wtp_dfa_retransmition_timeout_cb(EV_P_ ev_timer *w, int revents) } /* Retransmit request */ - capwap_logging_debug("Retransmition request packet"); + log_printf(LOG_DEBUG, "Retransmition request packet"); if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) { - capwap_logging_error("Error to send request packet"); + log_printf(LOG_ERR, "Error to send request packet"); } /* Update timeout */ diff --git a/src/wtp/wtp_dfa_configure.c b/src/wtp/wtp_dfa_configure.c index 8a1a44c..029ba1d 100644 --- a/src/wtp/wtp_dfa_configure.c +++ b/src/wtp/wtp_dfa_configure.c @@ -121,7 +121,7 @@ void wtp_dfa_state_configure_enter(void) /* Send Configuration Status request to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) { /* Error to send packets */ - capwap_logging_debug("Warning: error to send configuration status request packet"); + log_printf(LOG_DEBUG, "Warning: error to send configuration status request packet"); wtp_free_reference_last_request(); wtp_teardown_connection(); @@ -140,7 +140,7 @@ void wtp_dfa_state_configure(struct capwap_parsed_packet* packet) struct capwap_resultcode_element* resultcode; if (packet->rxmngpacket->ctrlmsg.type != CAPWAP_CONFIGURATION_STATUS_RESPONSE) { - capwap_logging_debug("Unexpected message %d in state Configure", + log_printf(LOG_DEBUG, "Unexpected message %d in state Configure", packet->rxmngpacket->ctrlmsg.type); return; } @@ -148,12 +148,12 @@ void wtp_dfa_state_configure(struct capwap_parsed_packet* packet) /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Configuration Status Response for invalid binding"); + log_printf(LOG_DEBUG, "Configuration Status Response for invalid binding"); return; } if (g_wtp.localseqnumber != packet->rxmngpacket->ctrlmsg.seq) { - capwap_logging_debug("Configuration Status Response with invalid sequence (%d != %d)", + log_printf(LOG_DEBUG, "Configuration Status Response with invalid sequence (%d != %d)", g_wtp.localseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -169,7 +169,7 @@ void wtp_dfa_state_configure(struct capwap_parsed_packet* packet) resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_warning("Receive Configure Status Response with error: %d", + log_printf(LOG_WARNING, "Receive Configure Status Response with error: %d", (int)resultcode->code); wtp_teardown_connection(); return; @@ -182,7 +182,7 @@ void wtp_dfa_state_configure(struct capwap_parsed_packet* packet) /* Binding values */ if (wtp_radio_setconfiguration(packet)) { - capwap_logging_warning("Receive Configure Status Response with invalid elements"); + log_printf(LOG_WARNING, "Receive Configure Status Response with invalid elements"); wtp_teardown_connection(); return; } diff --git a/src/wtp/wtp_dfa_datacheck.c b/src/wtp/wtp_dfa_datacheck.c index 5afbe83..1d893c4 100644 --- a/src/wtp/wtp_dfa_datacheck.c +++ b/src/wtp/wtp_dfa_datacheck.c @@ -36,7 +36,7 @@ void wtp_dfa_state_datacheck_enter(void) /* Send Change State Event request to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) { /* Error to send packets */ - capwap_logging_debug("Warning: error to send change state event request packet"); + log_printf(LOG_DEBUG, "Warning: error to send change state event request packet"); wtp_free_reference_last_request(); wtp_teardown_connection(); @@ -54,7 +54,7 @@ void wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet) struct capwap_resultcode_element* resultcode; if (packet->rxmngpacket->ctrlmsg.type != CAPWAP_CHANGE_STATE_EVENT_RESPONSE) { - capwap_logging_debug("Unexpected message %d in state Data Check", + log_printf(LOG_DEBUG, "Unexpected message %d in state Data Check", packet->rxmngpacket->ctrlmsg.type); return; } @@ -62,12 +62,12 @@ void wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet) /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Change State Event for invalid binding"); + log_printf(LOG_DEBUG, "Change State Event for invalid binding"); return; } if (g_wtp.localseqnumber != packet->rxmngpacket->ctrlmsg.seq) { - capwap_logging_debug("Configuration Status Response with invalid sequence (%d != %d)", + log_printf(LOG_DEBUG, "Configuration Status Response with invalid sequence (%d != %d)", g_wtp.localseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -83,7 +83,7 @@ void wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet) resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_warning("Receive Data Check Response with error: %d", + log_printf(LOG_WARNING, "Receive Data Check Response with error: %d", (int)resultcode->code); wtp_teardown_connection(); diff --git a/src/wtp/wtp_dfa_discovery.c b/src/wtp/wtp_dfa_discovery.c index 17a8440..f254100 100644 --- a/src/wtp/wtp_dfa_discovery.c +++ b/src/wtp/wtp_dfa_discovery.c @@ -30,7 +30,7 @@ static void wtp_send_discovery_request() if (g_wtp.net.socket < 0) if (capwap_bind_sockets(&g_wtp.net) < 0) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); exit(-1); } @@ -75,14 +75,14 @@ static void wtp_send_discovery_request() addr->resolved = 1; g_wtp.discoverytype.type = CAPWAP_DISCOVERYTYPE_TYPE_STATIC; } else { - capwap_logging_info("%s:%d Could not resolve application.acdiscovery.host %s", + log_printf(LOG_INFO, "%s:%d Could not resolve application.acdiscovery.host %s", __FILE__, __LINE__, addr->fqdn); } } if (!capwap_sendto_fragmentpacket(g_wtp.net.socket, g_wtp.requestfragmentpacket, &addr->sockaddr)) { - capwap_logging_debug("Warning: error to send discovery request packet"); + log_printf(LOG_DEBUG, "Warning: error to send discovery request packet"); } } @@ -128,7 +128,7 @@ static void wtp_dfa_state_discovery_timeout(EV_P_ ev_timer *w, int revents) } acpreferredaddr->resolved = 1; } else { - capwap_logging_info("%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, acpreferredaddr->fqdn); + log_printf(LOG_INFO, "%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, acpreferredaddr->fqdn); } } if (!capwap_compare_ip(&acpreferredaddr->sockaddr, &checkaddr)) { @@ -167,7 +167,7 @@ static void wtp_dfa_state_discovery_timeout(EV_P_ ev_timer *w, int revents) } acpreferredaddr->resolved = 1; } else { - capwap_logging_info("Could not resolve application.acprefered.host %s", acpreferredaddr->fqdn); + log_printf(LOG_INFO, "Could not resolve application.acprefered.host %s", acpreferredaddr->fqdn); } } if (!capwap_compare_ip(&acpreferredaddr->sockaddr, &checkaddr)) { @@ -196,7 +196,7 @@ static void wtp_dfa_state_discovery_timeout(EV_P_ ev_timer *w, int revents) union sockaddr_capwap localaddr; if (capwap_connect_socket(&g_wtp.net, &peeraddr) < 0) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); wtp_socket_io_stop(); capwap_close_sockets(&g_wtp.net); return; @@ -204,7 +204,7 @@ static void wtp_dfa_state_discovery_timeout(EV_P_ ev_timer *w, int revents) /* Retrieve local address */ if (capwap_getsockname(&g_wtp.net, &localaddr) < 0) { - capwap_logging_fatal("Cannot get local endpoint address"); + log_printf(LOG_EMERG, "Cannot get local endpoint address"); wtp_socket_io_stop(); capwap_close_sockets(&g_wtp.net); return; @@ -267,7 +267,7 @@ void wtp_dfa_state_discovery(struct capwap_parsed_packet* packet) ASSERT(packet != NULL); if (packet->rxmngpacket->ctrlmsg.type != CAPWAP_DISCOVERY_RESPONSE) { - capwap_logging_debug("Unexpected message %d in state Discovery", + log_printf(LOG_DEBUG, "Unexpected message %d in state Discovery", packet->rxmngpacket->ctrlmsg.type); return; } @@ -275,12 +275,12 @@ void wtp_dfa_state_discovery(struct capwap_parsed_packet* packet) /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Discovery Response for invalid binding"); + log_printf(LOG_DEBUG, "Discovery Response for invalid binding"); return; } if (g_wtp.localseqnumber != packet->rxmngpacket->ctrlmsg.seq) { - capwap_logging_debug("Discovery Response with invalid sequence (%d != %d)", + log_printf(LOG_DEBUG, "Discovery Response with invalid sequence (%d != %d)", g_wtp.localseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } diff --git a/src/wtp/wtp_dfa_dtls.c b/src/wtp/wtp_dfa_dtls.c index 372e93f..7eeb23d 100644 --- a/src/wtp/wtp_dfa_dtls.c +++ b/src/wtp/wtp_dfa_dtls.c @@ -50,7 +50,7 @@ void wtp_start_datachannel(void) #ifdef DEBUG { char addr[INET6_ADDRSTRLEN]; - capwap_logging_debug("Create data channel with peer %s:%d", + log_printf(LOG_DEBUG, "Create data channel with peer %s:%d", capwap_address_to_string(&dataaddr, addr, INET6_ADDRSTRLEN), (int)CAPWAP_GET_NETWORK_PORT(&dataaddr)); } @@ -59,12 +59,12 @@ void wtp_start_datachannel(void) /* Bind data address and Connect to AC data channel */ if (wtp_kmod_create(g_wtp.net.localaddr.ss.ss_family, &dataaddr.ss, &g_wtp.sessionid, g_wtp.mtu) != 0) { /* Error to send packets */ - capwap_logging_error("Error to send data channel keepalive packet"); + log_printf(LOG_ERR, "Error to send data channel keepalive packet"); wtp_teardown_connection(); return; } - capwap_logging_error("Data channel connected"); + log_printf(LOG_ERR, "Data channel connected"); /* Reset AC Prefered List Position */ g_wtp.acpreferedselected = 0; diff --git a/src/wtp/wtp_dfa_idle.c b/src/wtp/wtp_dfa_idle.c index 2d24b2f..d839908 100644 --- a/src/wtp/wtp_dfa_idle.c +++ b/src/wtp/wtp_dfa_idle.c @@ -26,7 +26,7 @@ static int wtp_join_prefered_ac() wtp_socket_io_stop(); capwap_close_sockets(&g_wtp.net); if (capwap_bind_sockets(&g_wtp.net) < 0) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); return -1; } wtp_socket_io_start(); @@ -38,12 +38,12 @@ static int wtp_join_prefered_ac() } peeraddr->resolved = 1; } else { - capwap_logging_info("%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, peeraddr->fqdn); + log_printf(LOG_INFO, "%s:%d Could not resolve application.acprefered.host %s", __FILE__, __LINE__, peeraddr->fqdn); } } if (capwap_connect_socket(&g_wtp.net, &peeraddr->sockaddr) < 0) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); wtp_socket_io_stop(); capwap_close_sockets(&g_wtp.net); return -1; @@ -51,7 +51,7 @@ static int wtp_join_prefered_ac() /* Retrieve local address */ if (capwap_getsockname(&g_wtp.net, &localaddr) < 0) { - capwap_logging_fatal("Cannot get local endpoint address"); + log_printf(LOG_EMERG, "Cannot get local endpoint address"); wtp_socket_io_stop(); capwap_close_sockets(&g_wtp.net); return -1; @@ -84,7 +84,7 @@ void wtp_dfa_state_idle_enter(void) if (g_wtp.net.socket < 0) { if (capwap_bind_sockets(&g_wtp.net) < 0) { - capwap_logging_fatal("Cannot bind control address"); + log_printf(LOG_EMERG, "Cannot bind control address"); exit(-1); } wtp_socket_io_start(); diff --git a/src/wtp/wtp_dfa_join.c b/src/wtp/wtp_dfa_join.c index e2a61af..b2afbef 100644 --- a/src/wtp/wtp_dfa_join.c +++ b/src/wtp/wtp_dfa_join.c @@ -26,7 +26,7 @@ void wtp_dfa_state_join_enter(void) char sessionname[33]; capwap_sessionid_printf(&g_wtp.sessionid, sessionname); - capwap_logging_debug("Create WTP sessionid: %s", sessionname); + log_printf(LOG_DEBUG, "Create WTP sessionid: %s", sessionname); } while (0); #endif @@ -79,7 +79,7 @@ void wtp_dfa_state_join_enter(void) /* Send join request to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) { /* Error to send packets */ - capwap_logging_debug("Warning: error to send join request packet"); + log_printf(LOG_DEBUG, "Warning: error to send join request packet"); wtp_free_reference_last_request(); wtp_teardown_connection(); @@ -99,7 +99,7 @@ void wtp_dfa_state_join(struct capwap_parsed_packet* packet) struct capwap_resultcode_element* resultcode; if (packet->rxmngpacket->ctrlmsg.type != CAPWAP_JOIN_RESPONSE) { - capwap_logging_debug("Unexpected message %d in state Join", + log_printf(LOG_DEBUG, "Unexpected message %d in state Join", packet->rxmngpacket->ctrlmsg.type); return; } @@ -107,12 +107,12 @@ void wtp_dfa_state_join(struct capwap_parsed_packet* packet) /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Join Response for invalid binding"); + log_printf(LOG_DEBUG, "Join Response for invalid binding"); return; } if (g_wtp.localseqnumber != packet->rxmngpacket->ctrlmsg.seq) { - capwap_logging_debug("Join Response with invalid sequence (%d != %d)", + log_printf(LOG_DEBUG, "Join Response with invalid sequence (%d != %d)", g_wtp.localseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -128,7 +128,7 @@ void wtp_dfa_state_join(struct capwap_parsed_packet* packet) resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_warning("Receive Join Response with error: %d", + log_printf(LOG_WARNING, "Receive Join Response with error: %d", (int)resultcode->code); wtp_teardown_connection(); return; @@ -140,7 +140,7 @@ void wtp_dfa_state_join(struct capwap_parsed_packet* packet) acdescriptor = (struct capwap_acdescriptor_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_ACDESCRIPTION); if (!(g_wtp.validdtlsdatapolicy & acdescriptor->dtlspolicy)) { - capwap_logging_warning("Receive Join Response with invalid DTLS data policy"); + log_printf(LOG_WARNING, "Receive Join Response with invalid DTLS data policy"); wtp_teardown_connection(); return; } @@ -155,7 +155,7 @@ void wtp_dfa_state_join(struct capwap_parsed_packet* packet) /* Binding values */ if (wtp_radio_setconfiguration(packet)) { - capwap_logging_warning("Receive Join Response with invalid elements"); + log_printf(LOG_WARNING, "Receive Join Response with invalid elements"); wtp_teardown_connection(); return; } diff --git a/src/wtp/wtp_dfa_run.c b/src/wtp/wtp_dfa_run.c index 325c6f2..b542d42 100644 --- a/src/wtp/wtp_dfa_run.c +++ b/src/wtp/wtp_dfa_run.c @@ -37,7 +37,7 @@ static int send_echo_request(void) /* Send echo request to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) { /* Error to send packets */ - capwap_logging_debug("Warning: error to send echo request packet"); + log_printf(LOG_DEBUG, "Warning: error to send echo request packet"); wtp_free_reference_last_request(); return result; @@ -55,7 +55,7 @@ static int receive_echo_response(struct capwap_parsed_packet* packet) { /* Check the success of the Request */ resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE); if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) { - capwap_logging_warning("Receive Echo Response with error: %d", (int)resultcode->code); + log_printf(LOG_WARNING, "Receive Echo Response with error: %d", (int)resultcode->code); return 1; } @@ -77,12 +77,12 @@ static void receive_reset_request(struct capwap_parsed_packet* packet) /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Reset Request for invalid binding"); + log_printf(LOG_DEBUG, "Reset Request for invalid binding"); return; } if (!IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) { - capwap_logging_debug("Reset Request with invalid sequence (%d < %d)", + log_printf(LOG_DEBUG, "Reset Request with invalid sequence (%d < %d)", g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -112,7 +112,7 @@ static void receive_reset_request(struct capwap_parsed_packet* packet) /* Send Reset response to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.responsefragmentpacket)) { - capwap_logging_debug("Warning: error to send reset response packet"); + log_printf(LOG_DEBUG, "Warning: error to send reset response packet"); } } @@ -129,12 +129,12 @@ static void receive_station_configuration_request(struct capwap_parsed_packet* p /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("Station Configuration Request for invalid binding"); + log_printf(LOG_DEBUG, "Station Configuration Request for invalid binding"); return; } if (!IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) { - capwap_logging_debug("Station Configuration Request with invalid sequence (%d < %d)", + log_printf(LOG_DEBUG, "Station Configuration Request with invalid sequence (%d < %d)", g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -171,7 +171,7 @@ static void receive_station_configuration_request(struct capwap_parsed_packet* p /* Send Station Configuration response to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.responsefragmentpacket)) { - capwap_logging_debug("Warning: error to send Station Configuration response packet"); + log_printf(LOG_DEBUG, "Warning: error to send Station Configuration response packet"); } } @@ -190,12 +190,12 @@ static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_pa /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if (binding != g_wtp.binding) { - capwap_logging_debug("IEEE 802.11 WLAN Configuration Request for invalid binding"); + log_printf(LOG_DEBUG, "IEEE 802.11 WLAN Configuration Request for invalid binding"); return; } if (!IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) { - capwap_logging_debug("IEEE 802.11 WLAN Configuration Request with invalid sequence (%d < %d)", + log_printf(LOG_DEBUG, "IEEE 802.11 WLAN Configuration Request with invalid sequence (%d < %d)", g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq); return; } @@ -241,16 +241,16 @@ static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_pa /* Send IEEE802.11 WLAN Configuration response to AC */ if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.responsefragmentpacket)) { - capwap_logging_debug("Warning: error to send IEEE802.11 WLAN Configuration response packet"); + log_printf(LOG_DEBUG, "Warning: error to send IEEE802.11 WLAN Configuration response packet"); } } /* */ static void wtp_dfa_state_run_echo_timeout(EV_P_ ev_timer *w, int revents) { - capwap_logging_debug("Send Echo Request"); + log_printf(LOG_DEBUG, "Send Echo Request"); if (send_echo_request()) { - capwap_logging_error("Unable to send Echo Request"); + log_printf(LOG_ERR, "Unable to send Echo Request"); wtp_teardown_connection(); return; } @@ -262,12 +262,12 @@ static void wtp_dfa_state_run_echo_timeout(EV_P_ ev_timer *w, int revents) /* */ static void wtp_dfa_state_run_keepalive_timeout(EV_P_ ev_timer *w, int revents) { - capwap_logging_debug("Send Keep-Alive"); + log_printf(LOG_DEBUG, "Send Keep-Alive"); ev_timer_again(EV_A_ &g_wtp.timerkeepalivedead); if (wtp_kmod_send_keepalive()) { - capwap_logging_error("Unable to send Keep-Alive"); + log_printf(LOG_ERR, "Unable to send Keep-Alive"); wtp_teardown_connection(); } } @@ -275,13 +275,13 @@ static void wtp_dfa_state_run_keepalive_timeout(EV_P_ ev_timer *w, int revents) /* */ static void wtp_dfa_state_run_keepalivedead_timeout(EV_P_ ev_timer *w, int revents) { - capwap_logging_info("Keep-Alive timeout, teardown"); + log_printf(LOG_INFO, "Keep-Alive timeout, teardown"); wtp_teardown_connection(); } /* */ void wtp_recv_data_keepalive(void) { - capwap_logging_debug("Receive Keep-Alive"); + log_printf(LOG_DEBUG, "Receive Keep-Alive"); /* Receive Data Keep-Alive, wait for next packet */ if (ev_is_active(&g_wtp.timerkeepalivedead)) @@ -353,7 +353,7 @@ void wtp_dfa_state_run(struct capwap_parsed_packet* packet) case CAPWAP_ECHO_RESPONSE: if (!receive_echo_response(packet)) { - capwap_logging_debug("Receive Echo Response"); + log_printf(LOG_DEBUG, "Receive Echo Response"); g_wtp.timerecho.repeat = g_wtp.echointerval / 1000.0; ev_timer_again(EV_DEFAULT_UC_ &g_wtp.timerecho); diff --git a/src/wtp/wtp_kmod.c b/src/wtp/wtp_kmod.c index 08016f9..41c1c9c 100644 --- a/src/wtp/wtp_kmod.c +++ b/src/wtp/wtp_kmod.c @@ -176,7 +176,7 @@ static int wtp_kmod_link(void) { if (result == -EALREADY) { result = 0; } else { - capwap_logging_warning("Unable to connect kernel module, error code: %d", result); + log_printf(LOG_WARNING, "Unable to connect kernel module, error code: %d", result); } } @@ -196,7 +196,7 @@ static void wtp_kmod_event_receive(EV_P_ ev_io *w, int revents) /* */ res = nl_recvmsgs(kmodhandle->nl, kmodhandle->nl_cb); if (res) { - capwap_logging_warning("Receive kernel module message failed: %d", res); + log_printf(LOG_WARNING, "Receive kernel module message failed: %d", res); } } @@ -520,7 +520,7 @@ int wtp_kmod_init(void) { /* Get nlsmartcapwap netlink family */ g_wtp.kmodhandle.nlsmartcapwap_id = genl_ctrl_resolve(g_wtp.kmodhandle.nl, NLSMARTCAPWAP_GENL_NAME); if (g_wtp.kmodhandle.nlsmartcapwap_id < 0) { - capwap_logging_warning("Unable to found kernel module"); + log_printf(LOG_WARNING, "Unable to found kernel module"); wtp_kmod_free(); return -1; } diff --git a/src/wtp/wtp_radio.c b/src/wtp/wtp_radio.c index 7a5549b..c3ccea4 100644 --- a/src/wtp/wtp_radio.c +++ b/src/wtp/wtp_radio.c @@ -26,7 +26,7 @@ static int wtp_radio_configure_phy(struct wtp_radio* radio) /* Default rate set is all supported rate */ if (radio->radioid != radio->rateset.radioid) { if (radio->radioid != radio->supportedrates.radioid) { - capwap_logging_debug("Config Phy: Supported rate not set"); + log_printf(LOG_DEBUG, "Config Phy: Supported rate not set"); return -1; /* Supported rate not set */ } @@ -38,30 +38,30 @@ static int wtp_radio_configure_phy(struct wtp_radio* radio) /* Update rates */ if (wifi_device_updaterates(radio->devicehandle, radio->rateset.rateset, radio->rateset.ratesetcount)) { - capwap_logging_debug("Config Phy: update rates failed"); + log_printf(LOG_DEBUG, "Config Phy: update rates failed"); return -1; } } /* Check channel radio */ if (radio->radioid != radio->radioinformation.radioid) { - capwap_logging_debug("Config Phy: RI id mismatch"); + log_printf(LOG_DEBUG, "Config Phy: RI id mismatch"); return -1; } else if (radio->radioid != radio->radioconfig.radioid) { - capwap_logging_debug("Config Phy: RC id mismatch"); + log_printf(LOG_DEBUG, "Config Phy: RC id mismatch"); return -1; } else if ((!radio->directsequencecontrol.radioid && !radio->ofdmcontrol.radioid) || ((radio->directsequencecontrol.radioid == radio->radioid) && (radio->ofdmcontrol.radioid == radio->radioid))) { - capwap_logging_debug("Config Phy: DSSS / OFDM mismatch"); + log_printf(LOG_DEBUG, "Config Phy: DSSS / OFDM mismatch"); return -1; /* Only one from DSSS and OFDM can select */ } else if ((radio->radioid == radio->directsequencecontrol.radioid) && !(radio->radioinformation.radiotype & (CAPWAP_RADIO_TYPE_80211B | CAPWAP_RADIO_TYPE_80211G))) { - capwap_logging_debug("Config Phy: DSSS B/G mismatch"); + log_printf(LOG_DEBUG, "Config Phy: DSSS B/G mismatch"); return -1; } else if ((radio->radioid == radio->ofdmcontrol.radioid) && !(radio->radioinformation.radiotype & CAPWAP_RADIO_TYPE_80211A)) { - capwap_logging_debug("Config Phy: OFDM A mismatch"); + log_printf(LOG_DEBUG, "Config Phy: OFDM A mismatch"); return -1; } @@ -452,7 +452,7 @@ int wtp_radio_setconfiguration(struct capwap_parsed_packet* packet) break; } - capwap_logging_debug("wtp_radio_setconfiguration result #1: %d", result); + log_printf(LOG_DEBUG, "wtp_radio_setconfiguration result #1: %d", result); /* Update radio frequency */ for (i = 0; (i < updateitems->count) && !result; i++) { @@ -474,7 +474,7 @@ int wtp_radio_setconfiguration(struct capwap_parsed_packet* packet) } } - capwap_logging_debug("wtp_radio_setconfiguration result #2: %d", result); + log_printf(LOG_DEBUG, "wtp_radio_setconfiguration result #2: %d", result); /* Update radio configuration */ for (i = 0; (i < updateitems->count) && !result; i++) { @@ -508,7 +508,7 @@ int wtp_radio_setconfiguration(struct capwap_parsed_packet* packet) } } - capwap_logging_debug("wtp_radio_setconfiguration result #3: %d", result); + log_printf(LOG_DEBUG, "wtp_radio_setconfiguration result #3: %d", result); /* */ capwap_array_free(updateitems); @@ -557,12 +557,12 @@ struct wtp_radio_wlan *wtp_radio_get_wlan(struct wtp_radio *radio, uint8_t wlani /* Check */ if (!IS_VALID_WLANID(wlanid)) { - capwap_logging_debug("wtp_radio_get_wlan: invalid wlanid (%d)", wlanid); + log_printf(LOG_DEBUG, "wtp_radio_get_wlan: invalid wlanid (%d)", wlanid); return NULL; } if (wlanid > radio->wlan->count) { - capwap_logging_warning("wtp_radio_get_wlan: invalid wlanid (%d > %lu)", + log_printf(LOG_WARNING, "wtp_radio_get_wlan: invalid wlanid (%d > %lu)", wlanid, radio->wlan->count); return NULL; } @@ -656,31 +656,31 @@ uint32_t wtp_radio_create_wlan(struct capwap_parsed_packet* packet, /* Get message elements */ addwlan = (struct capwap_80211_addwlan_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_80211_ADD_WLAN); if (!addwlan) { - capwap_logging_debug("Create WLAN: no wlan"); + log_printf(LOG_DEBUG, "Create WLAN: no wlan"); return CAPWAP_RESULTCODE_FAILURE; } /* Get physical radio */ radio = wtp_radio_get_phy(addwlan->radioid); if (!radio) { - capwap_logging_debug("Create WLAN: no radio"); + log_printf(LOG_DEBUG, "Create WLAN: no radio"); return CAPWAP_RESULTCODE_FAILURE; } /* Check if virtual interface is already exist */ wlan = wtp_radio_get_wlan(radio, addwlan->wlanid); if (!wlan && !wlan->wlanhandle) { - capwap_logging_debug("Create WLAN: invalid WLAN ID"); + log_printf(LOG_DEBUG, "Create WLAN: invalid WLAN ID"); return CAPWAP_RESULTCODE_FAILURE; } if (wlan->in_use) { - capwap_logging_debug("Create WLAN: vif already exists"); + log_printf(LOG_DEBUG, "Create WLAN: vif already exists"); return CAPWAP_RESULTCODE_FAILURE; } /* Prepare physical interface for create wlan */ if (wtp_radio_configure_phy(radio)) { - capwap_logging_debug("Create WLAN: config phy failed"); + log_printf(LOG_DEBUG, "Create WLAN: config phy failed"); return CAPWAP_RESULTCODE_FAILURE; } @@ -699,7 +699,7 @@ uint32_t wtp_radio_create_wlan(struct capwap_parsed_packet* packet, /* Start AP */ if (wifi_wlan_startap(wlan->wlanhandle, ¶ms)) { - capwap_logging_debug("Create WLAN: start AP failes"); + log_printf(LOG_DEBUG, "Create WLAN: start AP failes"); return CAPWAP_RESULTCODE_FAILURE; } @@ -746,21 +746,21 @@ uint32_t wtp_radio_add_station(struct capwap_parsed_packet* packet) { capwap_get_message_element_data(packet, CAPWAP_ELEMENT_80211N_STATION_INFO); if (!station80211 || (addstation->radioid != station80211->radioid)) { - capwap_logging_debug("add_station: error no station or wrong radio"); + log_printf(LOG_DEBUG, "add_station: error no station or wrong radio"); return CAPWAP_RESULTCODE_FAILURE; } /* Get physical radio */ radio = wtp_radio_get_phy(addstation->radioid); if (!radio) { - capwap_logging_debug("add_station: radio_get_phy failed"); + log_printf(LOG_DEBUG, "add_station: radio_get_phy failed"); return CAPWAP_RESULTCODE_FAILURE; } /* Get virtual interface */ wlan = wtp_radio_get_wlan(radio, station80211->wlanid); if (!wlan) { - capwap_logging_debug("add_station: radio_get_wlan failed (%p, %d)", radio, station80211->wlanid); + log_printf(LOG_DEBUG, "add_station: radio_get_wlan failed (%p, %d)", radio, station80211->wlanid); return CAPWAP_RESULTCODE_FAILURE; } @@ -809,17 +809,17 @@ uint32_t wtp_radio_add_station(struct capwap_parsed_packet* packet) { err = wtp_kmod_add_station(addstation->radioid, station80211->address, station80211->wlanid); if (err < 0) { - capwap_logging_debug("add_station: CAPWAP add_station failed with: %d", err); + log_printf(LOG_DEBUG, "add_station: CAPWAP add_station failed with: %d", err); return CAPWAP_RESULTCODE_FAILURE; } if (wifi_station_authorize(wlan->wlanhandle, &stationparams)) { wtp_kmod_del_station(addstation->radioid, station80211->address); - capwap_logging_debug("add_station: station_authorize failed"); + log_printf(LOG_DEBUG, "add_station: station_authorize failed"); return CAPWAP_RESULTCODE_FAILURE; } - capwap_logging_debug("add_station: SUCCESS"); + log_printf(LOG_DEBUG, "add_station: SUCCESS"); return CAPWAP_RESULTCODE_SUCCESS; }