diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-23 18:50:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-23 18:50:09 +0000 |
commit | 0e487d9ea8a83d70aab5fbadd4d297a625da75b1 (patch) | |
tree | bce61c666ca7f50406d57241cc338bc74ed527db /sys/dev/ic/if_wi_hostap.c | |
parent | b1507a5ac086ffcc999cd56289046ab03c30e494 (diff) |
If we receive a packet with our BSSID from an unassociated station,
tell the station to disassociate itself. This fixes a problem when
the HostAP reboots but stations still think they are associated.
With this change the station will re-associate properly.
Change wihap_sta_disassoc() to take an array of u_int8_t (ether
addr) instead of a struct wihap_sta_info * to make the above change
possible. This is also consistent with wihap_sta_deauth().
Diffstat (limited to 'sys/dev/ic/if_wi_hostap.c')
-rw-r--r-- | sys/dev/ic/if_wi_hostap.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/dev/ic/if_wi_hostap.c b/sys/dev/ic/if_wi_hostap.c index c07276ae404..606528bbf58 100644 --- a/sys/dev/ic/if_wi_hostap.c +++ b/sys/dev/ic/if_wi_hostap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_hostap.c,v 1.17 2002/06/21 06:56:24 millert Exp $ */ +/* $OpenBSD: if_wi_hostap.c,v 1.18 2002/06/23 18:50:08 millert Exp $ */ /* * Copyright (c) 2002 @@ -89,8 +89,8 @@ void wihap_deauth_req(struct wi_softc *sc, struct wi_frame *rxfrm, caddr_t pkt, int len); void wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm, caddr_t pkt, int len); -void wihap_sta_disassoc(struct wi_softc *sc, - struct wihap_sta_info *sta, u_int16_t reason); +void wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], + u_int16_t reason); void wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm, caddr_t pkt, int len); @@ -209,14 +209,13 @@ wihap_init(struct wi_softc *sc) * Send a disassociation frame to a specified station. */ void -wihap_sta_disassoc(struct wi_softc *sc, - struct wihap_sta_info *sta, u_int16_t reason) +wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason) { struct wi_80211_hdr *resp_hdr; caddr_t pkt; if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG) - printf("Sending disassoc to sta %s\n", ether_sprintf(sta->addr)); + printf("Sending disassoc to sta %s\n", ether_sprintf(sta_addr)); /* Send disassoc packet. */ resp_hdr = (struct wi_80211_hdr *)sc->wi_txbuf; @@ -224,7 +223,7 @@ wihap_sta_disassoc(struct wi_softc *sc, resp_hdr->frame_ctl = WI_FTYPE_MGMT | WI_STYPE_MGMT_DISAS; pkt = (caddr_t)&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->sc_arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN); bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN); @@ -239,8 +238,7 @@ wihap_sta_disassoc(struct wi_softc *sc, * Send a deauthentication message to a specified station. */ void -wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], - u_int16_t reason) +wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason) { struct wi_80211_hdr *resp_hdr; caddr_t pkt; @@ -296,7 +294,7 @@ wihap_shutdown(struct wi_softc *sc) if (sc->wi_flags & WI_FLAGS_ATTACHED) { /* Disassociate station. */ if (sta->flags & WI_SIFLAGS_ASSOC) - wihap_sta_disassoc(sc, sta, + wihap_sta_disassoc(sc, sta->addr, IEEE80211_REASON_ASSOC_LEAVE); /* Deauth station. */ if (sta->flags & WI_SIFLAGS_AUTHEN) @@ -347,7 +345,8 @@ wihap_sta_timeout(void *v) ether_sprintf(sta->addr)); /* 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; timeout_add(&sta->tmo, hz * whi->inactivity_time); @@ -1075,6 +1074,8 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m) if (ifp->if_flags & IFF_DEBUG) printf("wihap_data_input: dropping unassoc src %s\n", ether_sprintf(rxfrm->wi_addr2)); + wihap_sta_disassoc(sc, rxfrm->wi_addr2, + IEEE80211_REASON_ASSOC_LEAVE); splx(s); m_freem(m); return (1); @@ -1150,7 +1151,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) else { /* Disassociate station. */ if (sta->flags & WI_SIFLAGS_ASSOC) - wihap_sta_disassoc(sc, sta, + wihap_sta_disassoc(sc, sta->addr, IEEE80211_REASON_ASSOC_LEAVE); /* Deauth station. */ if (sta->flags & WI_SIFLAGS_AUTHEN) |