Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net80211/ieee80211_adhoc.c
Show First 20 Lines • Show All 709 Lines • ▼ Show 20 Lines | adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, | ||||
uint8_t *ssid, *rates, *xrates; | uint8_t *ssid, *rates, *xrates; | ||||
#if 0 | #if 0 | ||||
int ht_state_change = 0; | int ht_state_change = 0; | ||||
#endif | #endif | ||||
wh = mtod(m0, struct ieee80211_frame *); | wh = mtod(m0, struct ieee80211_frame *); | ||||
frm = (uint8_t *)&wh[1]; | frm = (uint8_t *)&wh[1]; | ||||
efrm = mtod(m0, uint8_t *) + m0->m_len; | efrm = mtod(m0, uint8_t *) + m0->m_len; | ||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, | |||||
"%s: recv mgmt frame, addr2=%6D, ni=%p (%6D) fc=%.02x %.02x\n", | |||||
__func__, | |||||
wh->i_addr2, ":", | |||||
ni, | |||||
ni->ni_macaddr, ":", | |||||
wh->i_fc[0], | |||||
wh->i_fc[1]); | |||||
switch (subtype) { | switch (subtype) { | ||||
case IEEE80211_FC0_SUBTYPE_PROBE_RESP: | case IEEE80211_FC0_SUBTYPE_PROBE_RESP: | ||||
case IEEE80211_FC0_SUBTYPE_BEACON: { | case IEEE80211_FC0_SUBTYPE_BEACON: { | ||||
struct ieee80211_scanparams scan; | struct ieee80211_scanparams scan; | ||||
struct ieee80211_channel *c; | struct ieee80211_channel *c; | ||||
/* | /* | ||||
* We process beacon/probe response | * We process beacon/probe response | ||||
* frames to discover neighbors. | * frames to discover neighbors. | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | if (scan.capinfo & IEEE80211_CAPINFO_IBSS) { | ||||
vap->iv_myaddr, /* SA */ | vap->iv_myaddr, /* SA */ | ||||
ni->ni_macaddr, /* DA */ | ni->ni_macaddr, /* DA */ | ||||
vap->iv_bss->ni_bssid, /* BSSID */ | vap->iv_bss->ni_bssid, /* BSSID */ | ||||
vap->iv_bss->ni_essid, | vap->iv_bss->ni_essid, | ||||
vap->iv_bss->ni_esslen); /* SSID */ | vap->iv_bss->ni_esslen); /* SSID */ | ||||
} else | } else | ||||
ni = NULL; | ni = NULL; | ||||
/* | |||||
* Send a probe request so we announce 11n | |||||
* capabilities. | |||||
* | |||||
* Don't do this if we're scanning. | |||||
*/ | |||||
if (! (ic->ic_flags & IEEE80211_F_SCAN)) | |||||
ieee80211_send_probereq(ni, /* node */ | |||||
vap->iv_myaddr, /* SA */ | |||||
ni->ni_macaddr, /* DA */ | |||||
vap->iv_bss->ni_bssid, /* BSSID */ | |||||
vap->iv_bss->ni_essid, | |||||
vap->iv_bss->ni_esslen); /* SSID */ | |||||
} else if (ni->ni_capinfo == 0) { | } else if (ni->ni_capinfo == 0) { | ||||
/* | /* | ||||
* Update faked node created on transmit. | * Update faked node created on transmit. | ||||
* Note this also updates the tsf. | * Note this also updates the tsf. | ||||
*/ | */ | ||||
ieee80211_init_neighbor(ni, wh, &scan); | ieee80211_init_neighbor(ni, wh, &scan); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | #endif | ||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK: | case IEEE80211_FC0_SUBTYPE_ACTION_NOACK: | ||||
if ((ni == vap->iv_bss) && | if ((ni == vap->iv_bss) && | ||||
!IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { | !IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { | ||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, | IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, | ||||
wh, NULL, "%s", "unknown node"); | wh, NULL, "%s", "unknown node"); | ||||
vap->iv_stats.is_rx_mgtdiscard++; | vap->iv_stats.is_rx_mgtdiscard++; | ||||
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) && | } else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) && | ||||
!IEEE80211_IS_MULTICAST(wh->i_addr1)) { | !IEEE80211_IS_MULTICAST(wh->i_addr1)) { | ||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, | IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, | ||||
wh, NULL, "%s", "not for us"); | wh, NULL, "%s", "not for us"); | ||||
vap->iv_stats.is_rx_mgtdiscard++; | vap->iv_stats.is_rx_mgtdiscard++; | ||||
} else if (vap->iv_state != IEEE80211_S_RUN) { | } else if (vap->iv_state != IEEE80211_S_RUN) { | ||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, | IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, | ||||
wh, NULL, "wrong state %s", | wh, NULL, "wrong state %s", | ||||
ieee80211_state_name[vap->iv_state]); | ieee80211_state_name[vap->iv_state]); | ||||
vap->iv_stats.is_rx_mgtdiscard++; | vap->iv_stats.is_rx_mgtdiscard++; | ||||
} else { | } else { | ||||
if (ieee80211_parse_action(ni, m0) == 0) | if (ieee80211_parse_action(ni, m0) == 0) | ||||
(void)ic->ic_recv_action(ni, wh, frm, efrm); | (void)ic->ic_recv_action(ni, wh, frm, efrm); | ||||
} | } | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |