Fix freeing ressources and change b-ip

This commit is contained in:
PolynomialDivision 2017-06-20 17:51:14 +02:00
parent 976f90efc3
commit e24bbb8370
3 changed files with 8 additions and 9 deletions

View file

@ -1,5 +1,5 @@
config 'settings' 'dawn' config 'settings' 'dawn'
option broadcast_ip '192.186.1.255' option broadcast_ip '10.0.0.255'
option broadcast_port '1025' option broadcast_port '1025'
option sort_order 'cfsb' option sort_order 'cfsb'
option hostapd_dir '/var/run/hostapd' option hostapd_dir '/var/run/hostapd'

View file

@ -56,12 +56,11 @@ int main(int argc, char **argv)
pthread_t tid; pthread_t tid;
pthread_create(&tid, NULL, &remove_thread, NULL); pthread_create(&tid, NULL, &remove_thread, NULL);
free_list(probe_list_head);
pthread_mutex_destroy(&list_mutex);
dawn_init_ubus(ubus_socket, opt_hostapd_dir); dawn_init_ubus(ubus_socket, opt_hostapd_dir);
// free ressources
pthread_mutex_destroy(&list_mutex);
free_list(probe_list_head);
return 0; return 0;
} }

View file

@ -38,7 +38,7 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method, struct ubus_request_data *req, const char *method,
struct blob_attr *msg); struct blob_attr *msg);
static int add_subscriber(char* name); static int add_subscriber(char* name);
//int parse_to_probe_req(struct blob_attr *msg, probe_entry* prob_req); int parse_to_probe_req(struct blob_attr *msg, probe_entry* prob_req);
static int subscribe_to_hostapd_interfaces(char* hostapd_dir); static int subscribe_to_hostapd_interfaces(char* hostapd_dir);
static int decide_function(probe_entry* prob_req) static int decide_function(probe_entry* prob_req)
@ -90,7 +90,6 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method, struct ubus_request_data *req, const char *method,
struct blob_attr *msg) struct blob_attr *msg)
{ {
// write probe to table
probe_entry prob_req; probe_entry prob_req;
parse_to_probe_req(msg, &prob_req); parse_to_probe_req(msg, &prob_req);
insert_to_list(prob_req); insert_to_list(prob_req);
@ -101,6 +100,7 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj,
send_string(str); send_string(str);
printf("[WC] Hostapd-Probe: %s : %s\n", method, str); printf("[WC] Hostapd-Probe: %s : %s\n", method, str);
print_list(); print_list();
// deny access // deny access
@ -154,7 +154,7 @@ static int subscribe_to_hostapd_interfaces(char* hostapd_dir)
add_subscriber(subscribe_name); add_subscriber(subscribe_name);
} }
} }
free(hostapd_dir); // free string //free(hostapd_dir); // free string
return 0; return 0;
} }