aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2020-09-20 23:49:35 +0200
committerDavid Bauer <mail@david-bauer.net>2020-09-22 17:41:10 +0200
commitc5eea362f30370444ff7aea3e8ce7b60b2e4ce50 (patch)
tree595264ebd40d9dd4705b990101887dc3ff90efdd /package
parent560e54c69e98a08dd161755da3feb7aa85bbae34 (diff)
downloadupstream-c5eea362f30370444ff7aea3e8ce7b60b2e4ce50.tar.gz
upstream-c5eea362f30370444ff7aea3e8ce7b60b2e4ce50.tar.bz2
upstream-c5eea362f30370444ff7aea3e8ce7b60b2e4ce50.zip
hostapd: ubus: make (B)SSID optional for neighbor report
Make the BSSID and SSID fields optional when configuring a neighbor report into hostapd. Both options can now be an empty string. For the BSSID, the first 6 byte are copied from the neighbor report. For the SSID, the SSID for the affected hostapd BSS is used. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'package')
-rw-r--r--package/network/services/hostapd/Makefile2
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c33
2 files changed, 25 insertions, 10 deletions
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 372539bd06..6966ebdb89 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
-PKG_RELEASE:=10
+PKG_RELEASE:=11
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index 9e407538f7..d816f2c030 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -863,25 +863,40 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj,
struct wpa_ssid_value ssid;
struct wpabuf *data;
u8 bssid[ETH_ALEN];
- char *s;
+ char *s, *nr_s;
blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur));
if (!tb[0] || !tb[1] || !tb[2])
goto invalid;
+ /* Neighbor Report binary */
+ nr_s = blobmsg_get_string(tb[2]);
+ data = wpabuf_parse_bin(nr_s);
+ if (!data)
+ goto invalid;
+
+ /* BSSID */
s = blobmsg_get_string(tb[0]);
- if (hwaddr_aton(s, bssid))
+ if (strlen(s) == 0) {
+ /* Copy BSSID from neighbor report */
+ if (hwaddr_compact_aton(nr_s, bssid))
+ goto invalid;
+ } else if (hwaddr_aton(s, bssid)) {
goto invalid;
+ }
+ /* SSID */
s = blobmsg_get_string(tb[1]);
- ssid.ssid_len = strlen(s);
- if (ssid.ssid_len > sizeof(ssid.ssid))
- goto invalid;
+ if (strlen(s) == 0) {
+ /* Copy SSID from hostapd BSS conf */
+ memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid));
+ } else {
+ ssid.ssid_len = strlen(s);
+ if (ssid.ssid_len > sizeof(ssid.ssid))
+ goto invalid;
- memcpy(&ssid, s, ssid.ssid_len);
- data = wpabuf_parse_bin(blobmsg_get_string(tb[2]));
- if (!data)
- goto invalid;
+ memcpy(&ssid, s, ssid.ssid_len);
+ }
hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0);
wpabuf_free(data);