mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Try fix bug
This commit is contained in:
parent
ee47d9afa7
commit
2efaebf598
3 changed files with 39 additions and 18 deletions
|
@ -119,6 +119,10 @@ probe_entry probe_array_get_entry(uint8_t bssid_addr[], uint8_t client_addr[]);
|
||||||
|
|
||||||
void print_array();
|
void print_array();
|
||||||
|
|
||||||
|
void print_probe_entry(probe_entry entry);
|
||||||
|
|
||||||
|
void print_auth_entry(auth_entry entry);
|
||||||
|
|
||||||
void *remove_array_thread(void *arg);
|
void *remove_array_thread(void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@ int go_next_help(char sort_order[], int i, probe_entry entry,
|
||||||
int go_next(char sort_order[], int i, probe_entry entry,
|
int go_next(char sort_order[], int i, probe_entry entry,
|
||||||
probe_entry next_entry);
|
probe_entry next_entry);
|
||||||
|
|
||||||
void print_probe_entry(probe_entry entry);
|
|
||||||
|
|
||||||
void remove_old_probe_entries(time_t current_time, long long int threshold);
|
void remove_old_probe_entries(time_t current_time, long long int threshold);
|
||||||
|
|
||||||
int client_array_go_next(char sort_order[], int i, client entry,
|
int client_array_go_next(char sort_order[], int i, client entry,
|
||||||
|
@ -733,6 +731,21 @@ void print_probe_entry(probe_entry entry) {
|
||||||
mac_buf_ap, mac_buf_client, entry.signal, entry.freq, entry.counter);
|
mac_buf_ap, mac_buf_client, entry.signal, entry.freq, entry.counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_auth_entry(auth_entry entry) {
|
||||||
|
char mac_buf_ap[20];
|
||||||
|
char mac_buf_client[20];
|
||||||
|
char mac_buf_target[20];
|
||||||
|
|
||||||
|
sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.bssid_addr));
|
||||||
|
sprintf(mac_buf_client, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.client_addr));
|
||||||
|
sprintf(mac_buf_target, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.target_addr));
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"bssid_addr: %s, client_addr: %s, signal: %d, freq: "
|
||||||
|
"%d\n",
|
||||||
|
mac_buf_ap, mac_buf_client, entry.signal, entry.freq);
|
||||||
|
}
|
||||||
|
|
||||||
void print_client_entry(client entry) {
|
void print_client_entry(client entry) {
|
||||||
char mac_buf_ap[20];
|
char mac_buf_ap[20];
|
||||||
char mac_buf_client[20];
|
char mac_buf_client[20];
|
||||||
|
|
|
@ -212,24 +212,31 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) {
|
||||||
|
|
||||||
static int handle_auth_req(struct blob_attr *msg) {
|
static int handle_auth_req(struct blob_attr *msg) {
|
||||||
|
|
||||||
|
print_array();
|
||||||
|
|
||||||
printf("HANDLE AUTH!\n");
|
printf("HANDLE AUTH!\n");
|
||||||
return UBUS_STATUS_CONNECTION_FAILED;
|
|
||||||
auth_entry auth_req;
|
auth_entry auth_req;
|
||||||
parse_to_auth_req(msg, &auth_req);
|
parse_to_auth_req(msg, &auth_req);
|
||||||
|
|
||||||
probe_entry tmp = probe_array_get_entry(auth_req.bssid_addr, auth_req.bssid_addr);
|
printf("AUTH Entry: ");
|
||||||
|
print_auth_entry(auth_req);
|
||||||
|
|
||||||
|
probe_entry tmp = probe_array_get_entry(auth_req.bssid_addr, auth_req.client_addr);
|
||||||
|
|
||||||
|
printf("Entry found\n");
|
||||||
|
print_probe_entry(tmp);
|
||||||
|
|
||||||
// block if entry was not already found in probe database
|
// block if entry was not already found in probe database
|
||||||
if(!(mac_is_equal(tmp.bssid_addr, auth_req.bssid_addr) && mac_is_equal(tmp.client_addr, auth_req.client_addr)))
|
if(!(mac_is_equal(tmp.bssid_addr, auth_req.bssid_addr) && mac_is_equal(tmp.client_addr, auth_req.client_addr)))
|
||||||
{
|
{
|
||||||
return UBUS_STATUS_CONNECTION_FAILED;
|
printf("Entry not the bla\n");
|
||||||
|
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decide_function(&tmp)) {
|
if (!decide_function(&tmp)) {
|
||||||
return UBUS_STATUS_CONNECTION_FAILED;
|
printf("DECIDE FUNCTION: NOOOO\n");
|
||||||
|
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf("ALLOW AUTH!\n");
|
printf("ALLOW AUTH!\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -243,7 +250,7 @@ static int handle_assoc_req(struct blob_attr *msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_probe_req(struct blob_attr *msg) {
|
static int handle_probe_req(struct blob_attr *msg) {
|
||||||
printf("[WC] Parse Probe Request\n");
|
//printf("[WC] Parse Probe Request\n");
|
||||||
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, 1);
|
//insert_to_list(prob_req, 1);
|
||||||
|
@ -254,26 +261,23 @@ static int handle_probe_req(struct blob_attr *msg) {
|
||||||
str = blobmsg_format_json(msg, true);
|
str = blobmsg_format_json(msg, true);
|
||||||
send_string_enc(str);
|
send_string_enc(str);
|
||||||
|
|
||||||
printf("[WC] Hostapd-Probe: %s : %s\n", "probe", str);
|
//printf("[WC] Hostapd-Probe: %s : %s\n", "probe", str);
|
||||||
|
|
||||||
print_array();
|
//print_array();
|
||||||
|
|
||||||
// deny access
|
// deny access
|
||||||
if (!decide_function(&tmp_probe)) {
|
if (!decide_function(&tmp_probe)) {
|
||||||
printf("MAC WILL BE DECLINED!!!\n");
|
//printf("MAC WILL BE DECLINED!!!\n");
|
||||||
return UBUS_STATUS_CONNECTION_FAILED;
|
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
printf("MAC WILL BE ACCEPDTED!!!\n");
|
//printf("MAC WILL BE ACCEPDTED!!!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj,
|
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) {
|
||||||
printf("METHOD: %s\n",method);
|
printf("METHOD new: %s\n",method);
|
||||||
sleep(1);
|
|
||||||
printf("Rjection by Ubus handler: %d\n", UBUS_STATUS_CONNECTION_FAILED);
|
|
||||||
return UBUS_STATUS_CONNECTION_FAILED;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Only handle probe request and NOT assoc, ...
|
// TODO: Only handle probe request and NOT assoc, ...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue