mirror of
				https://github.com/berlin-open-wireless-lab/DAWN.git
				synced 2025-03-09 15:40:12 +00:00 
			
		
		
		
	Remove some debugging messages
Remove some of the debugging messages, so that, hopefully, only the relevant ones are shown. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
		
							parent
							
								
									c70773a171
								
							
						
					
					
						commit
						c9f6684021
					
				
					 5 changed files with 0 additions and 166 deletions
				
			
		| 
						 | 
					@ -97,10 +97,6 @@ static void client_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
    while(1) {
 | 
					    while(1) {
 | 
				
			||||||
        if (cl->state == READ_STATUS_READY)
 | 
					        if (cl->state == READ_STATUS_READY)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("tcp_socket: commencing message...\n");
 | 
					 | 
				
			||||||
            uint32_t min_len = sizeof(uint32_t); // big enough to get msg length
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            cl->str = dawn_malloc(HEADER_SIZE);
 | 
					            cl->str = dawn_malloc(HEADER_SIZE);
 | 
				
			||||||
            if (!cl->str) {
 | 
					            if (!cl->str) {
 | 
				
			||||||
                fprintf(stderr,"not enough memory (" STR_QUOTE(__LINE__) ")\n");
 | 
					                fprintf(stderr,"not enough memory (" STR_QUOTE(__LINE__) ")\n");
 | 
				
			||||||
| 
						 | 
					@ -110,9 +106,6 @@ static void client_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
            uint32_t avail_len = ustream_pending_data(s, false);
 | 
					            uint32_t avail_len = ustream_pending_data(s, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (avail_len < HEADER_SIZE){//ensure recv sizeof(uint32_t)
 | 
					            if (avail_len < HEADER_SIZE){//ensure recv sizeof(uint32_t)
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
                printf("not complete msg, len:%d, expected len:%u\n", avail_len, min_len);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
                dawn_free(cl->str);
 | 
					                dawn_free(cl->str);
 | 
				
			||||||
                cl->str = NULL;
 | 
					                cl->str = NULL;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
| 
						 | 
					@ -146,9 +139,6 @@ static void client_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (cl->state == READ_STATUS_COMMENCED)
 | 
					        if (cl->state == READ_STATUS_COMMENCED)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("tcp_socket: reading message...\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            uint32_t read_len = ustream_pending_data(s, false);
 | 
					            uint32_t read_len = ustream_pending_data(s, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (read_len == 0)
 | 
					            if (read_len == 0)
 | 
				
			||||||
| 
						 | 
					@ -157,22 +147,11 @@ static void client_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
            if (read_len > (cl->final_len - cl->curr_len))
 | 
					            if (read_len > (cl->final_len - cl->curr_len))
 | 
				
			||||||
                    read_len = cl->final_len - cl->curr_len;
 | 
					                    read_len = cl->final_len - cl->curr_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("tcp_socket: reading %" PRIu32 " bytes to add to %" PRIu32 " of %" PRIu32 "...\n",
 | 
					 | 
				
			||||||
                    read_len, cl->curr_len, cl->final_len);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            uint32_t this_read = ustream_read(s, cl->str + cl->curr_len, read_len);
 | 
					            uint32_t this_read = ustream_read(s, cl->str + cl->curr_len, read_len);
 | 
				
			||||||
            cl->curr_len += this_read;
 | 
					            cl->curr_len += this_read;
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("tcp_socket: ...and we're back, now have %" PRIu32 " bytes\n", cl->curr_len);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            if (cl->curr_len == cl->final_len){//ensure recv final_len bytes.
 | 
					            if (cl->curr_len == cl->final_len){//ensure recv final_len bytes.
 | 
				
			||||||
                // Full message now received
 | 
					                // Full message now received
 | 
				
			||||||
                cl->state = READ_STATUS_COMPLETE;
 | 
					                cl->state = READ_STATUS_COMPLETE;
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
                printf("tcp_socket: message completed\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -203,10 +182,6 @@ static void client_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("tcp_socket: leaving\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -236,9 +211,6 @@ static void server_cb(struct uloop_fd *fd, unsigned int events) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int run_server(int port) {
 | 
					int run_server(int port) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Adding socket!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    char port_str[12];
 | 
					    char port_str[12];
 | 
				
			||||||
    sprintf(port_str, "%d", port);
 | 
					    sprintf(port_str, "%d", port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -260,9 +232,6 @@ static void client_not_be_used_read_cb(struct ustream *s, int bytes) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    len = ustream_read(s, buf, sizeof(buf));
 | 
					    len = ustream_read(s, buf, sizeof(buf));
 | 
				
			||||||
    buf[len] = '\0';
 | 
					    buf[len] = '\0';
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Read %d bytes from SSL connection: %s\n", len, buf);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void connect_cb(struct uloop_fd *f, unsigned int events) {
 | 
					static void connect_cb(struct uloop_fd *f, unsigned int events) {
 | 
				
			||||||
| 
						 | 
					@ -277,9 +246,6 @@ static void connect_cb(struct uloop_fd *f, unsigned int events) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    fprintf(stderr, "Connection established\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    uloop_fd_delete(&entry->fd);
 | 
					    uloop_fd_delete(&entry->fd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    entry->stream.stream.notify_read = client_not_be_used_read_cb;
 | 
					    entry->stream.stream.notify_read = client_not_be_used_read_cb;
 | 
				
			||||||
| 
						 | 
					@ -324,9 +290,6 @@ int add_tcp_conncection(char *ipv4, int port) {
 | 
				
			||||||
    tcp_entry->fd.cb = connect_cb;
 | 
					    tcp_entry->fd.cb = connect_cb;
 | 
				
			||||||
    uloop_fd_add(&tcp_entry->fd, ULOOP_WRITE | ULOOP_EDGE_TRIGGER);
 | 
					    uloop_fd_add(&tcp_entry->fd, ULOOP_WRITE | ULOOP_EDGE_TRIGGER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("New TCP connection to %s:%d\n", ipv4, port);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    list_add(&tcp_entry->list, &tcp_sock_list);
 | 
					    list_add(&tcp_entry->list, &tcp_sock_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					@ -358,9 +321,6 @@ void send_tcp(char *msg) {
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (con->connected) {
 | 
					            if (con->connected) {
 | 
				
			||||||
                int len_ustream = ustream_write(&con->stream.stream, final_str, final_len, 0);
 | 
					                int len_ustream = ustream_write(&con->stream.stream, final_str, final_len, 0);
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
                printf("Ustream send: %d\n", len_ustream);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
                if (len_ustream <= 0) {
 | 
					                if (len_ustream <= 0) {
 | 
				
			||||||
                    fprintf(stderr,"Ustream error(" STR_QUOTE(__LINE__) ")!\n");
 | 
					                    fprintf(stderr,"Ustream error(" STR_QUOTE(__LINE__) ")!\n");
 | 
				
			||||||
                    //ERROR HANDLING!
 | 
					                    //ERROR HANDLING!
 | 
				
			||||||
| 
						 | 
					@ -393,9 +353,6 @@ void send_tcp(char *msg) {
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (con->connected) {
 | 
					            if (con->connected) {
 | 
				
			||||||
                int len_ustream = ustream_write(&con->stream.stream, final_str, final_len, 0);
 | 
					                int len_ustream = ustream_write(&con->stream.stream, final_str, final_len, 0);
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
                printf("Ustream send: %d\n", len_ustream);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
                if (len_ustream <= 0) {
 | 
					                if (len_ustream <= 0) {
 | 
				
			||||||
                    //ERROR HANDLING!
 | 
					                    //ERROR HANDLING!
 | 
				
			||||||
                    fprintf(stderr,"Ustream error(" STR_QUOTE(__LINE__) ")!\n");
 | 
					                    fprintf(stderr,"Ustream error(" STR_QUOTE(__LINE__) ")!\n");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -479,16 +479,10 @@ static int compare_station_count(ap* ap_entry_own, ap* ap_entry_to_compare, stru
 | 
				
			||||||
    int sta_count = ap_entry_own->station_count;
 | 
					    int sta_count = ap_entry_own->station_count;
 | 
				
			||||||
    int sta_count_to_compare = ap_entry_to_compare->station_count;
 | 
					    int sta_count_to_compare = ap_entry_to_compare->station_count;
 | 
				
			||||||
    if (is_connected(ap_entry_own->bssid_addr, client_addr)) {
 | 
					    if (is_connected(ap_entry_own->bssid_addr, client_addr)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Own is already connected! Decrease counter!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        sta_count--;
 | 
					        sta_count--;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (is_connected(ap_entry_to_compare->bssid_addr, client_addr)) {
 | 
					    if (is_connected(ap_entry_to_compare->bssid_addr, client_addr)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Comparing station is already connected! Decrease counter!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        sta_count_to_compare--;
 | 
					        sta_count_to_compare--;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					#ifndef DAWN_NO_OUTPUT
 | 
				
			||||||
| 
						 | 
					@ -582,10 +576,6 @@ int better_ap_available(ap *kicking_ap, struct dawn_mac client_mac, struct kicki
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while (i != NULL && mac_is_equal_bb(i->client_addr, client_mac)) {
 | 
					    while (i != NULL && mac_is_equal_bb(i->client_addr, client_mac)) {
 | 
				
			||||||
        if (i == own_probe) {
 | 
					        if (i == own_probe) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("Own Score! Skipping!\n");
 | 
					 | 
				
			||||||
            print_probe_entry(i);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            i = i->next_probe;
 | 
					            i = i->next_probe;
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -827,11 +817,6 @@ void update_iw_info(struct dawn_mac bssid_mac) {
 | 
				
			||||||
            if (!probe_array_update_rssi(j->bssid_addr, j->client_addr, rssi, true)) {
 | 
					            if (!probe_array_update_rssi(j->bssid_addr, j->client_addr, rssi, true)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					#ifndef DAWN_NO_OUTPUT
 | 
				
			||||||
                printf("Failed to update rssi!\n");
 | 
					                printf("Failed to update rssi!\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else {
 | 
					 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
                printf("Updated rssi: %d\n", rssi);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1064,9 +1049,6 @@ int probe_array_set_all_probe_count(struct dawn_mac client_addr, uint32_t probe_
 | 
				
			||||||
    pthread_mutex_lock(&probe_array_mutex);
 | 
					    pthread_mutex_lock(&probe_array_mutex);
 | 
				
			||||||
    for (probe_entry *i = probe_set; i != NULL; i = i->next_probe) {
 | 
					    for (probe_entry *i = probe_set; i != NULL; i = i->next_probe) {
 | 
				
			||||||
        if (mac_is_equal_bb(client_addr, i->client_addr)) {
 | 
					        if (mac_is_equal_bb(client_addr, i->client_addr)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("Setting probecount for given mac!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            i->counter = probe_count;
 | 
					            i->counter = probe_count;
 | 
				
			||||||
        } else if (mac_compare_bb(client_addr, i->client_addr) > 0) {
 | 
					        } else if (mac_compare_bb(client_addr, i->client_addr) > 0) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					#ifndef DAWN_NO_OUTPUT
 | 
				
			||||||
| 
						 | 
					@ -1425,11 +1407,6 @@ void insert_macs_from_file() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Retrieved line of length %zu :\n", read);
 | 
					 | 
				
			||||||
        printf("%s", line);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Need to scanf to an array of ints as there is no byte format specifier
 | 
					        // Need to scanf to an array of ints as there is no byte format specifier
 | 
				
			||||||
        int tmp_int_mac[ETH_ALEN];
 | 
					        int tmp_int_mac[ETH_ALEN];
 | 
				
			||||||
        sscanf(line, MACSTR, STR2MAC(tmp_int_mac));
 | 
					        sscanf(line, MACSTR, STR2MAC(tmp_int_mac));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,10 +72,6 @@ int compare_essid_iwinfo(struct dawn_mac bssid_addr, struct dawn_mac bssid_addr_
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    closedir(dirp);
 | 
					    closedir(dirp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Comparing: %s with %s\n", essid, essid_to_compare);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (essid == NULL || essid_to_compare == NULL) {
 | 
					    if (essid == NULL || essid_to_compare == NULL) {
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -122,15 +118,9 @@ int get_bandwidth(const char *ifname, struct dawn_mac client_addr, float *rx_rat
 | 
				
			||||||
    iw = iwinfo_backend(ifname);
 | 
					    iw = iwinfo_backend(ifname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (iw->assoclist(ifname, buf, &len)) {
 | 
					    if (iw->assoclist(ifname, buf, &len)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        fprintf(stdout, "No information available\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        iwinfo_finish();
 | 
					        iwinfo_finish();
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    } else if (len <= 0) {
 | 
					    } else if (len <= 0) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        fprintf(stdout, "No station connected\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        iwinfo_finish();
 | 
					        iwinfo_finish();
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -362,9 +352,6 @@ int support_ht(const char *ifname) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (iw->htmodelist(ifname, &htmodes))
 | 
					    if (iw->htmodelist(ifname, &htmodes))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("No HT mode information available\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        iwinfo_finish();
 | 
					        iwinfo_finish();
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -384,7 +371,6 @@ int support_vht(const char *ifname) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (iw->htmodelist(ifname, &htmodes))
 | 
					    if (iw->htmodelist(ifname, &htmodes))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        fprintf(stderr, "No VHT mode information available\n");
 | 
					 | 
				
			||||||
        iwinfo_finish();
 | 
					        iwinfo_finish();
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -228,10 +228,6 @@ int handle_deauth_req(struct blob_attr* msg) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pthread_mutex_unlock(&client_array_mutex);
 | 
					    pthread_mutex_unlock(&client_array_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("[WC] Deauth: %s\n", "deauth");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -349,14 +349,8 @@ int parse_to_beacon_rep(struct blob_attr *msg) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // HACKY WORKAROUND!
 | 
					    // HACKY WORKAROUND!
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Try update RCPI and RSNI for beacon report!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    if(!probe_array_update_rcpi_rsni(msg_bssid, msg_client, rcpi, rsni, true))
 | 
					    if(!probe_array_update_rcpi_rsni(msg_bssid, msg_client, rcpi, rsni, true))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Beacon: No Probe Entry Existing!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        probe_entry* beacon_rep = dawn_malloc(sizeof(probe_entry));
 | 
					        probe_entry* beacon_rep = dawn_malloc(sizeof(probe_entry));
 | 
				
			||||||
        probe_entry* beacon_rep_updated = NULL;
 | 
					        probe_entry* beacon_rep_updated = NULL;
 | 
				
			||||||
| 
						 | 
					@ -380,9 +374,6 @@ int parse_to_beacon_rep(struct blob_attr *msg) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        beacon_rep->ht_capabilities = false; // that is very problematic!!!
 | 
					        beacon_rep->ht_capabilities = false; // that is very problematic!!!
 | 
				
			||||||
        beacon_rep->vht_capabilities = false; // that is very problematic!!!
 | 
					        beacon_rep->vht_capabilities = false; // that is very problematic!!!
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Inserting to array!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO: kept original code order here - send on network first to simplify?
 | 
					        // TODO: kept original code order here - send on network first to simplify?
 | 
				
			||||||
        beacon_rep_updated = insert_to_array(beacon_rep, false, false, true, time(0));
 | 
					        beacon_rep_updated = insert_to_array(beacon_rep, false, false, true, time(0));
 | 
				
			||||||
| 
						 | 
					@ -425,25 +416,12 @@ bool discard_entry = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // block if entry was not already found in probe database
 | 
					        // block if entry was not already found in probe database
 | 
				
			||||||
        if (tmp == NULL || !decide_function(tmp, REQ_TYPE_AUTH)) {
 | 
					        if (tmp == NULL || !decide_function(tmp, REQ_TYPE_AUTH)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            if (tmp != NULL)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                printf("Entry found\n");
 | 
					 | 
				
			||||||
                printf("Deny authentication!\n");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (dawn_metric.use_driver_recog) {
 | 
					            if (dawn_metric.use_driver_recog) {
 | 
				
			||||||
                if (auth_req == insert_to_denied_req_array(auth_req, 1, time(0)))
 | 
					                if (auth_req == insert_to_denied_req_array(auth_req, 1, time(0)))
 | 
				
			||||||
                    discard_entry = false;
 | 
					                    discard_entry = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ret = dawn_metric.deny_auth_reason;
 | 
					            ret = dawn_metric.deny_auth_reason;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            // maybe send here that the client is connected?
 | 
					 | 
				
			||||||
            printf("Allow authentication!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (discard_entry)
 | 
					    if (discard_entry)
 | 
				
			||||||
| 
						 | 
					@ -478,25 +456,12 @@ int discard_entry = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // block if entry was not already found in probe database
 | 
					        // block if entry was not already found in probe database
 | 
				
			||||||
        if (tmp == NULL || !decide_function(tmp, REQ_TYPE_ASSOC)) {
 | 
					        if (tmp == NULL || !decide_function(tmp, REQ_TYPE_ASSOC)) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            if (tmp != NULL)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                printf("Entry found\n");
 | 
					 | 
				
			||||||
                print_probe_entry(tmp);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            printf("Deny associtation!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            if (dawn_metric.use_driver_recog) {
 | 
					            if (dawn_metric.use_driver_recog) {
 | 
				
			||||||
                if (auth_req == insert_to_denied_req_array(auth_req, 1, time(0)))
 | 
					                if (auth_req == insert_to_denied_req_array(auth_req, 1, time(0)))
 | 
				
			||||||
                    discard_entry = false;
 | 
					                    discard_entry = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return dawn_metric.deny_assoc_reason;
 | 
					            return dawn_metric.deny_assoc_reason;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            printf("Allow association!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (discard_entry)
 | 
					    if (discard_entry)
 | 
				
			||||||
| 
						 | 
					@ -535,13 +500,7 @@ static int handle_probe_req(struct blob_attr *msg) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int handle_beacon_rep(struct blob_attr *msg) {
 | 
					static int handle_beacon_rep(struct blob_attr *msg) {
 | 
				
			||||||
    if (parse_to_beacon_rep(msg) == 0) {
 | 
					    if (parse_to_beacon_rep(msg) == 0) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Inserting beacon Report!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        // insert_to_array(beacon_rep, 1);
 | 
					        // insert_to_array(beacon_rep, 1);
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Sending via network!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        // send_blob_attr_via_network(msg, "beacon-report");
 | 
					        // send_blob_attr_via_network(msg, "beacon-report");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					@ -632,9 +591,6 @@ int dawn_init_ubus(const char *ubus_socket, const char *hostapd_dir) {
 | 
				
			||||||
        fprintf(stderr, "Failed to connect to ubus\n");
 | 
					        fprintf(stderr, "Failed to connect to ubus\n");
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Connected to ubus\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        dawn_regmem(ctx);
 | 
					        dawn_regmem(ctx);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -791,9 +747,6 @@ static void ubus_get_rrm_cb(struct ubus_request *req, int type, struct blob_attr
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            char* neighborreport = blobmsg_get_string(attr);
 | 
					            char* neighborreport = blobmsg_get_string(attr);
 | 
				
			||||||
            strcpy(entry->neighbor_report,neighborreport);
 | 
					            strcpy(entry->neighbor_report,neighborreport);
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("Copied Neighborreport: %s,\n", entry->neighbor_report);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
         i++;
 | 
					         i++;
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
| 
						 | 
					@ -862,9 +815,6 @@ static int get_mode_from_capability(int capability) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ubus_send_beacon_report(client *c, ap *a, int id)
 | 
					void ubus_send_beacon_report(client *c, ap *a, int id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Crafting Beacon Report\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    int timeout = 1;
 | 
					    int timeout = 1;
 | 
				
			||||||
    blob_buf_init(&b_beacon, 0);
 | 
					    blob_buf_init(&b_beacon, 0);
 | 
				
			||||||
    blobmsg_add_macaddr(&b_beacon, "addr", c->client_addr);
 | 
					    blobmsg_add_macaddr(&b_beacon, "addr", c->client_addr);
 | 
				
			||||||
| 
						 | 
					@ -874,9 +824,6 @@ void ubus_send_beacon_report(client *c, ap *a, int id)
 | 
				
			||||||
    blobmsg_add_u32(&b_beacon, "mode", get_mode_from_capability(c->rrm_enabled_capa));
 | 
					    blobmsg_add_u32(&b_beacon, "mode", get_mode_from_capability(c->rrm_enabled_capa));
 | 
				
			||||||
    blobmsg_add_string(&b_beacon, "ssid", (char*)a->ssid);
 | 
					    blobmsg_add_string(&b_beacon, "ssid", (char*)a->ssid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Invoking beacon report!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    ubus_invoke(ctx, id, "rrm_beacon_req", b_beacon.head, NULL, NULL, timeout * 1000);
 | 
					    ubus_invoke(ctx, id, "rrm_beacon_req", b_beacon.head, NULL, NULL, timeout * 1000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -887,16 +834,10 @@ void update_beacon_reports(struct uloop_timeout *t) {
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Sending beacon report!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    struct hostapd_sock_entry *sub;
 | 
					    struct hostapd_sock_entry *sub;
 | 
				
			||||||
    list_for_each_entry(sub, &hostapd_sock_list, list)
 | 
					    list_for_each_entry(sub, &hostapd_sock_list, list)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (sub->subscribed && (a = ap_array_get_ap(sub->bssid_addr, (uint8_t*)sub->ssid))) {
 | 
					        if (sub->subscribed && (a = ap_array_get_ap(sub->bssid_addr, (uint8_t*)sub->ssid))) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
            printf("Sending beacon report Sub!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            send_beacon_reports(a, sub->id);
 | 
					            send_beacon_reports(a, sub->id);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -1131,25 +1072,15 @@ int parse_add_mac_to_file(struct blob_attr *msg) {
 | 
				
			||||||
    struct blob_attr *tb[__ADD_DEL_MAC_MAX];
 | 
					    struct blob_attr *tb[__ADD_DEL_MAC_MAX];
 | 
				
			||||||
    struct blob_attr *attr;
 | 
					    struct blob_attr *attr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Parsing MAC!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    blobmsg_parse(add_del_policy, __ADD_DEL_MAC_MAX, tb, blob_data(msg), blob_len(msg));
 | 
					    blobmsg_parse(add_del_policy, __ADD_DEL_MAC_MAX, tb, blob_data(msg), blob_len(msg));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!tb[MAC_ADDR])
 | 
					    if (!tb[MAC_ADDR])
 | 
				
			||||||
        return UBUS_STATUS_INVALID_ARGUMENT;
 | 
					        return UBUS_STATUS_INVALID_ARGUMENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int len = blobmsg_data_len(tb[MAC_ADDR]);
 | 
					    int len = blobmsg_data_len(tb[MAC_ADDR]);
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Length of array maclist: %d\n", len);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __blob_for_each_attr(attr, blobmsg_data(tb[MAC_ADDR]), len)
 | 
					    __blob_for_each_attr(attr, blobmsg_data(tb[MAC_ADDR]), len)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("Iteration through MAC-list\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        struct dawn_mac addr;
 | 
					        struct dawn_mac addr;
 | 
				
			||||||
        hwaddr_aton(blobmsg_data(attr), addr.u8);
 | 
					        hwaddr_aton(blobmsg_data(attr), addr.u8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1259,16 +1190,10 @@ static void enable_rrm(uint32_t id) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void hostapd_handle_remove(struct ubus_context *ctx,
 | 
					static void hostapd_handle_remove(struct ubus_context *ctx,
 | 
				
			||||||
                                  struct ubus_subscriber *s, uint32_t id) {
 | 
					                                  struct ubus_subscriber *s, uint32_t id) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    fprintf(stdout, "Object %08x went away\n", id);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    struct hostapd_sock_entry *hostapd_sock = container_of(s,
 | 
					    struct hostapd_sock_entry *hostapd_sock = container_of(s,
 | 
				
			||||||
    struct hostapd_sock_entry, subscriber);
 | 
					    struct hostapd_sock_entry, subscriber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (hostapd_sock->id != id) {
 | 
					    if (hostapd_sock->id != id) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
        printf("ID is not the same!\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1311,10 +1236,6 @@ bool subscribe(struct hostapd_sock_entry *hostapd_entry) {
 | 
				
			||||||
    enable_rrm(hostapd_entry->id);
 | 
					    enable_rrm(hostapd_entry->id);
 | 
				
			||||||
    ubus_get_rrm();
 | 
					    ubus_get_rrm();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    printf("Subscribed to: %s\n", hostapd_entry->iface_name);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1501,9 +1422,6 @@ int uci_send_via_network()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int build_hearing_map_sort_client(struct blob_buf *b) {
 | 
					int build_hearing_map_sort_client(struct blob_buf *b) {
 | 
				
			||||||
#ifndef DAWN_NO_OUTPUT
 | 
					 | 
				
			||||||
    print_probe_array();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    pthread_mutex_lock(&probe_array_mutex);
 | 
					    pthread_mutex_lock(&probe_array_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void *client_list, *ap_list, *ssid_list;
 | 
					    void *client_list, *ap_list, *ssid_list;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue