mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
Merge Offcial Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
4f05d7bce2
@ -424,9 +424,19 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -350,6 +353,9 @@ void hostapd_handle_radio_measurement(st
|
||||
mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa));
|
||||
|
||||
switch (mgmt->u.action.u.rrm.action) {
|
||||
+ case WLAN_RRM_LINK_MEASUREMENT_REPORT:
|
||||
+ hostapd_ubus_handle_link_measurement(hapd, buf, len);
|
||||
+ break;
|
||||
case WLAN_RRM_RADIO_MEASUREMENT_REPORT:
|
||||
hostapd_handle_radio_msmt_report(hapd, buf, len);
|
||||
break;
|
||||
--- a/src/ap/wnm_ap.c
|
||||
+++ b/src/ap/wnm_ap.c
|
||||
@@ -463,7 +463,7 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
@@ -461,7 +461,7 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
size_t len)
|
||||
{
|
||||
u8 dialog_token, status_code, bss_termination_delay;
|
||||
@ -435,7 +445,7 @@
|
||||
int enabled = hapd->conf->bss_transition;
|
||||
struct sta_info *sta;
|
||||
|
||||
@@ -510,6 +510,7 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
@@ -508,6 +508,7 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
wpa_printf(MSG_DEBUG, "WNM: not enough room for Target BSSID field");
|
||||
return;
|
||||
}
|
||||
@ -443,7 +453,7 @@
|
||||
sta->agreed_to_steer = 1;
|
||||
eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta);
|
||||
eloop_register_timeout(2, 0, ap_sta_reset_steer_flag_timer,
|
||||
@@ -529,6 +530,10 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
@@ -527,6 +528,10 @@ static void ieee802_11_rx_bss_trans_mgmt
|
||||
MAC2STR(addr), status_code, bss_termination_delay);
|
||||
}
|
||||
|
||||
|
@ -896,6 +896,7 @@ hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr)
|
||||
enum {
|
||||
BSS_MGMT_EN_NEIGHBOR,
|
||||
BSS_MGMT_EN_BEACON,
|
||||
BSS_MGMT_EN_LINK_MEASUREMENT,
|
||||
#ifdef CONFIG_WNM_AP
|
||||
BSS_MGMT_EN_BSS_TRANSITION,
|
||||
#endif
|
||||
@ -923,6 +924,14 @@ __hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag)
|
||||
WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE |
|
||||
WLAN_RRM_CAPS_BEACON_REPORT_TABLE;
|
||||
|
||||
if (bss->radio_measurements[0] & flags == flags)
|
||||
return false;
|
||||
|
||||
bss->radio_measurements[0] |= (u8) flags;
|
||||
return true;
|
||||
case BSS_MGMT_EN_LINK_MEASUREMENT:
|
||||
flags = WLAN_RRM_CAPS_LINK_MEASUREMENT;
|
||||
|
||||
if (bss->radio_measurements[0] & flags == flags)
|
||||
return false;
|
||||
|
||||
@ -960,6 +969,7 @@ __hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags)
|
||||
static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = {
|
||||
[BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL },
|
||||
[BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL },
|
||||
[BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL },
|
||||
#ifdef CONFIG_WNM_AP
|
||||
[BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL },
|
||||
#endif
|
||||
@ -1238,6 +1248,98 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
LM_REQ_ADDR,
|
||||
LM_REQ_TX_POWER_USED,
|
||||
LM_REQ_TX_POWER_MAX,
|
||||
__LM_REQ_MAX,
|
||||
};
|
||||
|
||||
static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = {
|
||||
[LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING },
|
||||
[LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 },
|
||||
[LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 },
|
||||
};
|
||||
|
||||
static int
|
||||
hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *ureq, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||
struct blob_attr *tb[__LM_REQ_MAX];
|
||||
struct wpabuf *buf;
|
||||
u8 addr[ETH_ALEN];
|
||||
int ret;
|
||||
int8_t txp_used, txp_max;
|
||||
|
||||
txp_used = 0;
|
||||
txp_max = 0;
|
||||
|
||||
blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[LM_REQ_ADDR])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
if (tb[LM_REQ_TX_POWER_USED])
|
||||
txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]);
|
||||
|
||||
if (tb[LM_REQ_TX_POWER_MAX])
|
||||
txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]);
|
||||
|
||||
if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr))
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
buf = wpabuf_alloc(5);
|
||||
if (!buf)
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT);
|
||||
wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST);
|
||||
wpabuf_put_u8(buf, 1);
|
||||
/* TX-Power used */
|
||||
wpabuf_put_u8(buf, txp_used);
|
||||
/* Max TX Power */
|
||||
wpabuf_put_u8(buf, txp_max);
|
||||
|
||||
ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr,
|
||||
wpabuf_head(buf), wpabuf_len(buf));
|
||||
|
||||
wpabuf_free(buf);
|
||||
if (ret < 0)
|
||||
return -ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len)
|
||||
{
|
||||
const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data;
|
||||
const u8 *pos, *end;
|
||||
u8 token;
|
||||
|
||||
end = data + len;
|
||||
token = mgmt->u.action.u.rrm.dialog_token;
|
||||
pos = mgmt->u.action.u.rrm.variable;
|
||||
|
||||
if (end - pos < 8)
|
||||
return;
|
||||
|
||||
if (!hapd->ubus.obj.has_subscribers)
|
||||
return;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
blobmsg_add_macaddr(&b, "address", mgmt->sa);
|
||||
blobmsg_add_u16(&b, "dialog-token", token);
|
||||
blobmsg_add_u16(&b, "rx-antenna-id", pos[4]);
|
||||
blobmsg_add_u16(&b, "tx-antenna-id", pos[5]);
|
||||
blobmsg_add_u16(&b, "rcpi", pos[6]);
|
||||
blobmsg_add_u16(&b, "rsni", pos[7]);
|
||||
|
||||
ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_WNM_AP
|
||||
|
||||
@ -1431,6 +1533,7 @@ static const struct ubus_method bss_methods[] = {
|
||||
UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list),
|
||||
UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy),
|
||||
UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy),
|
||||
UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy),
|
||||
#ifdef CONFIG_WNM_AP
|
||||
UBUS_METHOD("wnm_disassoc_imminent", hostapd_wnm_disassoc_imminent, wnm_disassoc_policy),
|
||||
UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy),
|
||||
|
@ -45,6 +45,7 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd);
|
||||
void hostapd_ubus_free_bss(struct hostapd_data *hapd);
|
||||
|
||||
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
|
||||
void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len);
|
||||
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
|
||||
void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
|
||||
const u8 *addr, u8 token, u8 rep_mode,
|
||||
@ -83,6 +84,10 @@ static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct ho
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
|
||||
{
|
||||
}
|
||||
|
@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libiwinfo
|
||||
PKG_RELEASE:=2.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git
|
||||
PKG_SOURCE_DATE:=2021-04-30
|
||||
PKG_SOURCE_VERSION:=c45f0b584b4b86f8250f90ea19afca271c114fa2
|
||||
PKG_MIRROR_HASH:=24ad04791254a0523cd15a4fec6116d9ff121e006c93e5e41459f91347b33ec2
|
||||
PKG_SOURCE_DATE:=2022-04-26
|
||||
PKG_SOURCE_VERSION:=dc6847eb5ec8747867bc20f1024723c6397c1df7
|
||||
PKG_MIRROR_HASH:=3f243cf75f4cec02e9e8ecc2087577146845346c0172808f64dea066f84f88d4
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -105,7 +105,7 @@ endef
|
||||
|
||||
define Package/libiwinfo-data/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/libiwinfo
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/hardware.txt $(1)/usr/share/libiwinfo/devices.txt
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/devices.txt $(1)/usr/share/libiwinfo/devices.txt
|
||||
endef
|
||||
|
||||
define Package/iwinfo/install
|
||||
|
@ -1,26 +0,0 @@
|
||||
From a0a0e02dd91d14a50155390d5fd3b95d6ec87bf4 Mon Sep 17 00:00:00 2001
|
||||
From: Jo-Philipp Wich <jo@mein.io>
|
||||
Date: Sun, 11 Jul 2021 15:56:35 +0200
|
||||
Subject: [PATCH] iwinfo: rename hardware.txt to devices.txt
|
||||
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
---
|
||||
include/iwinfo.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/iwinfo.h b/include/iwinfo.h
|
||||
index f7097cc..8469ee7 100644
|
||||
--- a/include/iwinfo.h
|
||||
+++ b/include/iwinfo.h
|
||||
@@ -255,7 +255,7 @@ struct iwinfo_hardware_entry {
|
||||
|
||||
extern const struct iwinfo_iso3166_label IWINFO_ISO3166_NAMES[];
|
||||
|
||||
-#define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/hardware.txt"
|
||||
+#define IWINFO_HARDWARE_FILE "/usr/share/libiwinfo/devices.txt"
|
||||
|
||||
|
||||
struct iwinfo_ops {
|
||||
--
|
||||
2.30.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user