2007-11-27 22:06:27 +00:00
|
|
|
Index: madwifi-ng-r2978-20071127/ath/if_ath.c
|
2007-06-04 11:25:53 +00:00
|
|
|
===================================================================
|
2007-11-27 22:06:27 +00:00
|
|
|
--- madwifi-ng-r2978-20071127.orig/ath/if_ath.c 2007-11-27 21:18:24.910671912 +0100
|
|
|
|
+++ madwifi-ng-r2978-20071127/ath/if_ath.c 2007-11-27 21:21:37.137626301 +0100
|
|
|
|
@@ -515,7 +515,6 @@
|
2007-06-02 17:04:43 +00:00
|
|
|
*/
|
2007-11-27 22:06:27 +00:00
|
|
|
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
|
|
|
|
((bssid_mask)[0] &= ~(((ATH_BCBUF-1) << 2) | 0x02))
|
2007-06-02 17:04:43 +00:00
|
|
|
-#define ATH_GET_VAP_ID(bssid) ((bssid)[0] >> 2)
|
2007-11-27 22:06:27 +00:00
|
|
|
#define ATH_SET_VAP_BSSID(bssid, id) \
|
|
|
|
do { \
|
|
|
|
if (id) \
|
|
|
|
@@ -1203,7 +1202,11 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
case IEEE80211_M_IBSS:
|
2007-11-27 22:06:27 +00:00
|
|
|
if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA))
|
|
|
|
return NULL;
|
2007-05-31 03:41:01 +00:00
|
|
|
- ic_opmode = opmode;
|
2007-11-27 22:06:27 +00:00
|
|
|
+ else if (sc->sc_nvaps == 0)
|
2007-05-31 03:41:01 +00:00
|
|
|
+ ic_opmode = opmode;
|
|
|
|
+ else
|
|
|
|
+ ic_opmode = IEEE80211_M_HOSTAP;
|
|
|
|
+ sc->sc_nibssvaps++;
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_AHDEMO:
|
|
|
|
case IEEE80211_M_MONITOR:
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -1233,7 +1236,7 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (sc->sc_nvaps >= ATH_BCBUF) {
|
|
|
|
+ if (sc->sc_nvaps + sc->sc_nibssvaps >= ATH_BCBUF) {
|
2007-11-27 22:06:27 +00:00
|
|
|
printk(KERN_WARNING "too many virtual APs (already got %d)\n",
|
|
|
|
sc->sc_nvaps);
|
2007-05-31 03:41:01 +00:00
|
|
|
return NULL;
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -1288,6 +1291,7 @@
|
|
|
|
/* Use RadioTAP interface type for monitor mode. */
|
2007-05-31 03:41:01 +00:00
|
|
|
dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
2007-07-03 21:03:58 +00:00
|
|
|
|
2007-06-01 10:29:49 +00:00
|
|
|
+ avp->av_bslot = -1;
|
2007-11-27 22:06:27 +00:00
|
|
|
if ((flags & IEEE80211_CLONE_BSSID) && sc->sc_hasbmask) {
|
2007-05-31 03:41:01 +00:00
|
|
|
struct ieee80211vap *v;
|
2007-11-27 22:06:27 +00:00
|
|
|
unsigned int id_mask, id;
|
|
|
|
@@ -1301,18 +1305,22 @@
|
2007-06-01 10:29:49 +00:00
|
|
|
|
2007-05-31 03:41:01 +00:00
|
|
|
/* do a full search to mark all the allocated VAPs */
|
|
|
|
id_mask = 0;
|
|
|
|
- TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
|
|
|
|
- id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
|
|
|
|
+ TAILQ_FOREACH(v, &ic->ic_vaps, iv_next) {
|
|
|
|
+ struct ath_vap *a = (struct ath_vap *) v->iv_dev->priv;
|
|
|
|
+ if (a->av_bslot >= 0)
|
|
|
|
+ id_mask |= (1 << a->av_bslot);
|
|
|
|
+ }
|
2007-06-01 10:29:49 +00:00
|
|
|
|
2007-07-03 21:03:58 +00:00
|
|
|
- for (id = 1; id < ATH_BCBUF; id++) {
|
2007-05-31 03:41:01 +00:00
|
|
|
+ /* IBSS mode has local always set, so don't hand out beacon slot 0 to an IBSS vap */
|
|
|
|
+ for (id = (opmode == IEEE80211_M_IBSS ? 1 : 0); id < ATH_BCBUF; id++) {
|
|
|
|
/* get the first available slot */
|
|
|
|
if ((id_mask & (1 << id)) == 0) {
|
|
|
|
ATH_SET_VAP_BSSID(vap->iv_myaddr, id);
|
|
|
|
+ avp->av_bslot = id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- avp->av_bslot = -1;
|
|
|
|
STAILQ_INIT(&avp->av_mcastq.axq_q);
|
|
|
|
ATH_TXQ_LOCK_INIT(&avp->av_mcastq);
|
|
|
|
if (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS) {
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -1322,33 +1330,14 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
*/
|
|
|
|
avp->av_bcbuf = STAILQ_FIRST(&sc->sc_bbuf);
|
|
|
|
STAILQ_REMOVE_HEAD(&sc->sc_bbuf, bf_list);
|
|
|
|
- if (opmode == IEEE80211_M_HOSTAP || !sc->sc_hasveol) {
|
|
|
|
+ if ((opmode == IEEE80211_M_IBSS) || (opmode == IEEE80211_M_HOSTAP) || !sc->sc_hasveol) {
|
|
|
|
unsigned int slot;
|
|
|
|
- /*
|
|
|
|
- * Assign the VAP to a beacon xmit slot. As
|
|
|
|
- * above, this cannot fail to find one.
|
|
|
|
- */
|
|
|
|
- avp->av_bslot = 0;
|
|
|
|
- for (slot = 0; slot < ATH_BCBUF; slot++)
|
|
|
|
- if (sc->sc_bslot[slot] == NULL) {
|
|
|
|
- /*
|
|
|
|
- * XXX hack, space out slots to better
|
|
|
|
- * deal with misses
|
|
|
|
- */
|
|
|
|
- if (slot + 1 < ATH_BCBUF &&
|
|
|
|
- sc->sc_bslot[slot+1] == NULL) {
|
|
|
|
- avp->av_bslot = slot + 1;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- avp->av_bslot = slot;
|
|
|
|
- /* NB: keep looking for a double slot */
|
|
|
|
- }
|
|
|
|
KASSERT(sc->sc_bslot[avp->av_bslot] == NULL,
|
|
|
|
("beacon slot %u not empty?", avp->av_bslot));
|
|
|
|
sc->sc_bslot[avp->av_bslot] = vap;
|
|
|
|
sc->sc_nbcnvaps++;
|
|
|
|
}
|
|
|
|
- if ((opmode == IEEE80211_M_HOSTAP) && (sc->sc_hastsfadd)) {
|
|
|
|
+ if ((sc->sc_opmode == IEEE80211_M_HOSTAP) && (sc->sc_hastsfadd)) {
|
|
|
|
/*
|
|
|
|
* Multiple VAPs are to transmit beacons and we
|
|
|
|
* have h/w support for TSF adjusting; enable use
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -1460,7 +1449,9 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
sc->sc_stagbeacons = 0;
|
|
|
|
}
|
2007-06-01 10:29:49 +00:00
|
|
|
|
2007-05-31 03:41:01 +00:00
|
|
|
- if (vap->iv_opmode == IEEE80211_M_STA) {
|
|
|
|
+ if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
2007-07-03 21:03:58 +00:00
|
|
|
+ sc->sc_nibssvaps--;
|
2007-06-01 10:29:49 +00:00
|
|
|
+ } else if (vap->iv_opmode == IEEE80211_M_STA) {
|
2007-05-31 03:41:01 +00:00
|
|
|
sc->sc_nstavaps--;
|
2007-06-01 10:29:49 +00:00
|
|
|
sc->sc_nostabeacons = 0;
|
|
|
|
} else if (vap->iv_opmode == IEEE80211_M_MONITOR)
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -3816,7 +3807,7 @@
|
2007-06-04 11:25:53 +00:00
|
|
|
sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
|
|
|
|
(sc->sc_nostabeacons) || sc->sc_scanning)
|
2007-06-02 02:22:01 +00:00
|
|
|
rfilt |= HAL_RX_FILTER_BEACON;
|
|
|
|
- if (sc->sc_nmonvaps > 0)
|
|
|
|
+ if ((sc->sc_nmonvaps > 0) || ((sc->sc_nvaps > 0) && (sc->sc_nibssvaps > 0)))
|
|
|
|
rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
|
|
|
|
HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
|
|
|
|
return rfilt;
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -6284,12 +6275,20 @@
|
|
|
|
type = ieee80211_input(ni, skb, rs->rs_rssi, bf->bf_tsf);
|
2007-05-31 03:41:01 +00:00
|
|
|
ieee80211_unref_node(&ni);
|
|
|
|
} else {
|
|
|
|
+ const struct ieee80211_frame_min *wh = (const struct ieee80211_frame_min *) skb->data;
|
|
|
|
/*
|
|
|
|
* No key index or no entry, do a lookup and
|
|
|
|
* add the node to the mapping table if possible.
|
|
|
|
*/
|
2007-06-01 10:29:49 +00:00
|
|
|
- ni = ieee80211_find_rxnode(ic,
|
2007-05-31 03:41:01 +00:00
|
|
|
- (const struct ieee80211_frame_min *) skb->data);
|
2007-06-02 17:04:43 +00:00
|
|
|
+ if (((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_PROBE_REQ) &&
|
|
|
|
+ (sc->sc_nibssvaps > 0))
|
2007-05-31 03:41:01 +00:00
|
|
|
+ /* if this is a probe request, send it to all vaps
|
|
|
|
+ * when looking up nodes, hostap will be preferred over ibss,
|
|
|
|
+ * because ibss will catch all nodes */
|
|
|
|
+ ni = NULL;
|
|
|
|
+ else
|
|
|
|
+ ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
|
|
|
|
+
|
|
|
|
if (ni != NULL) {
|
|
|
|
struct ath_node *an = ATH_NODE(ni);
|
|
|
|
ieee80211_keyix_t keyix;
|
2007-11-27 22:06:27 +00:00
|
|
|
Index: madwifi-ng-r2978-20071127/ath/if_athvar.h
|
2007-06-04 11:25:53 +00:00
|
|
|
===================================================================
|
2007-11-27 22:06:27 +00:00
|
|
|
--- madwifi-ng-r2978-20071127.orig/ath/if_athvar.h 2007-11-27 21:18:08.257722921 +0100
|
|
|
|
+++ madwifi-ng-r2978-20071127/ath/if_athvar.h 2007-11-27 21:18:30.026963473 +0100
|
2007-10-24 04:35:02 +00:00
|
|
|
@@ -209,7 +209,7 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
#define ATH_RXBUF 40 /* number of RX buffers */
|
|
|
|
#define ATH_TXBUF 200 /* number of TX buffers */
|
|
|
|
|
|
|
|
-#define ATH_BCBUF 4 /* number of beacon buffers */
|
|
|
|
+#define ATH_BCBUF 8 /* number of beacon buffers */
|
|
|
|
|
|
|
|
/* free buffer threshold to restart net dev */
|
2007-06-01 10:29:49 +00:00
|
|
|
#define ATH_TXBUF_FREE_THRESHOLD (ATH_TXBUF / 20)
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -667,6 +667,7 @@
|
2007-07-03 21:03:58 +00:00
|
|
|
u_int16_t sc_nvaps; /* # of active virtual APs */
|
|
|
|
u_int8_t sc_nstavaps; /* # of active station VAPs */
|
|
|
|
u_int8_t sc_nmonvaps; /* # of monitor VAPs */
|
2007-05-31 03:41:01 +00:00
|
|
|
+ u_int8_t sc_nibssvaps; /* # of active ibss vaps */
|
|
|
|
u_int8_t sc_nbcnvaps; /* # of vaps sending beacons */
|
|
|
|
u_int sc_fftxqmin; /* aggregation threshold */
|
|
|
|
HAL_INT sc_imask; /* interrupt mask copy */
|
2007-11-27 22:06:27 +00:00
|
|
|
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_beacon.c
|
2007-06-04 11:25:53 +00:00
|
|
|
===================================================================
|
2007-11-27 22:06:27 +00:00
|
|
|
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_beacon.c 2007-11-27 21:18:08.265723374 +0100
|
|
|
|
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_beacon.c 2007-11-27 21:18:30.034963929 +0100
|
2007-05-31 03:41:01 +00:00
|
|
|
@@ -111,7 +111,7 @@
|
|
|
|
bo->bo_tim = frm;
|
|
|
|
|
|
|
|
/* IBSS/TIM */
|
|
|
|
- if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
|
|
|
+ if (ic->ic_opmode == IEEE80211_M_IBSS) {
|
|
|
|
*frm++ = IEEE80211_ELEMID_IBSSPARMS;
|
|
|
|
*frm++ = 2;
|
|
|
|
*frm++ = 0; *frm++ = 0; /* TODO: ATIM window */
|
2007-11-27 22:06:27 +00:00
|
|
|
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_input.c
|
2007-06-04 11:25:53 +00:00
|
|
|
===================================================================
|
2007-11-27 22:06:27 +00:00
|
|
|
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_input.c 2007-11-27 21:18:08.269723596 +0100
|
|
|
|
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_input.c 2007-11-27 21:18:30.038964155 +0100
|
|
|
|
@@ -3069,7 +3069,13 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ni == vap->iv_bss) {
|
|
|
|
- if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
|
|
|
+ /* this probe request may have been sent to all vaps
|
|
|
|
+ * to give each a chance of creating a node for this.
|
|
|
|
+ * important for hostap+ibss mode */
|
|
|
|
+ ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
|
|
|
|
+ if (ni) {
|
|
|
|
+ allocbs = 0;
|
|
|
|
+ } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
|
|
|
/*
|
|
|
|
* XXX Cannot tell if the sender is operating
|
|
|
|
* in ibss mode. But we need a new node to
|
2007-11-27 22:06:27 +00:00
|
|
|
@@ -3078,12 +3084,13 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
*/
|
|
|
|
ni = ieee80211_fakeup_adhoc_node(vap,
|
|
|
|
wh->i_addr2);
|
|
|
|
+ allocbs = 1;
|
|
|
|
} else {
|
|
|
|
ni = ieee80211_dup_bss(vap, wh->i_addr2, 1);
|
|
|
|
+ allocbs = 1;
|
|
|
|
}
|
|
|
|
if (ni == NULL)
|
|
|
|
return;
|
|
|
|
- allocbs = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2,
|
2007-11-27 22:06:27 +00:00
|
|
|
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_node.c
|
2007-06-04 11:25:53 +00:00
|
|
|
===================================================================
|
2007-11-27 22:06:27 +00:00
|
|
|
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_node.c 2007-11-27 21:18:08.281724279 +0100
|
|
|
|
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_node.c 2007-11-27 21:24:30.083481925 +0100
|
|
|
|
@@ -1326,13 +1326,26 @@
|
2007-05-31 03:41:01 +00:00
|
|
|
IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
|
|
|
|
|
|
|
|
hash = IEEE80211_NODE_HASH(macaddr);
|
2007-07-03 21:03:58 +00:00
|
|
|
+
|
2007-05-31 03:41:01 +00:00
|
|
|
+ /* look for non-ibss nodes first */
|
2007-11-27 22:06:27 +00:00
|
|
|
LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
|
|
|
|
- if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
|
2007-05-31 03:41:01 +00:00
|
|
|
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode != IEEE80211_M_IBSS) {
|
2007-11-27 22:06:27 +00:00
|
|
|
#ifdef IEEE80211_DEBUG_REFCNT
|
|
|
|
ieee80211_ref_node_debug(ni, func, line);
|
|
|
|
#else
|
|
|
|
ieee80211_ref_node(ni);
|
|
|
|
-#endif
|
2007-05-31 03:41:01 +00:00
|
|
|
+#endif
|
|
|
|
+ return ni;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2007-11-27 22:06:27 +00:00
|
|
|
+ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
|
2007-05-31 03:41:01 +00:00
|
|
|
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode == IEEE80211_M_IBSS) {
|
2007-11-27 22:06:27 +00:00
|
|
|
+#ifdef IEEE80211_DEBUG_REFCNT
|
|
|
|
+ ieee80211_ref_node_debug(ni, func, line);
|
|
|
|
+#else
|
|
|
|
+ ieee80211_ref_node(ni);
|
|
|
|
+#endif
|
|
|
|
return ni;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1345,7 +1358,7 @@
|
|
|
|
return ieee80211_ref_node_debug(wds->wds_ni, func, line);
|
|
|
|
#else
|
|
|
|
return ieee80211_ref_node(wds->wds_ni);
|
|
|
|
-#endif
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|