Skip to content

Commit

Permalink
Merge pull request #583 from Telecominfraproject/main
Browse files Browse the repository at this point in the history
merge main to release branch
  • Loading branch information
jaspreetsachdev authored Sep 26, 2023
2 parents dd41f15 + d9f237b commit bb5d3ec
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 45 deletions.
3 changes: 3 additions & 0 deletions feeds/ipq807x_v5.4/hostapd/files/hostapd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

set_default dynamic_vlan 0
[ "$macfilter" = radius ] && {
append_radius_server
}
vlan_possible=1
wps_possible=1
;;
Expand Down
16 changes: 9 additions & 7 deletions feeds/ipq807x_v5.4/hostapd/files/hostapd.uc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function iface_remove(cfg)
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
return;

hostapd.remove_iface(cfg.bss[0].ifname);
for (let bss in cfg.bss)
wdev_remove(bss.ifname);
}
Expand Down Expand Up @@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status)
let config_inline = iface_gen_config(phy, config, !!phy_status);

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)
return false;

if (!phy_status)
return true;

let iface = hostapd.interfaces[bss.ifname];
let iface = hostapd.interfaces[phy];
if (!iface)
return false;

Expand All @@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config)
{
let phy = phydev.name;

hostapd.remove_iface(phy);
iface_remove(old_config);
iface_remove(config);

Expand Down Expand Up @@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config)
if (!old_config.bss || !old_config.bss[0])
return false;
let iface_name = old_config.bss[0].ifname;
let iface = hostapd.interfaces[iface_name];
let iface = hostapd.interfaces[phy];
if (!iface) {
hostapd.printf(`Could not find previous interface ${iface_name}`);
return false;
}
let iface_name = old_config.bss[0].ifname;
let first_bss = hostapd.bss[iface_name];
if (!first_bss) {
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
Expand Down Expand Up @@ -512,8 +512,10 @@ function iface_set_config(phy, config)

hostapd.data.config[phy] = config;

if (!config)
if (!config) {
hostapd.remove_iface(phy);
return iface_remove(old_config);
}

let phydev = phy_open(phy);
if (!phydev) {
Expand Down Expand Up @@ -667,7 +669,7 @@ let main_obj = {
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
return 0;
let iface = hostapd.interfaces[config.bss[0].ifname];
let iface = hostapd.interfaces[phy];
if (!iface)
return 0;
Expand Down
2 changes: 2 additions & 0 deletions feeds/ipq807x_v5.4/hostapd/files/wpad.init
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ start_service() {
procd_open_instance hostapd
procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
procd_set_param respawn 3600 1 0
procd_set_param limits core="unlimited"
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
procd_add_jail hostapd
procd_set_param capabilities /etc/capabilities/wpad.json
Expand All @@ -29,6 +30,7 @@ start_service() {
procd_open_instance supplicant
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 limits core="unlimited"
[ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
procd_add_jail wpa_supplicant
procd_set_param capabilities /etc/capabilities/wpad.json
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

4 changes: 2 additions & 2 deletions feeds/ipq807x_v5.4/hostapd/patches/600-ubus_support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
goto fail;
}
+ 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",
+ MAC2STR(mgmt->sa));
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
Expand Down Expand Up @@ -152,7 +152,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
#endif /* CONFIG_FILS */

+ 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",
+ MAC2STR(mgmt->sa));
+ resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
Expand Down
32 changes: 21 additions & 11 deletions feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@
hostapd_ubus_free_bss(hapd);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
@@ -530,6 +533,7 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
@@ -502,6 +505,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);
+ hostapd_ucode_free_iface(iface);
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
NULL);
#ifdef NEED_AP_MLME
hostapd_stop_setup_timers(iface);
@@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib
* initialized. Most of the modules that are initialized here will be
* deinitialized in hostapd_cleanup().
Expand Down Expand Up @@ -159,6 +159,16 @@
hostapd_cleanup(hapd);
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
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
+++ b/wpa_supplicant/Makefile
@@ -172,8 +172,20 @@ endif
Expand Down Expand Up @@ -402,7 +412,7 @@
{
--- a/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)",
namebuf, ifname);
Expand All @@ -411,7 +421,7 @@
wpa_printf(MSG_DEBUG,
"nl80211: Not the main interface (%s) - do not indicate interface down",
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)",
namebuf, ifname);
Expand All @@ -420,15 +430,15 @@
wpa_printf(MSG_DEBUG,
"nl80211: Not the main interface (%s) - do not indicate interface up",
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];
int ifindex, br_ifindex = 0;
int br_added = 0;
+ int err;

bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
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]))
add_ifidx(drv, br_ifindex, drv->ifindex);

Expand Down Expand Up @@ -460,7 +470,7 @@
}

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;
}

Expand Down Expand Up @@ -511,7 +521,7 @@

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
}


Expand Down Expand Up @@ -549,7 +559,7 @@
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
size_t data_len, int noack,
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,
.if_add = wpa_driver_nl80211_if_add,
.if_remove = driver_nl80211_if_remove,
Expand Down
4 changes: 3 additions & 1 deletion feeds/ipq807x_v5.4/hostapd/patches/999-ssi_signal.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -57,6 +57,15 @@
@@ -57,6 +57,17 @@
#include "gas_query_ap.h"


+static int
+ewma(int new, int old)
+{
+ #define ALPHA 10
+ if (!old)
+ return new;
+ if (new >= 0)
+ return old;
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
Expand Down
4 changes: 3 additions & 1 deletion feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, "tx", sta_driver_data.current_tx_rate * 100);
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);

r = blobmsg_open_table(&b, "mcs");
Expand Down
3 changes: 3 additions & 0 deletions feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
int i;

if (!iface)
return NULL;

switch (iface->state) {
case HAPD_IFACE_ENABLED:
case HAPD_IFACE_DISABLED:
Expand Down
4 changes: 2 additions & 2 deletions feeds/ucentral/ucentral-schema/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ PKG_NAME:=ucentral-schema
PKG_RELEASE:=1

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_DATE:=2022-05-29
PKG_SOURCE_VERSION:=e99eaf9bdbbe68639b4632d7fec171d89c379dc5
PKG_SOURCE_VERSION:=e9529eab9cae27f170bdb440eb60d7a0a2588cea

PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause
Expand Down
4 changes: 3 additions & 1 deletion feeds/wifi-ax/hostapd/files/hostapd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ hostapd_set_bss_options() {
vlan_possible=1
[ "$macfilter" = radius ] && {
append_radius_server
vlan_possible=1
}
;;
psk|sae|psk-sae)
Expand All @@ -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"

[ "$macfilter" = radius ] && {
append_radius_server
}
set_default dynamic_vlan 0
vlan_possible=1
wps_possible=1
Expand Down
16 changes: 9 additions & 7 deletions feeds/wifi-ax/hostapd/files/hostapd.uc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function iface_remove(cfg)
if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname)
return;

hostapd.remove_iface(cfg.bss[0].ifname);
for (let bss in cfg.bss)
wdev_remove(bss.ifname);
}
Expand Down Expand Up @@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status)
let config_inline = iface_gen_config(phy, config, !!phy_status);

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)
return false;

if (!phy_status)
return true;

let iface = hostapd.interfaces[bss.ifname];
let iface = hostapd.interfaces[phy];
if (!iface)
return false;

Expand All @@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config)
{
let phy = phydev.name;

hostapd.remove_iface(phy);
iface_remove(old_config);
iface_remove(config);

Expand Down Expand Up @@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config)
if (!old_config.bss || !old_config.bss[0])
return false;
let iface_name = old_config.bss[0].ifname;
let iface = hostapd.interfaces[iface_name];
let iface = hostapd.interfaces[phy];
if (!iface) {
hostapd.printf(`Could not find previous interface ${iface_name}`);
return false;
}
let iface_name = old_config.bss[0].ifname;
let first_bss = hostapd.bss[iface_name];
if (!first_bss) {
hostapd.printf(`Could not find bss of previous interface ${iface_name}`);
Expand Down Expand Up @@ -512,8 +512,10 @@ function iface_set_config(phy, config)

hostapd.data.config[phy] = config;

if (!config)
if (!config) {
hostapd.remove_iface(phy);
return iface_remove(old_config);
}

let phydev = phy_open(phy);
if (!phydev) {
Expand Down Expand Up @@ -667,7 +669,7 @@ let main_obj = {
if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
return 0;
let iface = hostapd.interfaces[config.bss[0].ifname];
let iface = hostapd.interfaces[phy];
if (!iface)
return 0;
Expand Down
Loading

0 comments on commit bb5d3ec

Please sign in to comment.