mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
improve debug msgs
This commit is contained in:
parent
6ac15a5bac
commit
c41ff502b4
2 changed files with 14 additions and 14 deletions
|
@ -141,7 +141,6 @@ void kick_clients(uint8_t bssid[], uint32_t id) {
|
|||
int rssi = get_rssi_from_iwinfo(client_array[j].client_addr);
|
||||
if(rssi != INT_MIN)
|
||||
{
|
||||
printf("UPDATING RSSI!!!\n");
|
||||
pthread_mutex_unlock(&probe_array_mutex);
|
||||
if(probe_array_update_rssi(client_array[j].bssid_addr, client_array[j].client_addr, rssi))
|
||||
{
|
||||
|
@ -151,16 +150,22 @@ void kick_clients(uint8_t bssid[], uint32_t id) {
|
|||
|
||||
}
|
||||
|
||||
// better ap available
|
||||
if (kick_client(client_array[j]) > 0) {
|
||||
// TODO: Better debug output
|
||||
printf("KICKING CLIENT!!!!!!!!!!!!!\n");
|
||||
printf("Better AP available. Kicking client:\n");
|
||||
print_client_entry(client_array[j]);
|
||||
del_client_interface(id, client_array[j].client_addr, 5, 1, 60000);
|
||||
|
||||
// no entry in probe array for own bssid
|
||||
} else if (kick_client(client_array[j]) == -1) {
|
||||
printf("Force client to reconnect!!!!!!!!!!!!!\n");
|
||||
printf("TRY TO READ RSSI!\n");
|
||||
//del_client_interface(id, client_array[j].client_addr, 0, 0, 0);
|
||||
printf("No Information about client. Force reconnect:\n");
|
||||
print_client_entry(client_array[j]);
|
||||
del_client_interface(id, client_array[j].client_addr, 0, 0, 0);
|
||||
|
||||
// ap is best
|
||||
} else {
|
||||
printf("STAAAY CLIENT!!!!!!!!!!!!!\n");
|
||||
printf("AP is best. Client will stay:\n");
|
||||
print_client_entry(client_array[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,11 @@ int get_rssi_from_iwinfo(__uint8_t* client_addr)
|
|||
|
||||
int call_iwinfo(char* client_addr)
|
||||
{
|
||||
// TODO: REFACTOR THIS! USE NET LINK... LOOK AT IWINFO
|
||||
|
||||
FILE *fp;
|
||||
char path[1035];
|
||||
|
||||
/* Open the command for reading. */
|
||||
|
||||
// TODO: refactor this
|
||||
int rssi = INT_MIN;
|
||||
int command_length = 68;
|
||||
char iwinfo_command[command_length];
|
||||
|
@ -38,7 +37,6 @@ int call_iwinfo(char* client_addr)
|
|||
iwinfo_command[command_length - 1] = '\0';
|
||||
printf("iwinfo command:\n%s\n", iwinfo_command);
|
||||
|
||||
|
||||
fp = popen(iwinfo_command, "r");
|
||||
if (fp == NULL) {
|
||||
printf("Failed to run command\n" );
|
||||
|
@ -65,14 +63,11 @@ int parse_rssi(char* iwinfo_string)
|
|||
int rssi = INT_MIN;
|
||||
if(p_1 != NULL && p_2 != NULL)
|
||||
{
|
||||
printf("Found substring: %s", p_2);
|
||||
printf("Length: %d\n", p_2 - p_1);
|
||||
int length = (int) (p_2 - p_1);
|
||||
char dest[length + 1];
|
||||
memcpy(dest, p_1, (int) (p_2 - p_1));
|
||||
dest[length] = '\0';
|
||||
rssi = atoi(dest);
|
||||
printf("After cutting:\n%s\nInt:%d\n", dest, rssi);
|
||||
}
|
||||
return rssi;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue