mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
comment malloc lines out
This commit is contained in:
parent
c834261203
commit
32c5de1a5d
6 changed files with 19 additions and 17 deletions
|
@ -97,13 +97,13 @@ char *gcrypt_decrypt_msg(char *msg, size_t msg_length) {
|
||||||
printf("gcry_cipher_encrypt failed: %s/%s\n",
|
printf("gcry_cipher_encrypt failed: %s/%s\n",
|
||||||
gcry_strsource(gcry_error_handle),
|
gcry_strsource(gcry_error_handle),
|
||||||
gcry_strerror(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);
|
free(out_buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
char *out = malloc(strlen(out_buffer) + 1);
|
char *out = malloc(strlen(out_buffer) + 1);
|
||||||
strcpy(out, out_buffer);
|
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);
|
free(out_buffer);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ typedef struct ap_s {
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
uint8_t ht;
|
uint8_t ht;
|
||||||
uint8_t vht;
|
uint8_t vht;
|
||||||
|
uint8_t channel_utilization;
|
||||||
time_t time;
|
time_t time;
|
||||||
} ap;
|
} ap;
|
||||||
|
|
||||||
|
|
16
src/main.c
16
src/main.c
|
@ -25,8 +25,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void* (*real_malloc)(size_t)=NULL;
|
//static void* (*real_malloc)(size_t)=NULL;
|
||||||
static void* (*real_free)(void *p)=NULL;
|
//static void* (*real_free)(void *p)=NULL;
|
||||||
|
|
||||||
void daemon_shutdown();
|
void daemon_shutdown();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ void signal_handler(int sig);
|
||||||
|
|
||||||
struct sigaction newSigAction;
|
struct sigaction newSigAction;
|
||||||
|
|
||||||
int free_counter = 0;
|
//int free_counter = 0;
|
||||||
|
|
||||||
pthread_t tid_probe;
|
pthread_t tid_probe;
|
||||||
pthread_t tid_client;
|
pthread_t tid_client;
|
||||||
|
@ -59,7 +59,7 @@ void daemon_shutdown()
|
||||||
pthread_mutex_destroy(&client_array_mutex);
|
pthread_mutex_destroy(&client_array_mutex);
|
||||||
pthread_mutex_destroy(&ap_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)
|
void signal_handler(int sig)
|
||||||
|
@ -82,7 +82,7 @@ void signal_handler(int sig)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static void mtrace_init(void)
|
static void mtrace_init(void)
|
||||||
{
|
{
|
||||||
real_malloc = dlsym(RTLD_NEXT, "malloc");
|
real_malloc = dlsym(RTLD_NEXT, "malloc");
|
||||||
|
@ -120,10 +120,10 @@ void free(void *p)
|
||||||
fprintf(stderr, "free: ");
|
fprintf(stderr, "free: ");
|
||||||
fprintf(stderr, "%p\n", p);
|
fprintf(stderr, "%p\n", p);
|
||||||
free_counter--;
|
free_counter--;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
free_counter = 0;
|
//free_counter = 0;
|
||||||
|
|
||||||
const char *ubus_socket = NULL;
|
const char *ubus_socket = NULL;
|
||||||
int ch;
|
int ch;
|
||||||
|
@ -207,7 +207,7 @@ int main(int argc, char **argv) {
|
||||||
return 1;
|
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_probe, NULL, &remove_array_thread, NULL);
|
||||||
pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL);
|
pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL);
|
||||||
|
|
|
@ -146,7 +146,7 @@ void *receive_msg_enc(void *args) {
|
||||||
|
|
||||||
char *dec = gcrypt_decrypt_msg(base64_dec_str, base64_dec_length);
|
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);
|
free(base64_dec_str);
|
||||||
|
|
||||||
printf("[WC] Network-Received: %s\n", dec);
|
printf("[WC] Network-Received: %s\n", dec);
|
||||||
|
@ -176,7 +176,7 @@ void *receive_msg_enc(void *args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// free encrypted string
|
// free encrypted string
|
||||||
printf("Free %s: %p\n","dec", dec);
|
//printf("Free %s: %p\n","dec", dec);
|
||||||
free(dec);
|
free(dec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,9 +227,9 @@ int send_string_enc(char *msg) {
|
||||||
pthread_mutex_unlock(&send_mutex);
|
pthread_mutex_unlock(&send_mutex);
|
||||||
exit(EXIT_FAILURE);
|
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);
|
free(base64_enc_str);
|
||||||
printf("Free %s: %p\n","enc", enc);
|
//printf("Free %s: %p\n","enc", enc);
|
||||||
free(enc);
|
free(enc);
|
||||||
pthread_mutex_unlock(&send_mutex);
|
pthread_mutex_unlock(&send_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -862,8 +862,8 @@ void print_ap_entry(ap entry) {
|
||||||
char mac_buf_ap[20];
|
char mac_buf_ap[20];
|
||||||
|
|
||||||
sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.bssid_addr));
|
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",
|
printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d, ch_utilz: %d\n",
|
||||||
mac_buf_ap, entry.freq, entry.ht, entry.vht);
|
mac_buf_ap, entry.freq, entry.ht, entry.vht, entry.channel_utilization);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_ap_array() {
|
void print_ap_array() {
|
||||||
|
|
|
@ -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.freq = blobmsg_get_u32(tb[CLIENT_TABLE_FREQ]);
|
||||||
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
|
||||||
ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
|
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);
|
insert_to_ap_array(ap_entry);
|
||||||
|
|
||||||
if((tb[CLIENT_TABLE_CHAN_UTIL]))
|
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) {
|
if (do_kick) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue