mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
Allow removing neighbor DB entries by BSSID alone
Let users delete a neighbor by BSSID alone if they prefer. The underlying code already properly handled a NULL SSID, so just relax the control interface command calling restrictions. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
parent
bf3ab50f4f
commit
70755e6587
@ -2813,6 +2813,7 @@ static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
|
|||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct wpa_ssid_value ssid;
|
struct wpa_ssid_value ssid;
|
||||||
|
struct wpa_ssid_value *ssidp = NULL;
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
@ -2822,13 +2823,16 @@ static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp = os_strstr(buf, "ssid=");
|
tmp = os_strstr(buf, "ssid=");
|
||||||
if (!tmp || ssid_parse(tmp + 5, &ssid)) {
|
if (tmp) {
|
||||||
|
ssidp = &ssid;
|
||||||
|
if (ssid_parse(tmp + 5, &ssid)) {
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"CTRL: REMOVE_NEIGHBORr: Bad or missing SSID");
|
"CTRL: REMOVE_NEIGHBOR: Bad SSID");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hostapd_neighbor_remove(hapd, bssid, &ssid);
|
return hostapd_neighbor_remove(hapd, bssid, ssidp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1315,21 +1315,7 @@ static int hostapd_cli_cmd_set_neighbor(struct wpa_ctrl *ctrl, int argc,
|
|||||||
static int hostapd_cli_cmd_remove_neighbor(struct wpa_ctrl *ctrl, int argc,
|
static int hostapd_cli_cmd_remove_neighbor(struct wpa_ctrl *ctrl, int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
char cmd[400];
|
return hostapd_cli_cmd(ctrl, "REMOVE_NEIGHBOR", 1, argc, argv);
|
||||||
int res;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
printf("Invalid remove_neighbor command: needs 2 arguments\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = os_snprintf(cmd, sizeof(cmd), "REMOVE_NEIGHBOR %s %s",
|
|
||||||
argv[0], argv[1]);
|
|
||||||
if (os_snprintf_error(sizeof(cmd), res)) {
|
|
||||||
printf("Too long REMOVE_NEIGHBOR command.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return wpa_ctrl_command(ctrl, cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1637,7 +1623,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
|
|||||||
"<addr> <ssid=> <nr=> [lci=] [civic=] [stat]\n"
|
"<addr> <ssid=> <nr=> [lci=] [civic=] [stat]\n"
|
||||||
" = add AP to neighbor database" },
|
" = add AP to neighbor database" },
|
||||||
{ "remove_neighbor", hostapd_cli_cmd_remove_neighbor, NULL,
|
{ "remove_neighbor", hostapd_cli_cmd_remove_neighbor, NULL,
|
||||||
"<addr> <ssid=> = remove AP from neighbor database" },
|
"<addr> [ssid=<hex>] = remove AP from neighbor database" },
|
||||||
{ "req_lci", hostapd_cli_cmd_req_lci, hostapd_complete_stations,
|
{ "req_lci", hostapd_cli_cmd_req_lci, hostapd_complete_stations,
|
||||||
"<addr> = send LCI request to a station"},
|
"<addr> = send LCI request to a station"},
|
||||||
{ "req_range", hostapd_cli_cmd_req_range, NULL,
|
{ "req_range", hostapd_cli_cmd_req_range, NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user