Send a disassoc packet for a STA that we don't know about that claims to
be associated with us. From millert@openbsd.org Obtained from: OpenBSD (I think)
This commit is contained in:
parent
bec60c0fd8
commit
ffd283ae15
@ -132,6 +132,7 @@ struct wi_softc {
|
|||||||
#define WI_FLAGS_HAS_MOR 0x20
|
#define WI_FLAGS_HAS_MOR 0x20
|
||||||
#define WI_FLAGS_HAS_ROAMING 0x30
|
#define WI_FLAGS_HAS_ROAMING 0x30
|
||||||
#define WI_FLAGS_HAS_DIVERSITY 0x40
|
#define WI_FLAGS_HAS_DIVERSITY 0x40
|
||||||
|
#define WI_FLAGS_HAS_HOSTAP 0x80
|
||||||
int wi_if_flags;
|
int wi_if_flags;
|
||||||
u_int16_t wi_procframe;
|
u_int16_t wi_procframe;
|
||||||
u_int16_t wi_ptype;
|
u_int16_t wi_ptype;
|
||||||
|
@ -99,8 +99,8 @@ static void wihap_deauth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
|
|||||||
caddr_t pkt, int len);
|
caddr_t pkt, int len);
|
||||||
static void wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
|
static void wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
|
||||||
caddr_t pkt, int len);
|
caddr_t pkt, int len);
|
||||||
static void wihap_sta_disassoc(struct wi_softc *sc,
|
static void wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[],
|
||||||
struct wihap_sta_info *sta, u_int16_t reason);
|
u_int16_t reason);
|
||||||
static void wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
|
static void wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
|
||||||
caddr_t pkt, int len);
|
caddr_t pkt, int len);
|
||||||
|
|
||||||
@ -226,14 +226,13 @@ wihap_init(struct wi_softc *sc)
|
|||||||
* Send a disassociation frame to a specified station.
|
* Send a disassociation frame to a specified station.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
wihap_sta_disassoc(struct wi_softc *sc,
|
wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
|
||||||
struct wihap_sta_info *sta, u_int16_t reason)
|
|
||||||
{
|
{
|
||||||
struct wi_80211_hdr *resp_hdr;
|
struct wi_80211_hdr *resp_hdr;
|
||||||
caddr_t pkt;
|
caddr_t pkt;
|
||||||
|
|
||||||
if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
|
if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
|
||||||
printf("Sending disassoc to sta %6D\n", sta->addr, ":");
|
printf("Sending disassoc to sta %6D\n", sta_addr, ":");
|
||||||
|
|
||||||
/* Send disassoc packet. */
|
/* Send disassoc packet. */
|
||||||
resp_hdr = (struct wi_80211_hdr *) sc->wi_txbuf;
|
resp_hdr = (struct wi_80211_hdr *) sc->wi_txbuf;
|
||||||
@ -241,7 +240,7 @@ wihap_sta_disassoc(struct wi_softc *sc,
|
|||||||
resp_hdr->frame_ctl = WI_FTYPE_MGMT | WI_STYPE_MGMT_DISAS;
|
resp_hdr->frame_ctl = WI_FTYPE_MGMT | WI_STYPE_MGMT_DISAS;
|
||||||
pkt = sc->wi_txbuf + sizeof(struct wi_80211_hdr);
|
pkt = sc->wi_txbuf + sizeof(struct wi_80211_hdr);
|
||||||
|
|
||||||
bcopy(sta->addr, resp_hdr->addr1, ETHER_ADDR_LEN);
|
bcopy(sta_addr, resp_hdr->addr1, ETHER_ADDR_LEN);
|
||||||
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
|
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
|
||||||
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
|
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
|
||||||
|
|
||||||
@ -255,8 +254,7 @@ wihap_sta_disassoc(struct wi_softc *sc,
|
|||||||
* Send a deauthentication message to a specified station.
|
* Send a deauthentication message to a specified station.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[],
|
wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
|
||||||
u_int16_t reason)
|
|
||||||
{
|
{
|
||||||
struct wi_80211_hdr *resp_hdr;
|
struct wi_80211_hdr *resp_hdr;
|
||||||
caddr_t pkt;
|
caddr_t pkt;
|
||||||
@ -308,7 +306,7 @@ wihap_shutdown(struct wi_softc *sc)
|
|||||||
if (!sc->wi_gone) {
|
if (!sc->wi_gone) {
|
||||||
/* Disassociate station. */
|
/* Disassociate station. */
|
||||||
if (sta->flags & WI_SIFLAGS_ASSOC)
|
if (sta->flags & WI_SIFLAGS_ASSOC)
|
||||||
wihap_sta_disassoc(sc, sta,
|
wihap_sta_disassoc(sc, sta->addr,
|
||||||
IEEE80211_REASON_ASSOC_LEAVE);
|
IEEE80211_REASON_ASSOC_LEAVE);
|
||||||
/* Deauth station. */
|
/* Deauth station. */
|
||||||
if (sta->flags & WI_SIFLAGS_AUTHEN)
|
if (sta->flags & WI_SIFLAGS_AUTHEN)
|
||||||
@ -360,7 +358,8 @@ wihap_sta_timeout(void *v)
|
|||||||
sta->addr, ":");
|
sta->addr, ":");
|
||||||
|
|
||||||
/* Disassoc station. */
|
/* Disassoc station. */
|
||||||
wihap_sta_disassoc(sc, sta, IEEE80211_REASON_ASSOC_EXPIRE);
|
wihap_sta_disassoc(sc, sta->addr,
|
||||||
|
IEEE80211_REASON_ASSOC_EXPIRE);
|
||||||
sta->flags &= ~WI_SIFLAGS_ASSOC;
|
sta->flags &= ~WI_SIFLAGS_ASSOC;
|
||||||
|
|
||||||
sta->tmo = timeout(wihap_sta_timeout, sta,
|
sta->tmo = timeout(wihap_sta_timeout, sta,
|
||||||
@ -654,20 +653,16 @@ fail:
|
|||||||
bcopy(rxfrm->wi_addr2, resp_hdr->addr1, ETHER_ADDR_LEN);
|
bcopy(rxfrm->wi_addr2, resp_hdr->addr1, ETHER_ADDR_LEN);
|
||||||
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
|
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
|
||||||
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
|
bcopy(sc->arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
|
||||||
|
|
||||||
pkt = &sc->wi_txbuf[sizeof(struct wi_80211_hdr)];
|
pkt = &sc->wi_txbuf[sizeof(struct wi_80211_hdr)];
|
||||||
put_hword(&pkt, algo);
|
put_hword(&pkt, algo);
|
||||||
put_hword(&pkt, seq);
|
put_hword(&pkt, seq);
|
||||||
put_hword(&pkt, status);
|
put_hword(&pkt, status);
|
||||||
if (challenge_len>0)
|
if (challenge_len > 0)
|
||||||
put_tlv(&pkt, IEEE80211_ELEMID_CHALLENGE,
|
put_tlv(&pkt, IEEE80211_ELEMID_CHALLENGE,
|
||||||
challenge, challenge_len);
|
challenge, challenge_len);
|
||||||
|
wi_mgmt_xmit(sc, sc->wi_txbuf, (char *) pkt - (char *) sc->wi_txbuf);
|
||||||
wi_mgmt_xmit(sc, sc->wi_txbuf, 6 + sizeof(struct wi_80211_hdr) +
|
|
||||||
(challenge_len > 0 ? challenge_len + 2 : 0) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* wihap_assoc_req()
|
/* wihap_assoc_req()
|
||||||
*
|
*
|
||||||
* Handle incoming association and reassociation requests.
|
* Handle incoming association and reassociation requests.
|
||||||
@ -1089,6 +1084,8 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
|
|||||||
if (ifp->if_flags & IFF_DEBUG)
|
if (ifp->if_flags & IFF_DEBUG)
|
||||||
printf("wihap_data_input: dropping unassoc src %6D\n",
|
printf("wihap_data_input: dropping unassoc src %6D\n",
|
||||||
rxfrm->wi_addr2, ":");
|
rxfrm->wi_addr2, ":");
|
||||||
|
wihap_sta_disassoc(sc, rxfrm->wi_addr2,
|
||||||
|
IEEE80211_REASON_ASSOC_LEAVE);
|
||||||
splx(s);
|
splx(s);
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
return(1);
|
return(1);
|
||||||
@ -1159,7 +1156,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data)
|
|||||||
else {
|
else {
|
||||||
/* Disassociate station. */
|
/* Disassociate station. */
|
||||||
if (sta->flags & WI_SIFLAGS_ASSOC)
|
if (sta->flags & WI_SIFLAGS_ASSOC)
|
||||||
wihap_sta_disassoc(sc, sta,
|
wihap_sta_disassoc(sc, sta->addr,
|
||||||
IEEE80211_REASON_ASSOC_LEAVE);
|
IEEE80211_REASON_ASSOC_LEAVE);
|
||||||
/* Deauth station. */
|
/* Deauth station. */
|
||||||
if (sta->flags & WI_SIFLAGS_AUTHEN)
|
if (sta->flags & WI_SIFLAGS_AUTHEN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user