mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 18:07:52 +00:00
Compare commits
3 Commits
v2.11.0-rc
...
v2.11.0-rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb5d3ecd2d | ||
|
|
d9f237b450 | ||
|
|
4f5a3b0c2b |
@@ -794,6 +794,9 @@ hostapd_set_bss_options() {
|
|||||||
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
||||||
|
|
||||||
set_default dynamic_vlan 0
|
set_default dynamic_vlan 0
|
||||||
|
[ "$macfilter" = radius ] && {
|
||||||
|
append_radius_server
|
||||||
|
}
|
||||||
vlan_possible=1
|
vlan_possible=1
|
||||||
wps_possible=1
|
wps_possible=1
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ function iface_remove(cfg)
|
|||||||
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
|
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hostapd.remove_iface(cfg.bss[0].ifname);
|
|
||||||
for (let bss in cfg.bss)
|
for (let bss in cfg.bss)
|
||||||
wdev_remove(bss.ifname);
|
wdev_remove(bss.ifname);
|
||||||
}
|
}
|
||||||
@@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status)
|
|||||||
let config_inline = iface_gen_config(phy, config, !!phy_status);
|
let config_inline = iface_gen_config(phy, config, !!phy_status);
|
||||||
|
|
||||||
let bss = config.bss[0];
|
let bss = config.bss[0];
|
||||||
let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`);
|
let ret = hostapd.add_iface(`bss_config=${phy}:${config_inline}`);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!phy_status)
|
if (!phy_status)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let iface = hostapd.interfaces[bss.ifname];
|
let iface = hostapd.interfaces[phy];
|
||||||
if (!iface)
|
if (!iface)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config)
|
|||||||
{
|
{
|
||||||
let phy = phydev.name;
|
let phy = phydev.name;
|
||||||
|
|
||||||
|
hostapd.remove_iface(phy);
|
||||||
iface_remove(old_config);
|
iface_remove(old_config);
|
||||||
iface_remove(config);
|
iface_remove(config);
|
||||||
|
|
||||||
@@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config)
|
|||||||
if (!old_config.bss || !old_config.bss[0])
|
if (!old_config.bss || !old_config.bss[0])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let iface_name = old_config.bss[0].ifname;
|
let iface = hostapd.interfaces[phy];
|
||||||
let iface = hostapd.interfaces[iface_name];
|
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
hostapd.printf(`Could not find previous interface ${iface_name}`);
|
hostapd.printf(`Could not find previous interface ${iface_name}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let iface_name = old_config.bss[0].ifname;
|
||||||
let first_bss = hostapd.bss[iface_name];
|
let first_bss = hostapd.bss[iface_name];
|
||||||
if (!first_bss) {
|
if (!first_bss) {
|
||||||
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
|
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
|
||||||
@@ -512,8 +512,10 @@ function iface_set_config(phy, config)
|
|||||||
|
|
||||||
hostapd.data.config[phy] = config;
|
hostapd.data.config[phy] = config;
|
||||||
|
|
||||||
if (!config)
|
if (!config) {
|
||||||
|
hostapd.remove_iface(phy);
|
||||||
return iface_remove(old_config);
|
return iface_remove(old_config);
|
||||||
|
}
|
||||||
|
|
||||||
let phydev = phy_open(phy);
|
let phydev = phy_open(phy);
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
@@ -667,7 +669,7 @@ let main_obj = {
|
|||||||
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
|
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
let iface = hostapd.interfaces[config.bss[0].ifname];
|
let iface = hostapd.interfaces[phy];
|
||||||
if (!iface)
|
if (!iface)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ start_service() {
|
|||||||
procd_open_instance hostapd
|
procd_open_instance hostapd
|
||||||
procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
|
procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
|
||||||
procd_set_param respawn 3600 1 0
|
procd_set_param respawn 3600 1 0
|
||||||
|
procd_set_param limits core="unlimited"
|
||||||
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
||||||
procd_add_jail hostapd
|
procd_add_jail hostapd
|
||||||
procd_set_param capabilities /etc/capabilities/wpad.json
|
procd_set_param capabilities /etc/capabilities/wpad.json
|
||||||
@@ -29,6 +30,7 @@ start_service() {
|
|||||||
procd_open_instance supplicant
|
procd_open_instance supplicant
|
||||||
procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global
|
procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global
|
||||||
procd_set_param respawn 3600 1 0
|
procd_set_param respawn 3600 1 0
|
||||||
|
procd_set_param limits core="unlimited"
|
||||||
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
||||||
procd_add_jail wpa_supplicant
|
procd_add_jail wpa_supplicant
|
||||||
procd_set_param capabilities /etc/capabilities/wpad.json
|
procd_set_param capabilities /etc/capabilities/wpad.json
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Wed, 20 Sep 2023 13:41:10 +0200
|
||||||
|
Subject: [PATCH] hostapd: cancel channel_list_update_timeout in
|
||||||
|
hostapd_cleanup_iface_partial
|
||||||
|
|
||||||
|
Fixes a crash when disabling an interface during channel list update
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/src/ap/hostapd.c
|
||||||
|
+++ b/src/ap/hostapd.c
|
||||||
|
@@ -501,6 +501,7 @@ static void sta_track_deinit(struct host
|
||||||
|
void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
|
||||||
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
|
+ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
|
#ifdef NEED_AP_MLME
|
||||||
|
hostapd_stop_setup_timers(iface);
|
||||||
|
#endif /* NEED_AP_MLME */
|
||||||
|
@@ -529,7 +530,6 @@ void hostapd_cleanup_iface_partial(struc
|
||||||
|
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
|
||||||
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
|
- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
|
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
|
||||||
|
NULL);
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||||
+ if (0 && ubus_resp) {
|
+ if (ubus_resp) {
|
||||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
|
||||||
+ MAC2STR(mgmt->sa));
|
+ MAC2STR(mgmt->sa));
|
||||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||||
@@ -152,7 +152,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
|
|||||||
#endif /* CONFIG_FILS */
|
#endif /* CONFIG_FILS */
|
||||||
|
|
||||||
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
+ ubus_resp = hostapd_ubus_handle_event(hapd, &req);
|
||||||
+ if (0 && ubus_resp) {
|
+ if (ubus_resp) {
|
||||||
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
+ wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
|
||||||
+ MAC2STR(mgmt->sa));
|
+ MAC2STR(mgmt->sa));
|
||||||
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||||
|
|||||||
@@ -107,14 +107,14 @@
|
|||||||
hostapd_ubus_free_bss(hapd);
|
hostapd_ubus_free_bss(hapd);
|
||||||
accounting_deinit(hapd);
|
accounting_deinit(hapd);
|
||||||
hostapd_deinit_wpa(hapd);
|
hostapd_deinit_wpa(hapd);
|
||||||
@@ -530,6 +533,7 @@ void hostapd_cleanup_iface_partial(struc
|
@@ -502,6 +505,7 @@ static void sta_track_deinit(struct host
|
||||||
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
|
void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
|
||||||
{
|
{
|
||||||
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
+ hostapd_ucode_free_iface(iface);
|
+ hostapd_ucode_free_iface(iface);
|
||||||
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
|
#ifdef NEED_AP_MLME
|
||||||
NULL);
|
hostapd_stop_setup_timers(iface);
|
||||||
@@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib
|
@@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib
|
||||||
* initialized. Most of the modules that are initialized here will be
|
* initialized. Most of the modules that are initialized here will be
|
||||||
* deinitialized in hostapd_cleanup().
|
* deinitialized in hostapd_cleanup().
|
||||||
@@ -159,6 +159,16 @@
|
|||||||
hostapd_cleanup(hapd);
|
hostapd_cleanup(hapd);
|
||||||
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
|
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
|
||||||
hapd_iface->conf->num_bss--;
|
hapd_iface->conf->num_bss--;
|
||||||
|
@@ -3137,7 +3142,8 @@ int hostapd_remove_iface(struct hapd_int
|
||||||
|
hapd_iface = interfaces->iface[i];
|
||||||
|
if (hapd_iface == NULL)
|
||||||
|
return -1;
|
||||||
|
- if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
|
||||||
|
+ if (!os_strcmp(hapd_iface->phy, buf) ||
|
||||||
|
+ !os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
|
||||||
|
wpa_printf(MSG_INFO, "Remove interface '%s'", buf);
|
||||||
|
hapd_iface->driver_ap_teardown =
|
||||||
|
!!(hapd_iface->drv_flags &
|
||||||
--- a/wpa_supplicant/Makefile
|
--- a/wpa_supplicant/Makefile
|
||||||
+++ b/wpa_supplicant/Makefile
|
+++ b/wpa_supplicant/Makefile
|
||||||
@@ -172,8 +172,20 @@ endif
|
@@ -172,8 +172,20 @@ endif
|
||||||
@@ -402,7 +412,7 @@
|
|||||||
{
|
{
|
||||||
--- a/src/drivers/driver_nl80211.c
|
--- a/src/drivers/driver_nl80211.c
|
||||||
+++ b/src/drivers/driver_nl80211.c
|
+++ b/src/drivers/driver_nl80211.c
|
||||||
@@ -1222,7 +1222,7 @@ static void wpa_driver_nl80211_event_rtm
|
@@ -1224,7 +1224,7 @@ static void wpa_driver_nl80211_event_rtm
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
|
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
|
||||||
namebuf, ifname);
|
namebuf, ifname);
|
||||||
@@ -411,7 +421,7 @@
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"nl80211: Not the main interface (%s) - do not indicate interface down",
|
"nl80211: Not the main interface (%s) - do not indicate interface down",
|
||||||
drv->first_bss->ifname);
|
drv->first_bss->ifname);
|
||||||
@@ -1258,7 +1258,7 @@ static void wpa_driver_nl80211_event_rtm
|
@@ -1260,7 +1260,7 @@ static void wpa_driver_nl80211_event_rtm
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
|
wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
|
||||||
namebuf, ifname);
|
namebuf, ifname);
|
||||||
@@ -420,7 +430,7 @@
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"nl80211: Not the main interface (%s) - do not indicate interface up",
|
"nl80211: Not the main interface (%s) - do not indicate interface up",
|
||||||
drv->first_bss->ifname);
|
drv->first_bss->ifname);
|
||||||
@@ -7609,6 +7609,7 @@ static void *i802_init(struct hostapd_da
|
@@ -7614,6 +7614,7 @@ static void *i802_init(struct hostapd_da
|
||||||
char master_ifname[IFNAMSIZ];
|
char master_ifname[IFNAMSIZ];
|
||||||
int ifindex, br_ifindex = 0;
|
int ifindex, br_ifindex = 0;
|
||||||
int br_added = 0;
|
int br_added = 0;
|
||||||
@@ -428,7 +438,7 @@
|
|||||||
|
|
||||||
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
|
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
|
||||||
params->global_priv, 1,
|
params->global_priv, 1,
|
||||||
@@ -7668,21 +7669,17 @@ static void *i802_init(struct hostapd_da
|
@@ -7673,21 +7674,17 @@ static void *i802_init(struct hostapd_da
|
||||||
(params->num_bridge == 0 || !params->bridge[0]))
|
(params->num_bridge == 0 || !params->bridge[0]))
|
||||||
add_ifidx(drv, br_ifindex, drv->ifindex);
|
add_ifidx(drv, br_ifindex, drv->ifindex);
|
||||||
|
|
||||||
@@ -460,7 +470,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
|
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
|
||||||
@@ -8041,6 +8038,50 @@ static int wpa_driver_nl80211_if_remove(
|
@@ -8047,6 +8044,50 @@ static int wpa_driver_nl80211_if_remove(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +521,7 @@
|
|||||||
|
|
||||||
static int cookie_handler(struct nl_msg *msg, void *arg)
|
static int cookie_handler(struct nl_msg *msg, void *arg)
|
||||||
{
|
{
|
||||||
@@ -9385,6 +9426,37 @@ static int driver_nl80211_if_remove(void
|
@@ -9391,6 +9432,37 @@ static int driver_nl80211_if_remove(void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -549,7 +559,7 @@
|
|||||||
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
|
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
|
||||||
size_t data_len, int noack,
|
size_t data_len, int noack,
|
||||||
unsigned int freq,
|
unsigned int freq,
|
||||||
@@ -11967,6 +12039,8 @@ const struct wpa_driver_ops wpa_driver_n
|
@@ -11973,6 +12045,8 @@ const struct wpa_driver_ops wpa_driver_n
|
||||||
.set_acl = wpa_driver_nl80211_set_acl,
|
.set_acl = wpa_driver_nl80211_set_acl,
|
||||||
.if_add = wpa_driver_nl80211_if_add,
|
.if_add = wpa_driver_nl80211_if_add,
|
||||||
.if_remove = driver_nl80211_if_remove,
|
.if_remove = driver_nl80211_if_remove,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/src/ap/ieee802_11.c
|
--- a/src/ap/ieee802_11.c
|
||||||
+++ b/src/ap/ieee802_11.c
|
+++ b/src/ap/ieee802_11.c
|
||||||
@@ -57,6 +57,15 @@
|
@@ -57,6 +57,17 @@
|
||||||
#include "gas_query_ap.h"
|
#include "gas_query_ap.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
+ewma(int new, int old)
|
+ewma(int new, int old)
|
||||||
+{
|
+{
|
||||||
+ #define ALPHA 10
|
+ #define ALPHA 10
|
||||||
|
+ if (!old)
|
||||||
|
+ return new;
|
||||||
+ if (new >= 0)
|
+ if (new >= 0)
|
||||||
+ return old;
|
+ return old;
|
||||||
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
|
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd);
|
eloop_register_timeout(time, 0, hostapd_bss_del_ban, ban, hapd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -305,6 +305,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
|
blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
|
||||||
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
|
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
|
||||||
blobmsg_close_table(&b, r);
|
blobmsg_close_table(&b, r);
|
||||||
|
blobmsg_add_u32(&b, "retries", sta_driver_data.tx_retry_count);
|
||||||
|
blobmsg_add_u32(&b, "failed", sta_driver_data.tx_retry_failed);
|
||||||
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
|
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
|
||||||
|
|
||||||
r = blobmsg_open_table(&b, "mcs");
|
r = blobmsg_open_table(&b, "mcs");
|
||||||
|
|||||||
@@ -471,6 +471,9 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
|
|||||||
struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
|
struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!iface)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
switch (iface->state) {
|
switch (iface->state) {
|
||||||
case HAPD_IFACE_ENABLED:
|
case HAPD_IFACE_ENABLED:
|
||||||
case HAPD_IFACE_DISABLED:
|
case HAPD_IFACE_DISABLED:
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ PKG_NAME:=ucentral-schema
|
|||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git
|
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git
|
||||||
PKG_MIRROR_HASH:=62571bb529e8b350bafdc63db3d7e02effa3edf5e5f19bfe8ced96c7cfb08b0e
|
PKG_MIRROR_HASH:=edb9bc0b8209226f585c724c88720eab2263c33eff6ebe2f2a5898896eb1fc11
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_DATE:=2022-05-29
|
PKG_SOURCE_DATE:=2022-05-29
|
||||||
PKG_SOURCE_VERSION:=e99eaf9bdbbe68639b4632d7fec171d89c379dc5
|
PKG_SOURCE_VERSION:=e9529eab9cae27f170bdb440eb60d7a0a2588cea
|
||||||
|
|
||||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
|||||||
@@ -774,7 +774,6 @@ hostapd_set_bss_options() {
|
|||||||
vlan_possible=1
|
vlan_possible=1
|
||||||
[ "$macfilter" = radius ] && {
|
[ "$macfilter" = radius ] && {
|
||||||
append_radius_server
|
append_radius_server
|
||||||
vlan_possible=1
|
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
psk|sae|psk-sae)
|
psk|sae|psk-sae)
|
||||||
@@ -794,6 +793,9 @@ hostapd_set_bss_options() {
|
|||||||
}
|
}
|
||||||
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
|
||||||
|
|
||||||
|
[ "$macfilter" = radius ] && {
|
||||||
|
append_radius_server
|
||||||
|
}
|
||||||
set_default dynamic_vlan 0
|
set_default dynamic_vlan 0
|
||||||
vlan_possible=1
|
vlan_possible=1
|
||||||
wps_possible=1
|
wps_possible=1
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ function iface_remove(cfg)
|
|||||||
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
|
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hostapd.remove_iface(cfg.bss[0].ifname);
|
|
||||||
for (let bss in cfg.bss)
|
for (let bss in cfg.bss)
|
||||||
wdev_remove(bss.ifname);
|
wdev_remove(bss.ifname);
|
||||||
}
|
}
|
||||||
@@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status)
|
|||||||
let config_inline = iface_gen_config(phy, config, !!phy_status);
|
let config_inline = iface_gen_config(phy, config, !!phy_status);
|
||||||
|
|
||||||
let bss = config.bss[0];
|
let bss = config.bss[0];
|
||||||
let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`);
|
let ret = hostapd.add_iface(`bss_config=${phy}:${config_inline}`);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!phy_status)
|
if (!phy_status)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
let iface = hostapd.interfaces[bss.ifname];
|
let iface = hostapd.interfaces[phy];
|
||||||
if (!iface)
|
if (!iface)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config)
|
|||||||
{
|
{
|
||||||
let phy = phydev.name;
|
let phy = phydev.name;
|
||||||
|
|
||||||
|
hostapd.remove_iface(phy);
|
||||||
iface_remove(old_config);
|
iface_remove(old_config);
|
||||||
iface_remove(config);
|
iface_remove(config);
|
||||||
|
|
||||||
@@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config)
|
|||||||
if (!old_config.bss || !old_config.bss[0])
|
if (!old_config.bss || !old_config.bss[0])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let iface_name = old_config.bss[0].ifname;
|
let iface = hostapd.interfaces[phy];
|
||||||
let iface = hostapd.interfaces[iface_name];
|
|
||||||
if (!iface) {
|
if (!iface) {
|
||||||
hostapd.printf(`Could not find previous interface ${iface_name}`);
|
hostapd.printf(`Could not find previous interface ${iface_name}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let iface_name = old_config.bss[0].ifname;
|
||||||
let first_bss = hostapd.bss[iface_name];
|
let first_bss = hostapd.bss[iface_name];
|
||||||
if (!first_bss) {
|
if (!first_bss) {
|
||||||
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
|
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
|
||||||
@@ -512,8 +512,10 @@ function iface_set_config(phy, config)
|
|||||||
|
|
||||||
hostapd.data.config[phy] = config;
|
hostapd.data.config[phy] = config;
|
||||||
|
|
||||||
if (!config)
|
if (!config) {
|
||||||
|
hostapd.remove_iface(phy);
|
||||||
return iface_remove(old_config);
|
return iface_remove(old_config);
|
||||||
|
}
|
||||||
|
|
||||||
let phydev = phy_open(phy);
|
let phydev = phy_open(phy);
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
@@ -667,7 +669,7 @@ let main_obj = {
|
|||||||
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
|
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
let iface = hostapd.interfaces[config.bss[0].ifname];
|
let iface = hostapd.interfaces[phy];
|
||||||
if (!iface)
|
if (!iface)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ start_service() {
|
|||||||
procd_open_instance hostapd
|
procd_open_instance hostapd
|
||||||
procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
|
procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
|
||||||
procd_set_param respawn 3600 1 0
|
procd_set_param respawn 3600 1 0
|
||||||
|
procd_set_param limits core="unlimited"
|
||||||
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
||||||
procd_add_jail hostapd
|
procd_add_jail hostapd
|
||||||
procd_set_param capabilities /etc/capabilities/wpad.json
|
procd_set_param capabilities /etc/capabilities/wpad.json
|
||||||
@@ -29,6 +30,7 @@ start_service() {
|
|||||||
procd_open_instance supplicant
|
procd_open_instance supplicant
|
||||||
procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global
|
procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global
|
||||||
procd_set_param respawn 3600 1 0
|
procd_set_param respawn 3600 1 0
|
||||||
|
procd_set_param limits core="unlimited"
|
||||||
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
|
||||||
procd_add_jail wpa_supplicant
|
procd_add_jail wpa_supplicant
|
||||||
procd_set_param capabilities /etc/capabilities/wpad.json
|
procd_set_param capabilities /etc/capabilities/wpad.json
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Wed, 20 Sep 2023 13:41:10 +0200
|
||||||
|
Subject: [PATCH] hostapd: cancel channel_list_update_timeout in
|
||||||
|
hostapd_cleanup_iface_partial
|
||||||
|
|
||||||
|
Fixes a crash when disabling an interface during channel list update
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/src/ap/hostapd.c
|
||||||
|
+++ b/src/ap/hostapd.c
|
||||||
|
@@ -501,6 +501,7 @@ static void sta_track_deinit(struct host
|
||||||
|
void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
|
||||||
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
|
+ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
|
#ifdef NEED_AP_MLME
|
||||||
|
hostapd_stop_setup_timers(iface);
|
||||||
|
#endif /* NEED_AP_MLME */
|
||||||
|
@@ -529,7 +530,6 @@ void hostapd_cleanup_iface_partial(struc
|
||||||
|
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
|
||||||
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
|
- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
|
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
|
||||||
|
NULL);
|
||||||
|
|
||||||
@@ -107,14 +107,14 @@
|
|||||||
hostapd_ubus_free_bss(hapd);
|
hostapd_ubus_free_bss(hapd);
|
||||||
accounting_deinit(hapd);
|
accounting_deinit(hapd);
|
||||||
hostapd_deinit_wpa(hapd);
|
hostapd_deinit_wpa(hapd);
|
||||||
@@ -530,6 +533,7 @@ void hostapd_cleanup_iface_partial(struc
|
@@ -502,6 +505,7 @@ static void sta_track_deinit(struct host
|
||||||
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
|
void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
|
||||||
{
|
{
|
||||||
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
|
||||||
+ hostapd_ucode_free_iface(iface);
|
+ hostapd_ucode_free_iface(iface);
|
||||||
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
|
||||||
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
|
#ifdef NEED_AP_MLME
|
||||||
NULL);
|
hostapd_stop_setup_timers(iface);
|
||||||
@@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib
|
@@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib
|
||||||
* initialized. Most of the modules that are initialized here will be
|
* initialized. Most of the modules that are initialized here will be
|
||||||
* deinitialized in hostapd_cleanup().
|
* deinitialized in hostapd_cleanup().
|
||||||
@@ -159,6 +159,16 @@
|
|||||||
hostapd_cleanup(hapd);
|
hostapd_cleanup(hapd);
|
||||||
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
|
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
|
||||||
hapd_iface->conf->num_bss--;
|
hapd_iface->conf->num_bss--;
|
||||||
|
@@ -3137,7 +3142,8 @@ int hostapd_remove_iface(struct hapd_int
|
||||||
|
hapd_iface = interfaces->iface[i];
|
||||||
|
if (hapd_iface == NULL)
|
||||||
|
return -1;
|
||||||
|
- if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
|
||||||
|
+ if (!os_strcmp(hapd_iface->phy, buf) ||
|
||||||
|
+ !os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
|
||||||
|
wpa_printf(MSG_INFO, "Remove interface '%s'", buf);
|
||||||
|
hapd_iface->driver_ap_teardown =
|
||||||
|
!!(hapd_iface->drv_flags &
|
||||||
--- a/wpa_supplicant/Makefile
|
--- a/wpa_supplicant/Makefile
|
||||||
+++ b/wpa_supplicant/Makefile
|
+++ b/wpa_supplicant/Makefile
|
||||||
@@ -172,8 +172,20 @@ endif
|
@@ -172,8 +172,20 @@ endif
|
||||||
@@ -402,7 +412,7 @@
|
|||||||
{
|
{
|
||||||
--- a/src/drivers/driver_nl80211.c
|
--- a/src/drivers/driver_nl80211.c
|
||||||
+++ b/src/drivers/driver_nl80211.c
|
+++ b/src/drivers/driver_nl80211.c
|
||||||
@@ -1222,7 +1222,7 @@ static void wpa_driver_nl80211_event_rtm
|
@@ -1224,7 +1224,7 @@ static void wpa_driver_nl80211_event_rtm
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
|
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
|
||||||
namebuf, ifname);
|
namebuf, ifname);
|
||||||
@@ -411,7 +421,7 @@
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"nl80211: Not the main interface (%s) - do not indicate interface down",
|
"nl80211: Not the main interface (%s) - do not indicate interface down",
|
||||||
drv->first_bss->ifname);
|
drv->first_bss->ifname);
|
||||||
@@ -1258,7 +1258,7 @@ static void wpa_driver_nl80211_event_rtm
|
@@ -1260,7 +1260,7 @@ static void wpa_driver_nl80211_event_rtm
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
|
wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
|
||||||
namebuf, ifname);
|
namebuf, ifname);
|
||||||
@@ -420,7 +430,7 @@
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"nl80211: Not the main interface (%s) - do not indicate interface up",
|
"nl80211: Not the main interface (%s) - do not indicate interface up",
|
||||||
drv->first_bss->ifname);
|
drv->first_bss->ifname);
|
||||||
@@ -7609,6 +7609,7 @@ static void *i802_init(struct hostapd_da
|
@@ -7614,6 +7614,7 @@ static void *i802_init(struct hostapd_da
|
||||||
char master_ifname[IFNAMSIZ];
|
char master_ifname[IFNAMSIZ];
|
||||||
int ifindex, br_ifindex = 0;
|
int ifindex, br_ifindex = 0;
|
||||||
int br_added = 0;
|
int br_added = 0;
|
||||||
@@ -428,7 +438,7 @@
|
|||||||
|
|
||||||
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
|
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
|
||||||
params->global_priv, 1,
|
params->global_priv, 1,
|
||||||
@@ -7668,21 +7669,17 @@ static void *i802_init(struct hostapd_da
|
@@ -7673,21 +7674,17 @@ static void *i802_init(struct hostapd_da
|
||||||
(params->num_bridge == 0 || !params->bridge[0]))
|
(params->num_bridge == 0 || !params->bridge[0]))
|
||||||
add_ifidx(drv, br_ifindex, drv->ifindex);
|
add_ifidx(drv, br_ifindex, drv->ifindex);
|
||||||
|
|
||||||
@@ -460,7 +470,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
|
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
|
||||||
@@ -8041,6 +8038,50 @@ static int wpa_driver_nl80211_if_remove(
|
@@ -8047,6 +8044,50 @@ static int wpa_driver_nl80211_if_remove(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +521,7 @@
|
|||||||
|
|
||||||
static int cookie_handler(struct nl_msg *msg, void *arg)
|
static int cookie_handler(struct nl_msg *msg, void *arg)
|
||||||
{
|
{
|
||||||
@@ -9385,6 +9426,37 @@ static int driver_nl80211_if_remove(void
|
@@ -9391,6 +9432,37 @@ static int driver_nl80211_if_remove(void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -549,7 +559,7 @@
|
|||||||
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
|
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
|
||||||
size_t data_len, int noack,
|
size_t data_len, int noack,
|
||||||
unsigned int freq,
|
unsigned int freq,
|
||||||
@@ -11967,6 +12039,8 @@ const struct wpa_driver_ops wpa_driver_n
|
@@ -11973,6 +12045,8 @@ const struct wpa_driver_ops wpa_driver_n
|
||||||
.set_acl = wpa_driver_nl80211_set_acl,
|
.set_acl = wpa_driver_nl80211_set_acl,
|
||||||
.if_add = wpa_driver_nl80211_if_add,
|
.if_add = wpa_driver_nl80211_if_add,
|
||||||
.if_remove = driver_nl80211_if_remove,
|
.if_remove = driver_nl80211_if_remove,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/src/ap/ieee802_11.c
|
--- a/src/ap/ieee802_11.c
|
||||||
+++ b/src/ap/ieee802_11.c
|
+++ b/src/ap/ieee802_11.c
|
||||||
@@ -57,6 +57,15 @@
|
@@ -57,6 +57,17 @@
|
||||||
#include "gas_query_ap.h"
|
#include "gas_query_ap.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
+ewma(int new, int old)
|
+ewma(int new, int old)
|
||||||
+{
|
+{
|
||||||
+ #define ALPHA 10
|
+ #define ALPHA 10
|
||||||
|
+ if (!old)
|
||||||
|
+ return new;
|
||||||
+ if (new >= 0)
|
+ if (new >= 0)
|
||||||
+ return old;
|
+ return old;
|
||||||
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
|
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd);
|
eloop_register_timeout(time, 0, hostapd_bss_del_ban, ban, hapd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -305,6 +305,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
|
blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
|
||||||
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
|
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
|
||||||
blobmsg_close_table(&b, r);
|
blobmsg_close_table(&b, r);
|
||||||
|
blobmsg_add_u32(&b, "retries", sta_driver_data.tx_retry_count);
|
||||||
|
blobmsg_add_u32(&b, "failed", sta_driver_data.tx_retry_failed);
|
||||||
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
|
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
|
||||||
|
|
||||||
r = blobmsg_open_table(&b, "mcs");
|
r = blobmsg_open_table(&b, "mcs");
|
||||||
|
|||||||
@@ -471,6 +471,9 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
|
|||||||
struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
|
struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!iface)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
switch (iface->state) {
|
switch (iface->state) {
|
||||||
case HAPD_IFACE_ENABLED:
|
case HAPD_IFACE_ENABLED:
|
||||||
case HAPD_IFACE_DISABLED:
|
case HAPD_IFACE_DISABLED:
|
||||||
|
|||||||
Reference in New Issue
Block a user