003 File Manager
Current Path:
/usr/src/contrib/wpa/src/ap
usr
/
src
/
contrib
/
wpa
/
src
/
ap
/
π
..
π
accounting.c
(14.53 KB)
π
accounting.h
(1.12 KB)
π
acs.c
(29.71 KB)
π
acs.h
(764 B)
π
airtime_policy.c
(6.82 KB)
π
airtime_policy.h
(1.27 KB)
π
ap_config.c
(33.39 KB)
π
ap_config.h
(26.53 KB)
π
ap_drv_ops.c
(25.84 KB)
π
ap_drv_ops.h
(13.38 KB)
π
ap_list.c
(6.82 KB)
π
ap_list.h
(1.5 KB)
π
ap_mlme.c
(5.64 KB)
π
ap_mlme.h
(1007 B)
π
authsrv.c
(8.72 KB)
π
authsrv.h
(352 B)
π
beacon.c
(40.32 KB)
π
beacon.h
(1.25 KB)
π
bss_load.c
(2.4 KB)
π
bss_load.h
(376 B)
π
ctrl_iface_ap.c
(24.3 KB)
π
ctrl_iface_ap.h
(1.61 KB)
π
dfs.c
(29.35 KB)
π
dfs.h
(1.22 KB)
π
dhcp_snoop.c
(3.36 KB)
π
dhcp_snoop.h
(590 B)
π
dpp_hostapd.c
(48.28 KB)
π
dpp_hostapd.h
(1.74 KB)
π
drv_callbacks.c
(51.68 KB)
π
eap_user_db.c
(7.92 KB)
π
eth_p_oui.c
(4.44 KB)
π
eth_p_oui.h
(958 B)
π
fils_hlp.c
(16.82 KB)
π
fils_hlp.h
(547 B)
π
gas_query_ap.c
(19.53 KB)
π
gas_query_ap.h
(1.24 KB)
π
gas_serv.c
(50.48 KB)
π
gas_serv.h
(3.38 KB)
π
hostapd.c
(89.58 KB)
π
hostapd.h
(17.99 KB)
π
hs20.c
(6.27 KB)
π
hs20.h
(843 B)
π
hw_features.c
(24.77 KB)
π
hw_features.h
(1.93 KB)
π
iapp.c
(14.59 KB)
π
iapp.h
(833 B)
π
ieee802_11.c
(148.71 KB)
π
ieee802_11.h
(7.97 KB)
π
ieee802_11_auth.c
(18.3 KB)
π
ieee802_11_auth.h
(1.04 KB)
π
ieee802_11_he.c
(8.77 KB)
π
ieee802_11_ht.c
(16.22 KB)
π
ieee802_11_shared.c
(23.95 KB)
π
ieee802_11_vht.c
(13.4 KB)
π
ieee802_1x.c
(83.16 KB)
π
ieee802_1x.h
(2.84 KB)
π
mbo_ap.c
(5.22 KB)
π
mbo_ap.h
(1.16 KB)
π
ndisc_snoop.c
(4.3 KB)
π
ndisc_snoop.h
(838 B)
π
neighbor_db.c
(6.49 KB)
π
neighbor_db.h
(940 B)
π
p2p_hostapd.c
(2.57 KB)
π
p2p_hostapd.h
(888 B)
π
pmksa_cache_auth.c
(18.79 KB)
π
pmksa_cache_auth.h
(2.69 KB)
π
preauth_auth.c
(6.47 KB)
π
preauth_auth.h
(1.26 KB)
π
rrm.c
(17.27 KB)
π
rrm.h
(1.21 KB)
π
sta_info.c
(41.42 KB)
π
sta_info.h
(11.63 KB)
π
taxonomy.c
(7.45 KB)
π
taxonomy.h
(766 B)
π
tkip_countermeasures.c
(2.95 KB)
π
tkip_countermeasures.h
(451 B)
π
utils.c
(2.29 KB)
π
vlan.c
(756 B)
π
vlan.h
(727 B)
π
vlan_full.c
(18.35 KB)
π
vlan_ifconfig.c
(1.47 KB)
π
vlan_init.c
(5.88 KB)
π
vlan_init.h
(1.09 KB)
π
vlan_ioctl.c
(3.75 KB)
π
vlan_util.c
(3.9 KB)
π
vlan_util.h
(980 B)
π
wmm.c
(11.47 KB)
π
wmm.h
(653 B)
π
wnm_ap.c
(23.69 KB)
π
wnm_ap.h
(1.08 KB)
π
wpa_auth.c
(140.03 KB)
π
wpa_auth.h
(17.89 KB)
π
wpa_auth_ft.c
(120.89 KB)
π
wpa_auth_glue.c
(35.42 KB)
π
wpa_auth_glue.h
(443 B)
π
wpa_auth_i.h
(8.47 KB)
π
wpa_auth_ie.c
(32.38 KB)
π
wpa_auth_ie.h
(1.14 KB)
π
wpa_auth_kay.c
(12.26 KB)
π
wpa_auth_kay.h
(1.15 KB)
π
wps_hostapd.c
(54.66 KB)
π
wps_hostapd.h
(2.79 KB)
π
x_snoop.c
(3.21 KB)
π
x_snoop.h
(1.29 KB)
Editing: airtime_policy.c
/* * Airtime policy configuration * Copyright (c) 2018-2019, Toke HΓΈiland-JΓΈrgensen <toke@toke.dk> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "utils/includes.h" #include "utils/common.h" #include "utils/eloop.h" #include "hostapd.h" #include "ap_drv_ops.h" #include "sta_info.h" #include "airtime_policy.h" /* Idea: * Two modes of airtime enforcement: * 1. Static weights: specify weights per MAC address with a per-BSS default * 2. Per-BSS limits: Dynamically calculate weights of backlogged stations to * enforce relative total shares between BSSes. * * - Periodic per-station callback to update queue status. * * Copy accounting_sta_update_stats() to get TXQ info and airtime weights and * keep them updated in sta_info. * * - Separate periodic per-bss (or per-iface?) callback to update weights. * * Just need to loop through all interfaces, count sum the active stations (or * should the per-STA callback just adjust that for the BSS?) and calculate new * weights. */ static int get_airtime_policy_update_timeout(struct hostapd_iface *iface, unsigned int *sec, unsigned int *usec) { unsigned int update_int = iface->conf->airtime_update_interval; if (!update_int) { wpa_printf(MSG_ERROR, "Airtime policy: Invalid airtime policy update interval %u", update_int); return -1; } *sec = update_int / 1000; *usec = (update_int % 1000) * 1000; return 0; } static void set_new_backlog_time(struct hostapd_data *hapd, struct sta_info *sta, struct os_reltime *now) { sta->backlogged_until = *now; sta->backlogged_until.usec += hapd->iconf->airtime_update_interval * AIRTIME_BACKLOG_EXPIRY_FACTOR; while (sta->backlogged_until.usec >= 1000000) { sta->backlogged_until.sec++; sta->backlogged_until.usec -= 1000000; } } static void count_backlogged_sta(struct hostapd_data *hapd) { struct sta_info *sta; struct hostap_sta_driver_data data = {}; unsigned int num_backlogged = 0; struct os_reltime now; os_get_reltime(&now); for (sta = hapd->sta_list; sta; sta = sta->next) { if (hostapd_drv_read_sta_data(hapd, &data, sta->addr)) continue; if (data.backlog_bytes > 0) set_new_backlog_time(hapd, sta, &now); if (os_reltime_before(&now, &sta->backlogged_until)) num_backlogged++; } hapd->num_backlogged_sta = num_backlogged; } static int sta_set_airtime_weight(struct hostapd_data *hapd, struct sta_info *sta, unsigned int weight) { int ret = 0; if (weight != sta->airtime_weight && (ret = hostapd_sta_set_airtime_weight(hapd, sta->addr, weight))) return ret; sta->airtime_weight = weight; return ret; } static void set_sta_weights(struct hostapd_data *hapd, unsigned int weight) { struct sta_info *sta; for (sta = hapd->sta_list; sta; sta = sta->next) sta_set_airtime_weight(hapd, sta, weight); } static unsigned int get_airtime_quantum(unsigned int max_wt) { unsigned int quantum = AIRTIME_QUANTUM_TARGET / max_wt; if (quantum < AIRTIME_QUANTUM_MIN) quantum = AIRTIME_QUANTUM_MIN; else if (quantum > AIRTIME_QUANTUM_MAX) quantum = AIRTIME_QUANTUM_MAX; return quantum; } static void update_airtime_weights(void *eloop_data, void *user_data) { struct hostapd_iface *iface = eloop_data; struct hostapd_data *bss; unsigned int sec, usec; unsigned int num_sta_min = 0, num_sta_prod = 1, num_sta_sum = 0, wt_sum = 0; unsigned int quantum; Boolean all_div_min = TRUE; Boolean apply_limit = iface->conf->airtime_mode == AIRTIME_MODE_DYNAMIC; int wt, num_bss = 0, max_wt = 0; size_t i; for (i = 0; i < iface->num_bss; i++) { bss = iface->bss[i]; if (!bss->started || !bss->conf->airtime_weight) continue; count_backlogged_sta(bss); if (!bss->num_backlogged_sta) continue; if (!num_sta_min || bss->num_backlogged_sta < num_sta_min) num_sta_min = bss->num_backlogged_sta; num_sta_prod *= bss->num_backlogged_sta; num_sta_sum += bss->num_backlogged_sta; wt_sum += bss->conf->airtime_weight; num_bss++; } if (num_sta_min) { for (i = 0; i < iface->num_bss; i++) { bss = iface->bss[i]; if (!bss->started || !bss->conf->airtime_weight) continue; /* Check if we can divide all sta numbers by the * smallest number to keep weights as small as possible. * This is a lazy way to avoid having to factor * integers. */ if (bss->num_backlogged_sta && bss->num_backlogged_sta % num_sta_min > 0) all_div_min = FALSE; /* If we're in LIMIT mode, we only apply the weight * scaling when the BSS(es) marked as limited would a * larger share than the relative BSS weights indicates * it should. */ if (!apply_limit && bss->conf->airtime_limit) { if (bss->num_backlogged_sta * wt_sum > bss->conf->airtime_weight * num_sta_sum) apply_limit = TRUE; } } if (all_div_min) num_sta_prod /= num_sta_min; } for (i = 0; i < iface->num_bss; i++) { bss = iface->bss[i]; if (!bss->started || !bss->conf->airtime_weight) continue; /* We only set the calculated weight if the BSS has active * stations and there are other active interfaces as well - * otherwise we just set a unit weight. This ensures that * the weights are set reasonably when stations transition from * inactive to active. */ if (apply_limit && bss->num_backlogged_sta && num_bss > 1) wt = bss->conf->airtime_weight * num_sta_prod / bss->num_backlogged_sta; else wt = 1; bss->airtime_weight = wt; if (wt > max_wt) max_wt = wt; } quantum = get_airtime_quantum(max_wt); for (i = 0; i < iface->num_bss; i++) { bss = iface->bss[i]; if (!bss->started || !bss->conf->airtime_weight) continue; set_sta_weights(bss, bss->airtime_weight * quantum); } if (get_airtime_policy_update_timeout(iface, &sec, &usec) < 0) return; eloop_register_timeout(sec, usec, update_airtime_weights, iface, NULL); } static int get_weight_for_sta(struct hostapd_data *hapd, const u8 *sta) { struct airtime_sta_weight *wt; wt = hapd->conf->airtime_weight_list; while (wt && os_memcmp(wt->addr, sta, ETH_ALEN) != 0) wt = wt->next; return wt ? wt->weight : hapd->conf->airtime_weight; } int airtime_policy_new_sta(struct hostapd_data *hapd, struct sta_info *sta) { unsigned int weight; if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) { weight = get_weight_for_sta(hapd, sta->addr); if (weight) return sta_set_airtime_weight(hapd, sta, weight); } return 0; } int airtime_policy_update_init(struct hostapd_iface *iface) { unsigned int sec, usec; if (iface->conf->airtime_mode < AIRTIME_MODE_DYNAMIC) return 0; if (get_airtime_policy_update_timeout(iface, &sec, &usec) < 0) return -1; eloop_register_timeout(sec, usec, update_airtime_weights, iface, NULL); return 0; } void airtime_policy_update_deinit(struct hostapd_iface *iface) { eloop_cancel_timeout(update_airtime_weights, iface, NULL); }
Upload File
Create Folder