From 32c5de1a5d6ae6a0e8805d8e0b6c49627b883655 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 7 Sep 2017 20:14:35 +0200 Subject: [PATCH] comment malloc lines out --- src/crypto/crypto.c | 4 ++-- src/include/datastorage.h | 1 + src/main.c | 16 ++++++++-------- src/network/networksocket.c | 8 ++++---- src/storage/datastorage.c | 4 ++-- src/utils/ubus.c | 3 ++- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c index 32b5f40..ab38eaa 100644 --- a/src/crypto/crypto.c +++ b/src/crypto/crypto.c @@ -97,13 +97,13 @@ char *gcrypt_decrypt_msg(char *msg, size_t msg_length) { printf("gcry_cipher_encrypt failed: %s/%s\n", gcry_strsource(gcry_error_handle), gcry_strerror(gcry_error_handle)); - printf("Free %s: %p\n","out_buffer", out_buffer); + //printf("Free %s: %p\n","out_buffer", out_buffer); free(out_buffer); return NULL; } char *out = malloc(strlen(out_buffer) + 1); strcpy(out, out_buffer); - printf("Free %s: %p\n","out_buffer", out_buffer); + //printf("Free %s: %p\n","out_buffer", out_buffer); free(out_buffer); return out; } diff --git a/src/include/datastorage.h b/src/include/datastorage.h index 3e3b3ad..6f24822 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -80,6 +80,7 @@ typedef struct ap_s { uint32_t freq; uint8_t ht; uint8_t vht; + uint8_t channel_utilization; time_t time; } ap; diff --git a/src/main.c b/src/main.c index c1f4780..d755915 100644 --- a/src/main.c +++ b/src/main.c @@ -25,8 +25,8 @@ #include #include -static void* (*real_malloc)(size_t)=NULL; -static void* (*real_free)(void *p)=NULL; +//static void* (*real_malloc)(size_t)=NULL; +//static void* (*real_free)(void *p)=NULL; void daemon_shutdown(); @@ -34,7 +34,7 @@ void signal_handler(int sig); struct sigaction newSigAction; -int free_counter = 0; +//int free_counter = 0; pthread_t tid_probe; pthread_t tid_client; @@ -59,7 +59,7 @@ void daemon_shutdown() pthread_mutex_destroy(&client_array_mutex); pthread_mutex_destroy(&ap_array_mutex); - printf("Free Counter: %d\n", free_counter); + //printf("Free Counter: %d\n", free_counter); } void signal_handler(int sig) @@ -82,7 +82,7 @@ void signal_handler(int sig) break; } } - +/* static void mtrace_init(void) { real_malloc = dlsym(RTLD_NEXT, "malloc"); @@ -120,10 +120,10 @@ void free(void *p) fprintf(stderr, "free: "); fprintf(stderr, "%p\n", p); free_counter--; -} +}*/ int main(int argc, char **argv) { - free_counter = 0; + //free_counter = 0; const char *ubus_socket = NULL; int ch; @@ -207,7 +207,7 @@ int main(int argc, char **argv) { return 1; } - //init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1); + init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1); pthread_create(&tid_probe, NULL, &remove_array_thread, NULL); pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL); diff --git a/src/network/networksocket.c b/src/network/networksocket.c index c5bfb95..dcb1029 100644 --- a/src/network/networksocket.c +++ b/src/network/networksocket.c @@ -146,7 +146,7 @@ void *receive_msg_enc(void *args) { char *dec = gcrypt_decrypt_msg(base64_dec_str, base64_dec_length); - printf("Free %s: %p\n","base64_dec_str", base64_dec_str); + //printf("Free %s: %p\n","base64_dec_str", base64_dec_str); free(base64_dec_str); printf("[WC] Network-Received: %s\n", dec); @@ -176,7 +176,7 @@ void *receive_msg_enc(void *args) { } } // free encrypted string - printf("Free %s: %p\n","dec", dec); + //printf("Free %s: %p\n","dec", dec); free(dec); } } @@ -227,9 +227,9 @@ int send_string_enc(char *msg) { pthread_mutex_unlock(&send_mutex); exit(EXIT_FAILURE); } - printf("Free %s: %p\n","base64_enc_str", base64_enc_str); + //printf("Free %s: %p\n","base64_enc_str", base64_enc_str); free(base64_enc_str); - printf("Free %s: %p\n","enc", enc); + //printf("Free %s: %p\n","enc", enc); free(enc); pthread_mutex_unlock(&send_mutex); return 0; diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index 2b319d4..c67fba7 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -862,8 +862,8 @@ void print_ap_entry(ap entry) { char mac_buf_ap[20]; sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.bssid_addr)); - printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d\n", - mac_buf_ap, entry.freq, entry.ht, entry.vht); + printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d, ch_utilz: %d\n", + mac_buf_ap, entry.freq, entry.ht, entry.vht, entry.channel_utilization); } void print_ap_array() { diff --git a/src/utils/ubus.c b/src/utils/ubus.c index c14202f..573655c 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -479,11 +479,12 @@ int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) { ap_entry.freq = blobmsg_get_u32(tb[CLIENT_TABLE_FREQ]); ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]); ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]); + ap_entry.channel_utilization = blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL]); insert_to_ap_array(ap_entry); if((tb[CLIENT_TABLE_CHAN_UTIL])) { - printf("\n\nCHANNEL UTILIZAITON: %d\n\n", blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL])); + //printf("\n\nCHANNEL UTILIZAITON: %d\n\n", blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL])); } if (do_kick) {