1diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/base.c linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c 2--- linux-2.6.28/drivers/net/wireless/ath5k/base.c 2008-12-24 18:26:37.000000000 -0500 3+++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c 2009-02-06 21:38:43.000000000 -0500 4@@ -272,7 +272,7 @@ 5 static void ath5k_detach(struct pci_dev *pdev, 6 struct ieee80211_hw *hw); 7 /* Channel/mode setup */ 8-static inline short ath5k_ieee2mhz(short chan); 9+static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq); 10 static unsigned int ath5k_copy_channels(struct ath5k_hw *ah, 11 struct ieee80211_channel *channels, 12 unsigned int mode, 13@@ -848,12 +848,16 @@ 14 * Convert IEEE channel number to MHz frequency. 15 */ 16 static inline short 17-ath5k_ieee2mhz(short chan) 18+ath5k_ieee2mhz(int chan, unsigned int chfreq) 19 { 20- if (chan <= 14 || chan >= 27) 21- return ieee80211chan2mhz(chan); 22+ if (chfreq == CHANNEL_5GHZ) 23+ return (chan + 1000) * 5; 24 else 25- return 2212 + chan * 20; 26+// XXX: This part needs to be fixed 27+ if (chan <= 14 || chan >= 27) 28+ return ieee80211chan2mhz(chan); 29+ else 30+ return 2212 + chan * 20; 31 } 32 33 static unsigned int 34@@ -862,22 +866,25 @@ 35 unsigned int mode, 36 unsigned int max) 37 { 38- unsigned int i, count, size, chfreq, freq, ch; 39+ unsigned int i, count, size, chfreq, freq; 40+ int ch; 41 42 if (!test_bit(mode, ah->ah_modes)) 43 return 0; 44 45 switch (mode) { 46+ /* I don't even like channel numbers */ 47 case AR5K_MODE_11A: 48 case AR5K_MODE_11A_TURBO: 49- /* 1..220, but 2GHz frequencies are filtered by check_channel */ 50- size = 220 ; 51+ size = 241 ; // going over 6.0GHz may be dangerous so I am limiting it 52+ ch = -40; // might be able to push this to -201 or so, needs more testing 53 chfreq = CHANNEL_5GHZ; 54 break; 55 case AR5K_MODE_11B: 56 case AR5K_MODE_11G: 57 case AR5K_MODE_11G_TURBO: 58- size = 26; 59+ size = 70; 60+ ch = -43; 61 chfreq = CHANNEL_2GHZ; 62 break; 63 default: 64@@ -885,9 +892,8 @@ 65 return 0; 66 } 67 68- for (i = 0, count = 0; i < size && max > 0; i++) { 69- ch = i + 1 ; 70- freq = ath5k_ieee2mhz(ch); 71+ for (i = 0, count = 0; i < size && max > 0; i++,ch++) { 72+ freq = ath5k_ieee2mhz(ch,chfreq); 73 74 /* Check if channel is supported by the chipset */ 75 if (!ath5k_channel_ok(ah, freq, chfreq)) 76diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/base.h linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.h 77--- linux-2.6.28/drivers/net/wireless/ath5k/base.h 2008-12-24 18:26:37.000000000 -0500 78+++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.h 2009-02-06 21:38:43.000000000 -0500 79@@ -93,11 +93,7 @@ 80 }; 81 82 83-#if CHAN_DEBUG 84-#define ATH_CHAN_MAX (26+26+26+200+200) 85-#else 86-#define ATH_CHAN_MAX (14+14+14+252+20) 87-#endif 88+#define ATH_CHAN_MAX (70+70+70+240+240) // b+g+gT+a+aT XXX: This is probably excessive 89 90 /* Software Carrier, keeps track of the driver state 91 * associated with an instance of a device */ 92diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/caps.c linux-2.6.28-chaos/drivers/net/wireless/ath5k/caps.c 93--- linux-2.6.28/drivers/net/wireless/ath5k/caps.c 2008-12-24 18:26:37.000000000 -0500 94+++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/caps.c 2009-02-06 21:38:43.000000000 -0500 95@@ -69,9 +69,9 @@ 96 97 if (AR5K_EEPROM_HDR_11A(ee_header)) { 98 /* 4920 */ 99- ah->ah_capabilities.cap_range.range_5ghz_min = 5005; 100- ah->ah_capabilities.cap_range.range_5ghz_max = 6100; 101- 102+ ah->ah_capabilities.cap_range.range_5ghz_min = 4800; 103+ ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what the code said but */ 104+ /* it fried my Ubiquiti SRC */ 105 /* Set supported modes */ 106 __set_bit(AR5K_MODE_11A, 107 ah->ah_capabilities.cap_mode); 108@@ -87,7 +87,7 @@ 109 if (AR5K_EEPROM_HDR_11B(ee_header) || 110 AR5K_EEPROM_HDR_11G(ee_header)) { 111 /* 2312 */ 112- ah->ah_capabilities.cap_range.range_2ghz_min = 2412; 113+ ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* this is the bottom of the registers */ 114 ah->ah_capabilities.cap_range.range_2ghz_max = 2732; 115 116 if (AR5K_EEPROM_HDR_11B(ee_header)) 117diff -Naur linux-2.6.28/net/mac80211/tx.c linux-2.6.28-chaos/net/mac80211/tx.c 118--- linux-2.6.28/net/mac80211/tx.c 2008-12-24 18:26:37.000000000 -0500 119+++ linux-2.6.28-chaos/net/mac80211/tx.c 2009-02-06 21:38:53.000000000 -0500 120@@ -1378,10 +1378,32 @@ 121 struct net_device *dev) 122 { 123 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 124+ struct ieee80211_channel *chan = local->hw.conf.channel; 125 struct ieee80211_radiotap_header *prthdr = 126 (struct ieee80211_radiotap_header *)skb->data; 127 u16 len_rthdr; 128 129+ /* 130+ * Frame injection is not allowed if beaconing is not allowed 131+ * or if we need radar detection. Beaconing is usually not allowed when 132+ * the mode or operation (Adhoc, AP, Mesh) does not support DFS. 133+ * Passive scan is also used in world regulatory domains where 134+ * your country is not known and as such it should be treated as 135+ * NO TX unless the channel is explicitly allowed in which case 136+ * your current regulatory domain would not have the passive scan 137+ * flag. 138+ * 139+ * Since AP mode uses monitor interfaces to inject/TX management 140+ * frames we can make AP mode the exception to this rule once it 141+ * supports radar detection as its implementation can deal with 142+ * radar detection by itself. We can do that later by adding a 143+ * monitor flag interfaces used for AP support. 144+ */ 145+ if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR | 146+ IEEE80211_CHAN_PASSIVE_SCAN))) 147+ return TX_DROP; 148+ /* This was intended for the kernel patch but it didn't work; goto fail; */ 149+ 150 /* check for not even having the fixed radiotap header part */ 151 if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) 152 goto fail; /* too short to be possibly valid */ 153