mirror of
				https://github.com/berlin-open-wireless-lab/DAWN.git
				synced 2025-03-09 15:40:12 +00:00 
			
		
		
		
	treewide: cleanup code
- Remove some unused data fields - Fix a few typos in comments, etc [cleanup commit message] Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
		
							parent
							
								
									8064e56899
								
							
						
					
					
						commit
						ba305bb2c2
					
				
					 7 changed files with 7 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -70,7 +70,6 @@ struct probe_metric_s {
 | 
			
		|||
    int eval_assoc_req;
 | 
			
		||||
    int deny_auth_reason;
 | 
			
		||||
    int deny_assoc_reason;
 | 
			
		||||
    int use_driver_recog;
 | 
			
		||||
    int min_number_to_kick; // kick_clients()
 | 
			
		||||
    int chan_util_avg_period;
 | 
			
		||||
    int set_hostapd_nr;
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +107,6 @@ struct time_config_s {
 | 
			
		|||
    time_t remove_ap;
 | 
			
		||||
    time_t update_hostapd;
 | 
			
		||||
    time_t update_tcp_con;
 | 
			
		||||
    time_t denied_req_threshold;
 | 
			
		||||
    time_t update_chan_util;
 | 
			
		||||
    time_t update_beacon_reports;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -263,8 +261,6 @@ typedef struct ap_s {
 | 
			
		|||
    char neighbor_report[NEIGHBOR_REPORT_LEN + 1]; // (1)  // This is the self-NR of the AP
 | 
			
		||||
    uint32_t op_class; // ubus_send_beacon_report() // (1)
 | 
			
		||||
    uint32_t channel; // ubus_send_beacon_report() // (1)
 | 
			
		||||
    //uint32_t collision_domain;  // TODO: ap_get_collision_count() never evaluated?
 | 
			
		||||
    //uint32_t bandwidth; // TODO: Never evaluated?
 | 
			
		||||
    uint32_t ap_weight; // eval_probe_metric() // (1)
 | 
			
		||||
    char iface[MAX_INTERFACE_NAME]; // (1)
 | 
			
		||||
    char hostname[HOST_NAME_MAX]; // (1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,8 +212,6 @@ int eval_probe_metric(struct probe_entry_s* probe_entry, ap* ap_entry) {
 | 
			
		|||
 | 
			
		||||
    int band, score = 0;
 | 
			
		||||
 | 
			
		||||
    dawnlog_debug_func("Entering...");
 | 
			
		||||
 | 
			
		||||
    // TODO: Should RCPI be used here as well?
 | 
			
		||||
    band = get_band(probe_entry->freq);
 | 
			
		||||
    score = dawn_metric.initial_score[band];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -584,7 +584,6 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity)
 | 
			
		|||
                    dawn_metric.eval_assoc_req = 1;
 | 
			
		||||
                    dawn_metric.deny_auth_reason = 1;
 | 
			
		||||
                    dawn_metric.deny_assoc_reason = 17;
 | 
			
		||||
                    dawn_metric.use_driver_recog = 1;
 | 
			
		||||
                    dawn_metric.min_number_to_kick = 3;
 | 
			
		||||
                    dawn_metric.chan_util_avg_period = 3;
 | 
			
		||||
                    dawn_metric.set_hostapd_nr = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -621,7 +620,6 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity)
 | 
			
		|||
                else if (!strncmp(fn, "eval_assoc_req=", 15)) load_int(&dawn_metric.eval_assoc_req, fn + 15);
 | 
			
		||||
                else if (!strncmp(fn, "deny_auth_reason=", 17)) load_int(&dawn_metric.deny_auth_reason, fn + 17);
 | 
			
		||||
                else if (!strncmp(fn, "deny_assoc_reason=", 18)) load_int(&dawn_metric.deny_assoc_reason, fn + 18);
 | 
			
		||||
                else if (!strncmp(fn, "use_driver_recog=", 17)) load_int(&dawn_metric.use_driver_recog, fn + 17);
 | 
			
		||||
                else if (!strncmp(fn, "min_number_to_kick=", 19)) load_int(&dawn_metric.min_number_to_kick, fn + 19);
 | 
			
		||||
                else if (!strncmp(fn, "chan_util_avg_period=", 21)) load_int(&dawn_metric.chan_util_avg_period, fn + 21);
 | 
			
		||||
                else if (!strncmp(fn, "set_hostapd_nr=", 15)) load_int(&dawn_metric.set_hostapd_nr, fn + 15);
 | 
			
		||||
| 
						 | 
				
			
			@ -695,8 +693,6 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity)
 | 
			
		|||
                else if (!strncmp(fn, "stations=", 9)) load_u32(&ap0->station_count, fn + 9);
 | 
			
		||||
                else if (!strncmp(fn, "ssid=", 5)) load_ssid(ap0->ssid, fn + 5);
 | 
			
		||||
                else if (!strncmp(fn, "neighbors=", 10)) load_string(NEIGHBOR_REPORT_LEN, ap0->neighbor_report, fn + 10);
 | 
			
		||||
                //else if (!strncmp(fn, "col_d=", 6)) load_u32(&ap0->collision_domain, fn + 6);
 | 
			
		||||
                //else if (!strncmp(fn, "bandwidth=", 10)) load_u32(&ap0->bandwidth, fn + 10);
 | 
			
		||||
                else if (!strncmp(fn, "weight=", 7)) load_u32(&ap0->ap_weight, fn + 7);
 | 
			
		||||
                else {
 | 
			
		||||
                    printf("ERROR: Loading AP, but don't recognise assignment \"%s\"\n", fn);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,7 +77,6 @@ struct time_config_s uci_get_time_config() {
 | 
			
		|||
        .update_hostapd = 10,
 | 
			
		||||
        .remove_ap = 460,
 | 
			
		||||
        .update_tcp_con = 10,
 | 
			
		||||
        .denied_req_threshold = 30,
 | 
			
		||||
        .update_chan_util = 5,
 | 
			
		||||
        .update_beacon_reports = 20,
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +95,6 @@ struct time_config_s uci_get_time_config() {
 | 
			
		|||
            DAWN_SET_CONFIG_TIME(ret, s, update_hostapd);
 | 
			
		||||
            DAWN_SET_CONFIG_TIME(ret, s, remove_ap);
 | 
			
		||||
            DAWN_SET_CONFIG_TIME(ret, s, update_tcp_con);
 | 
			
		||||
            DAWN_SET_CONFIG_TIME(ret, s, denied_req_threshold);
 | 
			
		||||
            DAWN_SET_CONFIG_TIME(ret, s, update_chan_util);
 | 
			
		||||
            DAWN_SET_CONFIG_TIME(ret, s, update_beacon_reports);
 | 
			
		||||
            return ret;
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +242,6 @@ struct probe_metric_s uci_get_dawn_metric() {
 | 
			
		|||
        .disassoc_nr_length = 6,
 | 
			
		||||
        .max_station_diff = 1,
 | 
			
		||||
        .bandwidth_threshold = 6,
 | 
			
		||||
        .use_driver_recog = 1,
 | 
			
		||||
        .chan_util_avg_period = 3,
 | 
			
		||||
        .duration = 0,
 | 
			
		||||
        .rrm_mode_mask = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE |
 | 
			
		||||
| 
						 | 
				
			
			@ -299,7 +296,6 @@ struct probe_metric_s uci_get_dawn_metric() {
 | 
			
		|||
        DAWN_SET_CONFIG_INT(ret, global_s, disassoc_nr_length);
 | 
			
		||||
        DAWN_SET_CONFIG_INT(ret, global_s, max_station_diff);
 | 
			
		||||
        DAWN_SET_CONFIG_INT(ret, global_s, bandwidth_threshold);
 | 
			
		||||
        DAWN_SET_CONFIG_INT(ret, global_s, use_driver_recog);
 | 
			
		||||
        DAWN_SET_CONFIG_INT(ret, global_s, chan_util_avg_period);
 | 
			
		||||
        DAWN_SET_CONFIG_INT(ret, global_s, duration);
 | 
			
		||||
        ret.rrm_mode_mask = parse_rrm_mode(ret.rrm_mode_order,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ double iee80211_calculate_expected_throughput_mbit(int exp_thr) {
 | 
			
		|||
    return (((double) exp_thr) / 1000);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FIXME: This calculation seems to be unreliable.  Is it device specific?
 | 
			
		||||
int rcpi_to_rssi(int rcpi)
 | 
			
		||||
{
 | 
			
		||||
    return rcpi / 2 - 110;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -681,7 +681,6 @@ static const struct blobmsg_policy uci_metric_policy[__UCI_METRIC_MAX] = {
 | 
			
		|||
        [UCI_KICKING_THRESHOLD] = {.name = "kicking_threshold", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_DENY_AUTH_REASON] = {.name = "deny_auth_reason", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_DENY_ASSOC_REASON] = {.name = "deny_assoc_reason", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_USE_DRIVER_RECOG] = {.name = "use_driver_recog", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_MIN_NUMBER_TO_KICK] = {.name = "min_number_to_kick", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_CHAN_UTIL_AVG_PERIOD] = {.name = "chan_util_avg_period", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
        [UCI_SET_HOSTAPD_NR] = {.name = "set_hostapd_nr", .type = BLOBMSG_TYPE_INT32},
 | 
			
		||||
| 
						 | 
				
			
			@ -776,9 +775,6 @@ static int handle_uci_config(struct blob_attr* msg) {
 | 
			
		|||
    sprintf(cmd_buffer, "dawn.global.deny_assoc_reason=%d", blobmsg_get_u32(tb_metric[UCI_DENY_ASSOC_REASON]));
 | 
			
		||||
    uci_set_network(cmd_buffer);
 | 
			
		||||
 | 
			
		||||
    sprintf(cmd_buffer, "dawn.global.use_driver_recog=%d", blobmsg_get_u32(tb_metric[UCI_USE_DRIVER_RECOG]));
 | 
			
		||||
    uci_set_network(cmd_buffer);
 | 
			
		||||
 | 
			
		||||
    sprintf(cmd_buffer, "dawn.global.min_number_to_kick=%d", blobmsg_get_u32(tb_metric[UCI_MIN_NUMBER_TO_KICK]));
 | 
			
		||||
    uci_set_network(cmd_buffer);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -446,7 +446,7 @@ static int handle_assoc_req(struct blob_attr *msg) {
 | 
			
		|||
            }
 | 
			
		||||
            else if (own_probe->counter < dawn_metric.min_probe_count) {
 | 
			
		||||
                dawnlog_trace(MACSTR " Deny association due to low probe count", MAC2STR(assoc_req->client_addr.u8));
 | 
			
		||||
                ret = dawn_metric.deny_auth_reason;
 | 
			
		||||
                ret = dawn_metric.deny_assoc_reason;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -1009,7 +1009,6 @@ void ubus_send_beacon_request(client *c, ap *a, int id)
 | 
			
		|||
    struct blob_buf b = {0};
 | 
			
		||||
    dawnlog_debug_func("Entering...");
 | 
			
		||||
 | 
			
		||||
    dawnlog_debug("Crafting Beacon Report\n");
 | 
			
		||||
    int timeout = 1;
 | 
			
		||||
 | 
			
		||||
    blob_buf_init(&b, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1038,18 +1037,18 @@ void update_beacon_reports(struct uloop_timeout *t) {
 | 
			
		|||
    }
 | 
			
		||||
    dawnlog_debug("Sending beacon requests!\n");
 | 
			
		||||
    struct hostapd_sock_entry *sub;
 | 
			
		||||
    dawn_mutex_lock(&ap_array_mutex);
 | 
			
		||||
 | 
			
		||||
    list_for_each_entry(sub, &hostapd_sock_list, list)
 | 
			
		||||
    {
 | 
			
		||||
        dawn_mutex_lock(&ap_array_mutex);
 | 
			
		||||
 | 
			
		||||
        dawn_mutex_require(&ap_array_mutex);
 | 
			
		||||
        if (sub->subscribed && (a = ap_array_get_ap(sub->bssid_addr))) {
 | 
			
		||||
            dawnlog_debug("Sending beacon request Sub!\n");
 | 
			
		||||
            send_beacon_requests(a, sub->id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        dawn_mutex_unlock(&ap_array_mutex);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dawn_mutex_unlock(&ap_array_mutex);
 | 
			
		||||
    uloop_timeout_set(&beacon_reports_timer, timeout_config.update_beacon_reports * 1000);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1713,7 +1712,6 @@ int uci_send_via_network()
 | 
			
		|||
    blobmsg_add_u32(&b, "kicking_threshold", dawn_metric.kicking_threshold);
 | 
			
		||||
    blobmsg_add_u32(&b, "deny_auth_reason", dawn_metric.deny_auth_reason);
 | 
			
		||||
    blobmsg_add_u32(&b, "deny_assoc_reason", dawn_metric.deny_assoc_reason);
 | 
			
		||||
    blobmsg_add_u32(&b, "use_driver_recog", dawn_metric.use_driver_recog);
 | 
			
		||||
    blobmsg_add_u32(&b, "min_number_to_kick", dawn_metric.min_number_to_kick);
 | 
			
		||||
    blobmsg_add_u32(&b, "chan_util_avg_period", dawn_metric.chan_util_avg_period);
 | 
			
		||||
    blobmsg_add_u32(&b, "set_hostapd_nr", dawn_metric.set_hostapd_nr);
 | 
			
		||||
| 
						 | 
				
			
			@ -1748,7 +1746,6 @@ int uci_send_via_network()
 | 
			
		|||
 | 
			
		||||
    times = blobmsg_open_table(&b, "times");
 | 
			
		||||
    blobmsg_add_u32(&b, "update_client", timeout_config.update_client);
 | 
			
		||||
    blobmsg_add_u32(&b, "denied_req_threshold", timeout_config.denied_req_threshold);
 | 
			
		||||
    blobmsg_add_u32(&b, "remove_client", timeout_config.remove_client);
 | 
			
		||||
    blobmsg_add_u32(&b, "remove_probe", timeout_config.remove_probe);
 | 
			
		||||
    blobmsg_add_u32(&b, "remove_ap", timeout_config.remove_ap);
 | 
			
		||||
| 
						 | 
				
			
			@ -1810,7 +1807,7 @@ int build_hearing_map_sort_client(struct blob_buf *b) {
 | 
			
		|||
    if (dawnlog_showing(DAWNLOG_DEBUG))
 | 
			
		||||
        print_probe_array();
 | 
			
		||||
 | 
			
		||||
    // Build a linked list of probe entried in correct order for hearing map
 | 
			
		||||
    // Build a linked list of probe entries in correct order for hearing map
 | 
			
		||||
    struct probe_sort_entry *hearing_list = NULL;
 | 
			
		||||
    dawn_mutex_require(&probe_array_mutex);
 | 
			
		||||
    probe_entry* i = probe_set.first_probe;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue