-diff -ur madwifi.old/ath/if_ath.c madwifi.dev/ath/if_ath.c
---- madwifi.old/ath/if_ath.c 2007-06-01 12:22:06.641518272 +0200
-+++ madwifi.dev/ath/if_ath.c 2007-06-01 12:22:55.326117088 +0200
-@@ -407,7 +407,6 @@
+Index: madwifi-ng-r2756-20071018/ath/if_ath.c
+===================================================================
+--- madwifi-ng-r2756-20071018.orig/ath/if_ath.c 2007-10-24 06:20:18.881765287 +0200
++++ madwifi-ng-r2756-20071018/ath/if_ath.c 2007-10-24 06:20:19.097777599 +0200
+@@ -409,7 +409,6 @@
* and use the next two bits as the index of the VAP.
*/
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
#define ATH_SET_VAP_BSSID(bssid, id) \
do { \
if (id) \
-@@ -1048,9 +1048,12 @@
+@@ -1059,9 +1058,12 @@
ic_opmode = opmode;
break;
case IEEE80211_M_IBSS:
break;
case IEEE80211_M_AHDEMO:
case IEEE80211_M_MONITOR:
-@@ -1080,7 +1083,7 @@
+@@ -1091,7 +1093,7 @@
return NULL;
}
- if (sc->sc_nvaps >= ATH_BCBUF) {
+ if (sc->sc_nvaps + sc->sc_nibssvaps >= ATH_BCBUF) {
- printk(KERN_WARNING "too many virtual ap's (already got %d)\n", sc->sc_nvaps);
+ printk(KERN_WARNING "too many virtual APs (already got %d)\n", sc->sc_nvaps);
return NULL;
}
-@@ -1115,8 +1118,9 @@
- */
+@@ -1127,6 +1129,7 @@
if (opmode == IEEE80211_M_MONITOR)
dev->type = ARPHRD_IEEE80211_RADIOTAP;
-- if ((flags & IEEE80211_CLONE_BSSID) &&
-- sc->sc_nvaps != 0 && opmode != IEEE80211_M_WDS && sc->sc_hasbmask) {
+
+ avp->av_bslot = -1;
-+ if ((flags & IEEE80211_CLONE_BSSID) && sc->sc_hasbmask &&
-+ (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS)) {
+ if ((flags & IEEE80211_CLONE_BSSID) &&
+ opmode != IEEE80211_M_WDS && sc->sc_hasbmask) {
struct ieee80211vap *v;
- unsigned int id_mask, id;
-
-@@ -1129,18 +1133,22 @@
+@@ -1141,18 +1144,22 @@
/* do a full search to mark all the allocated VAPs */
id_mask = 0;
+ id_mask |= (1 << a->av_bslot);
+ }
-- for (id = 0; id < ATH_BCBUF; id++) {
+- for (id = 1; id < ATH_BCBUF; id++) {
+ /* 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 */
STAILQ_INIT(&avp->av_mcastq.axq_q);
ATH_TXQ_LOCK_INIT(&avp->av_mcastq);
if (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS) {
-@@ -1150,33 +1158,14 @@
+@@ -1162,33 +1169,14 @@
*/
avp->av_bcbuf = STAILQ_FIRST(&sc->sc_bbuf);
STAILQ_REMOVE_HEAD(&sc->sc_bbuf, bf_list);
/*
* Multiple VAPs are to transmit beacons and we
* have h/w support for TSF adjusting; enable use
-@@ -1286,7 +1275,9 @@
+@@ -1298,7 +1286,9 @@
sc->sc_stagbeacons = 0;
}
- if (vap->iv_opmode == IEEE80211_M_STA) {
+ if (vap->iv_opmode == IEEE80211_M_IBSS) {
-+ sc->sc_nibssvaps--;
++ sc->sc_nibssvaps--;
+ } else if (vap->iv_opmode == IEEE80211_M_STA) {
sc->sc_nstavaps--;
sc->sc_nostabeacons = 0;
} else if (vap->iv_opmode == IEEE80211_M_MONITOR)
-@@ -3368,7 +3367,7 @@
- ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
- (ic->ic_protmode != IEEE80211_PROT_NONE)))
+@@ -3517,7 +3507,7 @@
+ sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
+ (sc->sc_nostabeacons) || sc->sc_scanning)
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;
-@@ -5809,12 +5801,20 @@
- type = ieee80211_input(ni, skb, rs->rs_rssi, rs->rs_tstamp);
+@@ -5953,12 +5943,20 @@
+ type = ieee80211_input(ni, skb, rs->rs_rssi, rs_tsf);
ieee80211_unref_node(&ni);
} else {
+ const struct ieee80211_frame_min *wh = (const struct ieee80211_frame_min *) skb->data;
if (ni != NULL) {
struct ath_node *an = ATH_NODE(ni);
ieee80211_keyix_t keyix;
-diff -ur madwifi.old/ath/if_athvar.h madwifi.dev/ath/if_athvar.h
---- madwifi.old/ath/if_athvar.h 2007-06-01 12:22:06.642518120 +0200
-+++ madwifi.dev/ath/if_athvar.h 2007-06-01 12:21:54.640342728 +0200
-@@ -199,7 +199,7 @@
+Index: madwifi-ng-r2756-20071018/ath/if_athvar.h
+===================================================================
+--- madwifi-ng-r2756-20071018.orig/ath/if_athvar.h 2007-10-24 06:20:16.501629651 +0200
++++ madwifi-ng-r2756-20071018/ath/if_athvar.h 2007-10-24 06:20:19.101777824 +0200
+@@ -209,7 +209,7 @@
#define ATH_RXBUF 40 /* number of RX buffers */
#define ATH_TXBUF 200 /* number of TX buffers */
/* free buffer threshold to restart net dev */
#define ATH_TXBUF_FREE_THRESHOLD (ATH_TXBUF / 20)
-@@ -594,6 +594,7 @@
- u_int16_t sc_nvaps; /* # of active virtual ap's */
- u_int8_t sc_nstavaps; /* # of active station vaps */
- u_int8_t sc_nmonvaps; /* # of monitor vaps */
+@@ -610,6 +610,7 @@
+ 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 */
+ 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 */
-diff -ur madwifi.old/net80211/ieee80211_beacon.c madwifi.dev/net80211/ieee80211_beacon.c
---- madwifi.old/net80211/ieee80211_beacon.c 2007-06-01 12:22:06.642518120 +0200
-+++ madwifi.dev/net80211/ieee80211_beacon.c 2007-06-01 12:21:54.640342728 +0200
+Index: madwifi-ng-r2756-20071018/net80211/ieee80211_beacon.c
+===================================================================
+--- madwifi-ng-r2756-20071018.orig/net80211/ieee80211_beacon.c 2007-10-24 06:20:16.505629880 +0200
++++ madwifi-ng-r2756-20071018/net80211/ieee80211_beacon.c 2007-10-24 06:20:19.109778282 +0200
@@ -111,7 +111,7 @@
bo->bo_tim = frm;
*frm++ = IEEE80211_ELEMID_IBSSPARMS;
*frm++ = 2;
*frm++ = 0; *frm++ = 0; /* TODO: ATIM window */
-diff -ur madwifi.old/net80211/ieee80211_input.c madwifi.dev/net80211/ieee80211_input.c
---- madwifi.old/net80211/ieee80211_input.c 2007-06-01 12:22:06.645517664 +0200
-+++ madwifi.dev/net80211/ieee80211_input.c 2007-06-01 12:21:54.642342424 +0200
-@@ -2953,7 +2953,13 @@
+Index: madwifi-ng-r2756-20071018/net80211/ieee80211_input.c
+===================================================================
+--- madwifi-ng-r2756-20071018.orig/net80211/ieee80211_input.c 2007-10-24 06:20:16.513630337 +0200
++++ madwifi-ng-r2756-20071018/net80211/ieee80211_input.c 2007-10-24 06:20:19.113778513 +0200
+@@ -2990,7 +2990,13 @@
return;
}
if (ni == vap->iv_bss) {
/*
* XXX Cannot tell if the sender is operating
* in ibss mode. But we need a new node to
-@@ -2962,12 +2968,13 @@
+@@ -2999,12 +3005,13 @@
*/
ni = ieee80211_fakeup_adhoc_node(vap,
wh->i_addr2);
}
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2,
-diff -ur madwifi.old/net80211/ieee80211_node.c madwifi.dev/net80211/ieee80211_node.c
---- madwifi.old/net80211/ieee80211_node.c 2007-06-01 12:22:06.646517512 +0200
-+++ madwifi.dev/net80211/ieee80211_node.c 2007-06-01 12:21:54.644342120 +0200
-@@ -1082,8 +1082,25 @@
+Index: madwifi-ng-r2756-20071018/net80211/ieee80211_node.c
+===================================================================
+--- madwifi-ng-r2756-20071018.orig/net80211/ieee80211_node.c 2007-10-24 06:20:18.437739986 +0200
++++ madwifi-ng-r2756-20071018/net80211/ieee80211_node.c 2007-10-24 06:20:19.113778513 +0200
+@@ -1084,8 +1084,25 @@
IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
hash = IEEE80211_NODE_HASH(macaddr);
-+
++
+ /* look for non-ibss nodes first */
- LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
-- if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
++ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode != IEEE80211_M_IBSS) {
+ ieee80211_ref_node(ni); /* mark referenced */
+#ifdef IEEE80211_DEBUG_REFCNT
+ }
+
+ /* now look for ibss nodes */
-+ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
+ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
+- if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode == IEEE80211_M_IBSS) {
ieee80211_ref_node(ni); /* mark referenced */
#ifdef IEEE80211_DEBUG_REFCNT