wihap_sta_disassoc(sc, sta,
wihap_sta_disassoc(sc, sta->addr,
wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data){	struct proc		*p = curproc;	struct ifreq		*ifr = (struct ifreq *) data;	struct wihap_info	*whi = &sc->wi_hostap_info;	struct wihap_sta_info	*sta;	struct hostap_getall	reqall;	struct hostap_sta	reqsta;	struct hostap_sta	stabuf;	int			s, error = 0, n, flag;	if (!(sc->sc_arpcom.ac_if.if_flags & IFF_RUNNING))		return ENODEV;	switch (command) {	case SIOCHOSTAP_DEL:		if ((error = suser(p->p_ucred, &p->p_acflag)))			break;		if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta))))			break;		s = splimp();		sta = wihap_sta_find(whi, reqsta.addr);		if (sta == NULL)			error = ENOENT;		else {			/* Disassociate station. */			if (sta->flags & WI_SIFLAGS_ASSOC)				wihap_sta_disassoc(sc, sta,				    IEEE80211_REASON_ASSOC_LEAVE);			/* Deauth station. */			if (sta->flags & WI_SIFLAGS_AUTHEN)				wihap_sta_deauth(sc, sta->addr,				    IEEE80211_REASON_AUTH_LEAVE);			wihap_sta_delete(sta);		}		splx(s);		break;	case SIOCHOSTAP_GET:		if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta))))			break;		s = splimp();		sta = wihap_sta_find(whi, reqsta.addr);		if (sta == NULL)			error = ENOENT;		else {			reqsta.flags = sta->flags;			reqsta.asid = sta->asid;			reqsta.capinfo = sta->capinfo;			reqsta.sig_info = sta->sig_info;			reqsta.rates = sta->rates;			error = copyout(&reqsta, ifr->ifr_data,			    sizeof(reqsta));		}		splx(s);		break;	case SIOCHOSTAP_ADD:		if ((error = suser(p->p_ucred, &p->p_acflag)))			break;		if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta))))			break;		s = splimp();		sta = wihap_sta_find(whi, reqsta.addr);		if (sta != NULL) {			error = EEXIST;			splx(s);			break;		}		if (whi->n_stations >= WIHAP_MAX_STATIONS) {			error = ENOSPC;			splx(s);			break;		}		sta = wihap_sta_alloc(sc, reqsta.addr);		sta->flags = reqsta.flags;		timeout_add(&sta->tmo, hz * whi->inactivity_time);		splx(s);		break;	case SIOCHOSTAP_SFLAGS:		if ((error = suser(p->p_ucred, &p->p_acflag)))			break;		if ((error = copyin(ifr->ifr_data, &flag, sizeof(int))))			break;		whi->apflags = (whi->apflags & WIHAPFL_CANTCHANGE) |		    (flag & ~WIHAPFL_CANTCHANGE);		break;	case SIOCHOSTAP_GFLAGS:		flag = (int) whi->apflags;		error = copyout(&flag, ifr->ifr_data, sizeof(int));		break;	case SIOCHOSTAP_GETALL:		if ((error = copyin(ifr->ifr_data, &reqall, sizeof(reqall))))			break;		reqall.nstations = whi->n_stations;		n = 0;		s = splimp();		sta = LIST_FIRST(&whi->sta_list);		while (sta && reqall.size >= n+sizeof(struct hostap_sta)) {			bcopy(sta->addr, stabuf.addr, ETHER_ADDR_LEN);			stabuf.asid = sta->asid;			stabuf.flags = sta->flags;			stabuf.capinfo = sta->capinfo;			stabuf.sig_info = sta->sig_info;			stabuf.rates = sta->rates;			error = copyout(&stabuf, (caddr_t) reqall.addr + n,			    sizeof(struct hostap_sta));			if (error)				break;			sta = LIST_NEXT(sta, list);			n += sizeof(struct hostap_sta);		}		splx(s);		if (!error)			error = copyout(&reqall, ifr->ifr_data,			    sizeof(reqall));		break;	default:		printf("wihap_ioctl: i shouldn't get other ioctls!\n");		error = EINVAL;	}	return (error);}