summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net80211/ieee80211_input.c')
-rw-r--r--sys/net80211/ieee80211_input.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 02232b6..1b3c3fb 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -233,7 +233,8 @@ ieee80211_input(struct ieee80211com *ic, struct mbuf *m,
* exist. This should probably done after an ACL check.
*/
if (ni == ic->ic_bss &&
- ic->ic_opmode != IEEE80211_M_HOSTAP) {
+ ic->ic_opmode != IEEE80211_M_HOSTAP &&
+ !IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) {
/*
* Fake up a node for this newly
* discovered member of the IBSS.
@@ -1957,6 +1958,12 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
* Create a new entry in the neighbor table.
*/
ni = ieee80211_add_neighbor(ic, wh, &scan);
+ } else if (ni->ni_capinfo == 0) {
+ /*
+ * Update faked node created on transmit.
+ * Note this also updates the tsf.
+ */
+ ieee80211_init_neighbor(ni, wh, &scan);
} else {
/*
* Record tsf for potential resync.
@@ -2017,8 +2024,12 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
return;
}
+ allocbs = 0;
if (ni == ic->ic_bss) {
- if (ic->ic_opmode == IEEE80211_M_IBSS) {
+ if (ic->ic_opmode != IEEE80211_M_IBSS) {
+ ni = ieee80211_tmp_node(ic, wh->i_addr2);
+ allocbs = 1;
+ } else if (!IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) {
/*
* XXX Cannot tell if the sender is operating
* in ibss mode. But we need a new node to
@@ -2027,13 +2038,10 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
*/
ni = ieee80211_fakeup_adhoc_node(&ic->ic_sta,
wh->i_addr2);
- } else
- ni = ieee80211_tmp_node(ic, wh->i_addr2);
+ }
if (ni == NULL)
return;
- allocbs = 1;
- } else
- allocbs = 0;
+ }
IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
"[%s] recv probe req\n", ether_sprintf(wh->i_addr2));
ni->ni_rssi = rssi;
@@ -2050,8 +2058,11 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
}
- if (allocbs && ic->ic_opmode != IEEE80211_M_IBSS) {
- /* reclaim immediately */
+ if (allocbs) {
+ /*
+ * Temporary node created just to send a
+ * response, reclaim immediately.
+ */
ieee80211_free_node(ni);
}
break;
OpenPOWER on IntegriCloud