diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60af1a4..858b701 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,7 @@ SET(SOURCES network/tcpsocket.c include/dawn_iwinfo.h - utils/dawn_iwinfo.c) + utils/dawn_iwinfo.c utils/ieee80211_utils.c include/ieee80211_utils.h) SET(LIBS ubox ubus json-c blobmsg_json config uci gcrypt iwinfo) diff --git a/src/include/datastorage.h b/src/include/datastorage.h index 46e102c..f8331b0 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -106,6 +106,7 @@ typedef struct probe_entry_s { time_t time; int counter; int deny_counter; + uint8_t max_supp_datarate; } probe_entry; typedef struct auth_entry_s { diff --git a/src/include/ieee80211_utils.h b/src/include/ieee80211_utils.h new file mode 100644 index 0000000..d8892a2 --- /dev/null +++ b/src/include/ieee80211_utils.h @@ -0,0 +1,12 @@ +// +// Created by nick on 06.02.18. +// + +#ifndef DAWN_IEEE80211_UTILS_H +#define DAWN_IEEE80211_UTILS_H + +#include + +double iee80211_calculate_bitrate(uint8_t supp_rate_val); + +#endif //DAWN_IEEE80211_UTILS_H diff --git a/src/utils/ieee80211_utils.c b/src/utils/ieee80211_utils.c new file mode 100644 index 0000000..8b77207 --- /dev/null +++ b/src/utils/ieee80211_utils.c @@ -0,0 +1,11 @@ +// +// Created by nick on 06.02.18. +// +#include "ieee80211_utils.h" + +#include + +double iee80211_calculate_bitrate(uint8_t supp_rate_val) +{ + return ((double) supp_rate_val) / 2; +} \ No newline at end of file diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 786f8ac..9189a51 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -97,6 +97,8 @@ enum { PROB_FREQ, PROB_HT_SUPPORT, PROB_VHT_SUPPORT, + PROB_SUPP_RATES, + PROB_EXT_SUPP_RATES, __PROB_MAX, }; @@ -108,6 +110,8 @@ static const struct blobmsg_policy prob_policy[__PROB_MAX] = { [PROB_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32}, [PROB_HT_SUPPORT] = {.name = "ht_support", .type = BLOBMSG_TYPE_INT8}, [PROB_VHT_SUPPORT] = {.name = "vht_support", .type = BLOBMSG_TYPE_INT8}, + [PROB_SUPP_RATES] = {.name = "supp_rates", .type = BLOBMSG_TYPE_ARRAY}, + [PROB_EXT_SUPP_RATES] = {.name = "ext_supp_rates", .type = BLOBMSG_TYPE_ARRAY}, }; enum { @@ -403,6 +407,25 @@ int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req) { prob_req->vht_support = blobmsg_get_u8(tb[PROB_VHT_SUPPORT]); } + if (tb[PROB_EXT_SUPP_RATES]) { + struct blob_attr *attr; + int len = blobmsg_data_len(tb[PROB_EXT_SUPP_RATES]); + struct blob_attr *data = blobmsg_data(tb[PROB_EXT_SUPP_RATES]); + __blob_for_each_attr(attr, data, len) + { + printf("EXT Supp Rates: %d\n", blobmsg_get_u8(attr)); + } + } + + if (tb[PROB_SUPP_RATES]) { + struct blob_attr *attr; + //struct blobmsg_hdr *hdr; + int len = blobmsg_data_len(tb[PROB_SUPP_RATES]); + blobmsg_for_each_attr(attr, blobmsg_data(tb[PROB_SUPP_RATES]), len) + { + printf("Supp Rates: %d\n", blobmsg_get_u8(attr)); + } + } return 0; }