mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-18 19:04:02 -05:00
hostapd: Make it possible to remove addresses from maclists
It is already possible to add MAC addresses at runtime. This patch allows also to remove some of them by using the prefix "-" in the address file. Signed-off-by: Emanuel Taube <emanuel.taube@gmail.com>
This commit is contained in:
parent
064eb057ca
commit
1748f1da3d
@ -129,6 +129,8 @@ static int hostapd_config_read_maclist(const char *fname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), f)) {
|
while (fgets(buf, sizeof(buf), f)) {
|
||||||
|
int i, rem = 0;
|
||||||
|
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
if (buf[0] == '#')
|
if (buf[0] == '#')
|
||||||
@ -143,14 +145,32 @@ static int hostapd_config_read_maclist(const char *fname,
|
|||||||
}
|
}
|
||||||
if (buf[0] == '\0')
|
if (buf[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
pos = buf;
|
||||||
|
if (buf[0] == '-') {
|
||||||
|
rem = 1;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
if (hwaddr_aton(buf, addr)) {
|
if (hwaddr_aton(pos, addr)) {
|
||||||
wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
|
wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
|
||||||
"line %d in '%s'", buf, line, fname);
|
"line %d in '%s'", pos, line, fname);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rem) {
|
||||||
|
i = 0;
|
||||||
|
while (i < *num) {
|
||||||
|
if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
|
||||||
|
0) {
|
||||||
|
os_remove_in_array(*acl, *num,
|
||||||
|
sizeof(**acl), i);
|
||||||
|
(*num)--;
|
||||||
|
} else
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
vlan_id = 0;
|
vlan_id = 0;
|
||||||
pos = buf;
|
pos = buf;
|
||||||
while (*pos != '\0' && *pos != ' ' && *pos != '\t')
|
while (*pos != '\0' && *pos != ' ' && *pos != '\t')
|
||||||
|
Loading…
Reference in New Issue
Block a user