if_printf(&ic->ic_if, "open authentication failed (reason %d) for %s\n", status, ether_sprintf(wh->i_addr3));
if (ifp->if_flags & IFF_DEBUG) if_printf(&ic->ic_if, "open authentication failed (reason %d) " "for %s\n", status, ether_sprintf(wh->i_addr3));
ieee80211_auth_open(struct ieee80211com *ic, struct ieee80211_frame *wh,    struct ieee80211_node *ni, int rssi, u_int32_t rstamp, u_int16_t seq,    u_int16_t status){	struct ifnet *ifp = &ic->ic_if;	int allocbs;	switch (ic->ic_opmode) {	case IEEE80211_M_IBSS:		if (ic->ic_state != IEEE80211_S_RUN ||		    seq != IEEE80211_AUTH_OPEN_REQUEST) {			IEEE80211_DPRINTF(("%s: discard auth from %s; "				"state %u, seq %u\n", __func__,				ether_sprintf(wh->i_addr2),				ic->ic_state, seq));			ic->ic_stats.is_rx_bad_auth++;			return;		}		ieee80211_new_state(ic, IEEE80211_S_AUTH,		    wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);		break;	case IEEE80211_M_AHDEMO:		/* should not come here */		break;	case IEEE80211_M_HOSTAP:		if (ic->ic_state != IEEE80211_S_RUN ||		    seq != IEEE80211_AUTH_OPEN_REQUEST) {			IEEE80211_DPRINTF(("%s: discard auth from %s; "				"state %u, seq %u\n", __func__,				ether_sprintf(wh->i_addr2),				ic->ic_state, seq));			ic->ic_stats.is_rx_bad_auth++;			return;		}		if (ni == ic->ic_bss) {			ni = ieee80211_alloc_node(ic, wh->i_addr2);			if (ni == NULL) {				ic->ic_stats.is_rx_nodealloc++;				return;			}			IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_bss->ni_bssid);			ni->ni_rssi = rssi;			ni->ni_rstamp = rstamp;			ni->ni_chan = ic->ic_bss->ni_chan;			allocbs = 1;		} else			allocbs = 0;		IEEE80211_SEND_MGMT(ic, ni,			IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);		if (ifp->if_flags & IFF_DEBUG)			if_printf(ifp, "station %s %s authenticated (open)\n",			    ether_sprintf(ni->ni_macaddr),			    (allocbs ? "newly" : "already"));		break;	case IEEE80211_M_STA:		if (ic->ic_state != IEEE80211_S_AUTH ||		    seq != IEEE80211_AUTH_OPEN_RESPONSE) {			ic->ic_stats.is_rx_bad_auth++;			IEEE80211_DPRINTF(("%s: discard auth from %s; "				"state %u, seq %u\n", __func__,				ether_sprintf(wh->i_addr2),				ic->ic_state, seq));			return;		}		if (status != 0) {			if_printf(&ic->ic_if,			    "open authentication failed (reason %d) for %s\n",			    status,			    ether_sprintf(wh->i_addr3));			if (ni != ic->ic_bss)				ni->ni_fails++;			ic->ic_stats.is_rx_auth_fail++;			return;		}		ieee80211_new_state(ic, IEEE80211_S_ASSOC,		    wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);		break;	case IEEE80211_M_MONITOR:		break;	}}