mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
wext: don't force-disconnect in ad-hoc mode
Otherwise the driver might interpret the request as a request to create/join a new adhoc network with the bogus SSID. Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
f8e96eb6fd
commit
64a04447c3
@ -1923,21 +1923,36 @@ static int wpa_driver_wext_mlme(struct wpa_driver_wext_data *drv,
|
|||||||
|
|
||||||
static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
|
static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
|
||||||
{
|
{
|
||||||
|
struct iwreq iwr;
|
||||||
const u8 null_bssid[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
const u8 null_bssid[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||||
u8 ssid[32];
|
u8 ssid[32];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the BSSID selection and set a random SSID to make sure the
|
* Only force-disconnect when the card is in infrastructure mode,
|
||||||
* driver will not be trying to associate with something even if it
|
* otherwise the driver might interpret the cleared BSSID and random
|
||||||
* does not understand SIOCSIWMLME commands (or tries to associate
|
* SSID as an attempt to create a new ad-hoc network.
|
||||||
* automatically after deauth/disassoc).
|
|
||||||
*/
|
*/
|
||||||
wpa_driver_wext_set_bssid(drv, null_bssid);
|
os_memset(&iwr, 0, sizeof(iwr));
|
||||||
|
os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||||
|
if (ioctl(drv->ioctl_sock, SIOCGIWMODE, &iwr) < 0) {
|
||||||
|
perror("ioctl[SIOCGIWMODE]");
|
||||||
|
iwr.u.mode = IW_MODE_INFRA;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
if (iwr.u.mode == IW_MODE_INFRA) {
|
||||||
ssid[i] = rand() & 0xFF;
|
/*
|
||||||
wpa_driver_wext_set_ssid(drv, ssid, 32);
|
* Clear the BSSID selection and set a random SSID to make sure
|
||||||
|
* the driver will not be trying to associate with something
|
||||||
|
* even if it does not understand SIOCSIWMLME commands (or
|
||||||
|
* tries to associate automatically after deauth/disassoc).
|
||||||
|
*/
|
||||||
|
wpa_driver_wext_set_bssid(drv, null_bssid);
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
ssid[i] = rand() & 0xFF;
|
||||||
|
wpa_driver_wext_set_ssid(drv, ssid, 32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user