openbsd_wlan: Implement IEEE80211_IOC_MLME for leaving networks.

This commit is contained in:
Augustin Cavalier
2022-06-09 01:28:56 -04:00
parent 2f7936a683
commit ea7c830790
2 changed files with 37 additions and 2 deletions
@@ -299,6 +299,8 @@ struct ieee80211req_del_key {
uint8_t idk_macaddr[IEEE80211_ADDR_LEN];
};
#endif /* IEEE80211_IOCTLS_ABBREVIATED */
/*
* MLME state manipulation request. IEEE80211_MLME_ASSOC
* only makes sense when operating as a station. The other
@@ -319,6 +321,8 @@ struct ieee80211req_mlme {
uint8_t im_ssid[IEEE80211_NWID_LEN];
};
#ifndef IEEE80211_IOCTLS_ABBREVIATED
/*
* MAC ACL operations.
*/
@@ -382,7 +386,6 @@ struct ieee80211req_chanlist {
uint8_t ic_channels[32]; /* NB: can be variable length */
};
#ifndef IEEE80211_IOCTLS_ABBREVIATED
/*
* Get the active channel list info.
*/
@@ -395,7 +398,6 @@ struct ieee80211req_chaninfo {
(((_nchan)-1) * sizeof(struct ieee80211_channel)))
#define IEEE80211_CHANINFO_SPACE(_ci) \
IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)
#endif
/*
* Retrieve the WPA/RSN information element for an associated station.
@@ -321,6 +321,39 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length)
break;
}
case IEEE80211_IOC_MLME: {
if (op != SIOCS80211)
return B_BAD_VALUE;
struct ieee80211req_mlme mlme;
if (user_memcpy(&mlme, ireq.i_data, min_c(sizeof(mlme), ireq.i_len)) != B_OK)
return B_BAD_ADDRESS;
switch (mlme.im_op) {
case IEEE80211_MLME_DISASSOC:
case IEEE80211_MLME_DEAUTH: {
struct ifreq ifr;
struct ieee80211_nwid nwid;
ifr.ifr_data = (uint8_t*)&nwid;
nwid.i_len = 0;
IFF_LOCKGIANT(ifp);
status_t status = ifp->if_ioctl(ifp, SIOCS80211NWID, (caddr_t)&ifr);
IFF_UNLOCKGIANT(ifp);
if (status != 0)
return status;
break;
}
default:
TRACE("openbsd wlan_control: unsupported MLME operation %" B_PRIu8 "\n",
mlme.im_op);
return EOPNOTSUPP;
}
break;
}
case IEEE80211_IOC_HAIKU_JOIN: {
if (op != SIOCS80211)
return B_BAD_VALUE;