Merge branch 'master' into feature/remove_client_when_deauth_disassoc

This commit is contained in:
PolynomialDivision 2017-12-22 18:59:09 +01:00
commit 122de4089f
20 changed files with 730 additions and 535 deletions

View file

@ -9,7 +9,7 @@ char *unbase_64(unsigned char *input, int length);
void gcrypt_init();
void gcrypt_set_key_and_iv(char *key, char *iv);
void gcrypt_set_key_and_iv(const char *key, const char *iv);
//char *gcrypt_encrypt_msg(char *msg, size_t msg_length);
char *gcrypt_encrypt_msg(char *msg, size_t msg_length, int *out_length);

View file

@ -8,14 +8,30 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <libubox/blobmsg_json.h>
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/* Mac */
// ---------------- Defines -------------------
#define MAC_LIST_LENGTH 100
// ---------------- Structs ----------------
uint8_t mac_list[MAC_LIST_LENGTH][ETH_ALEN];
// ---------------- Functions ----------
void insert_macs_from_file();
int insert_to_maclist(uint8_t mac[]);
/* Metric */
struct probe_metric_s dawn_metric;
// ---------------- Structs ----------------
struct probe_metric_s {
int ht_support;
@ -33,6 +49,8 @@ struct probe_metric_s {
int max_chan_util_val;
int min_probe_count;
int bandwith_threshold;
int use_station_count;
int eval_probe_req;
};
struct time_config_s {
@ -43,6 +61,15 @@ struct time_config_s {
time_t update_hostapd;
};
struct network_config_s {
const char* broadcast_ip;
int broadcast_port;
const char* multicast;
const char* shared_key;
const char* iv;
int bool_multicast;
};
struct time_config_s timeout_config;
// ---------------- Global variables ----------------
@ -133,6 +160,7 @@ typedef struct ap_s {
uint8_t vht;
uint32_t channel_utilization;
time_t time;
uint32_t station_count;
} ap;
// ---------------- Defines ----------------
@ -168,6 +196,10 @@ void print_ap_array();
ap ap_array_get_ap(uint8_t bssid_addr[]);
int build_hearing_map_sort_client(struct blob_buf *b);
int build_network_overview(struct blob_buf *b);
/* Utils */
// ---------------- Defines -------------------
@ -175,14 +207,14 @@ ap ap_array_get_ap(uint8_t bssid_addr[]);
#define TIME_THRESHOLD 120 // every minute
// ---------------- Global variables ----------------
char sort_string[SORT_NUM];
char* sort_string;
// ---------------- Functions -------------------
int mac_is_equal(uint8_t addr1[], uint8_t addr2[]);
int mac_is_greater(uint8_t addr1[], uint8_t addr2[]);
int better_ap_available(uint8_t bssid_addr[], uint8_t client_addr[]);
int better_ap_available(uint8_t bssid_addr[], uint8_t client_addr[], int automatic_kick);
/* List stuff */

View file

@ -5,4 +5,14 @@ struct probe_metric_s uci_get_dawn_metric();
struct time_config_s uci_get_time_config();
struct network_config_s uci_get_dawn_network();
const char* uci_get_dawn_hostapd_dir();
const char* uci_get_dawn_sort_order();
int uci_init();
int uci_clear();
#endif //DAWN_UCI_H_H

View file

@ -5,7 +5,7 @@
pthread_mutex_t send_mutex;
int init_socket_runopts(char *_ip, char *_port, int _multicast_socket);
int init_socket_runopts(const char *_ip, int _port, int _multicast_socket);
int send_string(char *msg);

View file

@ -6,9 +6,7 @@
#include "datastorage.h"
#define MIN_PROBE_REQ 2 // TODO: Parse from config file...
int dawn_init_ubus(const char *ubus_socket, char *hostapd_dir);
int dawn_init_ubus(const char *ubus_socket, const char *hostapd_dir);
int parse_to_probe_req(struct blob_attr *msg, probe_entry *prob_req);
@ -26,7 +24,7 @@ void del_client_all_interfaces(const uint8_t *client_addr, uint32_t reason, uint
void *update_clients_thread(void *arg);
char *hostapd_dir_glob;
const char *hostapd_dir_glob;
int ubus_call_umdns();
@ -40,4 +38,6 @@ int handle_network_msg(char* msg);
int send_blob_attr_via_network(struct blob_attr *msg, char* method);
void blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const uint8_t *addr);
#endif

View file

@ -15,4 +15,6 @@ int hwaddr_aton(const char *txt, uint8_t *addr);
int convert_mac(char *in, char *out);
void write_mac_to_file(char* path, uint8_t addr[]);
#endif