switch everything to new log API and drop old one

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

View File

@ -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)

View File

@ -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);

View File

@ -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__)

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -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];

View File

@ -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__ */

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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 */