Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
intel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feed
intel
Commits
bc03acb6
Commit
bc03acb6
authored
5 years ago
by
Anjan Chanda
Browse files
Options
Downloads
Patches
Plain Diff
hostapd_wave: dumps 11k neighbors with list_neighbor_per_vap
parent
9262f30e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hostapd_wave/patches/0501-list_neighbor_per_vap-to-dump-11k-neighbors.patch
+128
-0
128 additions, 0 deletions
...es/0501-list_neighbor_per_vap-to-dump-11k-neighbors.patch
with
128 additions
and
0 deletions
hostapd_wave/patches/0501-list_neighbor_per_vap-to-dump-11k-neighbors.patch
0 → 100644
+
128
−
0
View file @
bc03acb6
From a61f14930a4d1e618bf3571203431a2f1e07fa15 Mon Sep 17 00:00:00 2001
From: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: Tue, 8 Oct 2019 15:58:26 +0200
Subject: [PATCH] add list_neighbor_per_vap to dump 11k neighbor list
---
hostapd/ctrl_iface.c | 9 +++++++++
hostapd/hostapd_cli.c | 8 ++++++++
src/ap/neighbor_db.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/ap/neighbor_db.h | 2 ++
4 files changed, 60 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 56c1641..ecb4491 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -5853,6 +5853,12 @@
static int hostapd_ctrl_iface_remove_neighbor_per_vap(struct hostapd_data *hapd,
return hostapd_neighbor_remove(hapd, bssid, &ssid);
}
+static int hostapd_ctrl_iface_list_neighbor_per_vap(struct hostapd_data *hapd,
+ char *reply, size_t len)
+{
+ return hostapd_neighbor_list(hapd, reply, len);
+}
+
static int
hostapd_is_chandef_valid (struct hostapd_iface *iface, unsigned int center_freq, unsigned int bandwidth)
{
@@ -7037,6 +7043,9 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "REMOVE_NEIGHBOR_PER_VAP ", 24) == 0) {
if (hostapd_ctrl_iface_remove_neighbor_per_vap(hapd, buf + 24))
reply_len = -1;
+ } else if (os_strncmp(buf, "LIST_NEIGHBOR_PER_VAP", 21) == 0) {
+ reply_len = hostapd_ctrl_iface_list_neighbor_per_vap(hapd,
+ reply, reply_size);
} else if (os_strncmp(buf, "REQ_LCI ", 8) == 0) {
if (hostapd_ctrl_iface_req_lci(hapd, buf + 8))
reply_len = -1;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index ce92618..0909ccb 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1363,6 +1363,12 @@
static int hostapd_cli_cmd_remove_neighbor_per_vap(struct wpa_ctrl *ctrl, int ar
return wpa_ctrl_command(ctrl, cmd);
}
+static int hostapd_cli_cmd_list_neighbor_per_vap(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "LIST_NEIGHBOR_PER_VAP");
+}
+
static int hostapd_cli_cmd_req_lci(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -2257,6 +2263,8 @@
static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
{ "set_neighbor_per_vap", hostapd_cli_cmd_set_neighbor_per_vap, NULL, NULL },
{ "remove_neighbor", hostapd_cli_cmd_remove_neighbor, NULL, NULL },
{ "remove_neighbor_per_vap", hostapd_cli_cmd_remove_neighbor_per_vap, NULL, NULL },
+ { "list_neighbor_per_vap", hostapd_cli_cmd_list_neighbor_per_vap, NULL,
+ "= list neighbor APs"},
{ "req_lci", hostapd_cli_cmd_req_lci, NULL, NULL },
{ "req_range", hostapd_cli_cmd_req_range, NULL, NULL },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL, NULL },
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index f65afff..b19b693 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -131,3 +131,44 @@
void hostpad_free_neighbor_db(struct hostapd_data *hapd)
os_free(nr);
}
}
+
+int hostapd_neighbor_list(struct hostapd_data *hapd, char *rbuf, size_t rlen)
+{
+ struct hostapd_neighbor_entry *n;
+ struct nbr {
+ u8 bssid[ETH_ALEN];
+ u32 bssid_info;
+ u8 reg;
+ u8 channel;
+ u8 phy;
+ } __attribute__((packed)) *nbr;
+ unsigned char obuf[256] = {0};
+ int len = 0, ret = 0;
+ int i;
+
+ dl_list_for_each(n, &hapd->nr_db, struct hostapd_neighbor_entry, list) {
+ if (len + sizeof(struct nbr) > rlen)
+ break;
+
+ if (!os_memcmp(n->bssid, hapd->own_addr, ETH_ALEN))
+ continue;
+
+ nbr = (struct nbr *)&obuf[len];
+ if (n->nr) {
+ os_memcpy(nbr, wpabuf_head(n->nr), wpabuf_len(n->nr));
+ len += sizeof(struct nbr);
+ }
+ }
+
+ if (len > 0) {
+ rbuf[0] = '\0';
+ /* convert to hexbyte-stream */
+ for (i = 0; i < len; i++)
+ sprintf(rbuf + strlen(rbuf), "%02x", obuf[i] & 0xff);
+
+ rbuf[2 * len] = '\0';
+ ret = 2 * len + 1;
+ }
+
+ return ret;
+}
diff --git a/src/ap/neighbor_db.h b/src/ap/neighbor_db.h
index c22e043..eda7227 100644
--- a/src/ap/neighbor_db.h
+++ b/src/ap/neighbor_db.h
@@ -21,4 +21,6 @@
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
const struct wpa_ssid_value *ssid);
void hostpad_free_neighbor_db(struct hostapd_data *hapd);
+int hostapd_neighbor_list(struct hostapd_data *hapd, char *rbuf, size_t rlen);
+
#endif /* NEIGHBOR_DB_H */
--
2.7.4
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment