| 1 |
diff -Nurb madwifi-ng-r1457/ath/if_ath.c patched_madwifi-ng-r1457/ath/if_ath.c |
| 2 |
--- madwifi-ng-r1457/ath/if_ath.c 2006-02-25 00:24:30.000000000 +0100 |
| 3 |
+++ patched_madwifi-ng-r1457/ath/if_ath.c 2006-03-01 23:23:32.000000000 +0100 |
| 4 |
@@ -2166,6 +2166,7 @@ |
| 5 |
struct ath_softc *sc = dev->priv; |
| 6 |
struct ath_hal *ah = sc->sc_ah; |
| 7 |
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb)); |
| 8 |
+ struct ieee80211com *ic = &sc->sc_ic; |
| 9 |
const HAL_RATE_TABLE *rt; |
| 10 |
int pktlen; |
| 11 |
int hdrlen; |
| 12 |
@@ -2180,9 +2181,12 @@ |
| 13 |
struct ieee80211_frame *wh; |
| 14 |
|
| 15 |
wh = (struct ieee80211_frame *) skb->data; |
| 16 |
- try0 = ATH_TXMAXTRY; |
| 17 |
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY; |
| 18 |
+ /* |
| 19 |
+ * The retry value has to be patched to 1 when injecting, |
| 20 |
+ * otherwise the card waits for acknowledges... |
| 21 |
+ */ |
| 22 |
rt = sc->sc_currates; |
| 23 |
- txrate = dot11_to_ratecode(sc, rt, ph->rate0); |
| 24 |
+ txrate = dot11_to_ratecode(sc, rt, (ic->ic_opmode == IEEE80211_M_MONITOR) ? (ic->inject_rate / 500) : ph->rate0); |
| 25 |
power = ph->power > 60 ? 60 : ph->power; |
| 26 |
hdrlen = ieee80211_anyhdrsize(wh); |
| 27 |
pktlen = skb->len + IEEE80211_CRC_LEN; |
| 28 |
diff -Nurb madwifi-ng-r1457/net80211/ieee80211_var.h patched_madwifi-ng-r1457/net80211/ieee80211_var.h |
| 29 |
--- madwifi-ng-r1457/net80211/ieee80211_var.h 2006-02-06 20:58:08.000000000 +0100 |
| 30 |
+++ patched_madwifi-ng-r1457/net80211/ieee80211_var.h 2006-03-01 23:24:38.000000000 +0100 |
| 31 |
@@ -138,6 +138,7 @@ |
| 32 |
u_int16_t ic_txpowlimit; /* global tx power limit */ |
| 33 |
u_int16_t ic_uapsdmaxtriggers; /* max triggers that could arrive */ |
| 34 |
u_int8_t ic_coverageclass; /* coverage class */ |
| 35 |
+ int inject_rate; /* injection rate in Monitor mode */ |
| 36 |
|
| 37 |
/* |
| 38 |
* Channel state: |
| 39 |
diff -Nurb madwifi-ng-r1457/net80211/ieee80211_wireless.c patched_madwifi-ng-r1457/net80211/ieee80211_wireless.c |
| 40 |
--- madwifi-ng-r1457/net80211/ieee80211_wireless.c 2006-02-19 18:35:54.000000000 +0100 |
| 41 |
+++ patched_madwifi-ng-r1457/net80211/ieee80211_wireless.c 2006-03-01 23:30:34.000000000 +0100 |
| 42 |
@@ -346,6 +346,18 @@ |
| 43 |
struct ifmediareq imr; |
| 44 |
int rate, retv; |
| 45 |
|
| 46 |
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) { |
| 47 |
+ rate = rrq->value / 1000; |
| 48 |
+ if (rate != 1000 && rate != 2000 && rate != 5500 && |
| 49 |
+ rate != 11000 && rate != 6000 && rate != 9000 && |
| 50 |
+ rate != 12000 && rate != 18000 && rate != 24000 && |
| 51 |
+ rate != 36000 && rate != 48000 && rate != 54000 ) |
| 52 |
+ return -EINVAL; |
| 53 |
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate); |
| 54 |
+ ic->inject_rate = rate; |
| 55 |
+ return 0; |
| 56 |
+ } |
| 57 |
+ |
| 58 |
if (vap->iv_media.ifm_cur == NULL) |
| 59 |
return -EINVAL; |
| 60 |
memset(&ifr, 0, sizeof(ifr)); |
| 61 |
@@ -379,9 +391,15 @@ |
| 62 |
struct iw_param *rrq, char *extra) |
| 63 |
{ |
| 64 |
struct ieee80211vap *vap = dev->priv; |
| 65 |
+ struct ieee80211com *ic = vap->iv_ic; |
| 66 |
struct ifmediareq imr; |
| 67 |
int rate; |
| 68 |
|
| 69 |
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) { |
| 70 |
+ rrq->value = ic->inject_rate * 1000; |
| 71 |
+ return 0; |
| 72 |
+ } |
| 73 |
+ |
| 74 |
memset(&imr, 0, sizeof(imr)); |
| 75 |
vap->iv_media.ifm_status(vap->iv_dev, &imr); |
| 76 |
|
| 77 |
@@ -1051,6 +1069,7 @@ |
| 78 |
__u32 *mode, char *extra) |
| 79 |
{ |
| 80 |
struct ieee80211vap *vap = dev->priv; |
| 81 |
+ struct ieee80211com *ic = vap->iv_ic; |
| 82 |
struct ifmediareq imr; |
| 83 |
int valid = 0; |
| 84 |
|
| 85 |
@@ -1060,8 +1079,10 @@ |
| 86 |
if (imr.ifm_active & IFM_IEEE80211_HOSTAP) |
| 87 |
valid = (*mode == IW_MODE_MASTER); |
| 88 |
#if WIRELESS_EXT >= 15 |
| 89 |
- else if (imr.ifm_active & IFM_IEEE80211_MONITOR) |
| 90 |
+ else if (imr.ifm_active & IFM_IEEE80211_MONITOR) { |
| 91 |
valid = (*mode == IW_MODE_MONITOR); |
| 92 |
+ ic->inject_rate = 5500; /* default = 5.5M CCK */ |
| 93 |
+ } |
| 94 |
#endif |
| 95 |
else if (imr.ifm_active & IFM_IEEE80211_ADHOC) |
| 96 |
valid = (*mode == IW_MODE_ADHOC); |