diff options
| -rw-r--r-- | meta/packages/linux/linux-rp-2.6.20/hostap-monitor-mode.patch | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/meta/packages/linux/linux-rp-2.6.20/hostap-monitor-mode.patch b/meta/packages/linux/linux-rp-2.6.20/hostap-monitor-mode.patch new file mode 100644 index 0000000000..641fd19e50 --- /dev/null +++ b/meta/packages/linux/linux-rp-2.6.20/hostap-monitor-mode.patch | |||
| @@ -0,0 +1,209 @@ | |||
| 1 | This is a patch that I've been maintaining for a few years, and I'd | ||
| 2 | really like to see it added to the mainstream zaurus kernel so I can | ||
| 3 | finally stop distributing my own. | ||
| 4 | |||
| 5 | This patch only effects the card while in monitor mode, and does not | ||
| 6 | cause any known stability issues. | ||
| 7 | |||
| 8 | http://patches.aircrack-ng.org/hostap-kernel-2.6.18.patch | ||
| 9 | |||
| 10 | Rick Farina (Zero_Chaos) | ||
| 11 | |||
| 12 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_80211_tx.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_80211_tx.c | ||
| 13 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_80211_tx.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 14 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_80211_tx.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 15 | @@ -69,6 +69,9 @@ | ||
| 16 | iface = netdev_priv(dev); | ||
| 17 | local = iface->local; | ||
| 18 | |||
| 19 | + if (local->iw_mode == IW_MODE_MONITOR) | ||
| 20 | + goto xmit; | ||
| 21 | + | ||
| 22 | if (skb->len < ETH_HLEN) { | ||
| 23 | printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb " | ||
| 24 | "(len=%d)\n", dev->name, skb->len); | ||
| 25 | @@ -234,6 +237,7 @@ | ||
| 26 | memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN); | ||
| 27 | } | ||
| 28 | |||
| 29 | +xmit: | ||
| 30 | iface->stats.tx_packets++; | ||
| 31 | iface->stats.tx_bytes += skb->len; | ||
| 32 | |||
| 33 | @@ -404,8 +408,6 @@ | ||
| 34 | } | ||
| 35 | |||
| 36 | if (skb->len < 24) { | ||
| 37 | - printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb " | ||
| 38 | - "(len=%d)\n", dev->name, skb->len); | ||
| 39 | ret = 0; | ||
| 40 | iface->stats.tx_dropped++; | ||
| 41 | goto fail; | ||
| 42 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_cs.c.orig | ||
| 43 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_cs.c.rej | ||
| 44 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_hw.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_hw.c | ||
| 45 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_hw.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 46 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_hw.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 47 | @@ -1005,6 +1005,35 @@ | ||
| 48 | return fid; | ||
| 49 | } | ||
| 50 | |||
| 51 | +static int prism2_monitor_enable(struct net_device *dev) | ||
| 52 | +{ | ||
| 53 | + if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) { | ||
| 54 | + printk(KERN_DEBUG "Port type setting for monitor mode " | ||
| 55 | + "failed\n"); | ||
| 56 | + return -EOPNOTSUPP; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8), | ||
| 60 | + 0, NULL, NULL)) { | ||
| 61 | + printk(KERN_DEBUG "Could not enter testmode 0x0a\n"); | ||
| 62 | + return -EOPNOTSUPP; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS, | ||
| 66 | + HFA384X_WEPFLAGS_PRIVACYINVOKED | | ||
| 67 | + HFA384X_WEPFLAGS_HOSTENCRYPT | | ||
| 68 | + HFA384X_WEPFLAGS_HOSTDECRYPT)) { | ||
| 69 | + printk(KERN_DEBUG "WEP flags setting failed\n"); | ||
| 70 | + return -EOPNOTSUPP; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) { | ||
| 74 | + printk(KERN_DEBUG "Could not set promiscuous mode\n"); | ||
| 75 | + return -EOPNOTSUPP; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + return 0; | ||
| 79 | +} | ||
| 80 | |||
| 81 | static int prism2_reset_port(struct net_device *dev) | ||
| 82 | { | ||
| 83 | @@ -1031,6 +1060,10 @@ | ||
| 84 | "port\n", dev->name); | ||
| 85 | } | ||
| 86 | |||
| 87 | + if (local->iw_mode == IW_MODE_MONITOR) | ||
| 88 | + /* force mode 0x0a after port 0 reset */ | ||
| 89 | + return prism2_monitor_enable(dev); | ||
| 90 | + | ||
| 91 | /* It looks like at least some STA firmware versions reset | ||
| 92 | * fragmentation threshold back to 2346 after enable command. Restore | ||
| 93 | * the configured value, if it differs from this default. */ | ||
| 94 | @@ -1466,6 +1499,10 @@ | ||
| 95 | return 1; | ||
| 96 | } | ||
| 97 | |||
| 98 | + if (local->iw_mode == IW_MODE_MONITOR) | ||
| 99 | + /* force mode 0x0a after port 0 reset */ | ||
| 100 | + prism2_monitor_enable(dev); | ||
| 101 | + | ||
| 102 | local->hw_ready = 1; | ||
| 103 | local->hw_reset_tries = 0; | ||
| 104 | local->hw_resetting = 0; | ||
| 105 | @@ -3156,6 +3193,7 @@ | ||
| 106 | local->func->hw_config = prism2_hw_config; | ||
| 107 | local->func->hw_reset = prism2_hw_reset; | ||
| 108 | local->func->hw_shutdown = prism2_hw_shutdown; | ||
| 109 | + local->func->monitor_enable = prism2_monitor_enable; | ||
| 110 | local->func->reset_port = prism2_reset_port; | ||
| 111 | local->func->schedule_reset = prism2_schedule_reset; | ||
| 112 | #ifdef PRISM2_DOWNLOAD_SUPPORT | ||
| 113 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_hw.c.orig | ||
| 114 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_ioctl.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_ioctl.c | ||
| 115 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_ioctl.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 116 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_ioctl.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 117 | @@ -1104,33 +1104,7 @@ | ||
| 118 | |||
| 119 | printk(KERN_DEBUG "Enabling monitor mode\n"); | ||
| 120 | hostap_monitor_set_type(local); | ||
| 121 | - | ||
| 122 | - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, | ||
| 123 | - HFA384X_PORTTYPE_PSEUDO_IBSS)) { | ||
| 124 | - printk(KERN_DEBUG "Port type setting for monitor mode " | ||
| 125 | - "failed\n"); | ||
| 126 | - return -EOPNOTSUPP; | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - /* Host decrypt is needed to get the IV and ICV fields; | ||
| 130 | - * however, monitor mode seems to remove WEP flag from frame | ||
| 131 | - * control field */ | ||
| 132 | - if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS, | ||
| 133 | - HFA384X_WEPFLAGS_HOSTENCRYPT | | ||
| 134 | - HFA384X_WEPFLAGS_HOSTDECRYPT)) { | ||
| 135 | - printk(KERN_DEBUG "WEP flags setting failed\n"); | ||
| 136 | - return -EOPNOTSUPP; | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - if (local->func->reset_port(dev) || | ||
| 140 | - local->func->cmd(dev, HFA384X_CMDCODE_TEST | | ||
| 141 | - (HFA384X_TEST_MONITOR << 8), | ||
| 142 | - 0, NULL, NULL)) { | ||
| 143 | - printk(KERN_DEBUG "Setting monitor mode failed\n"); | ||
| 144 | - return -EOPNOTSUPP; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - return 0; | ||
| 148 | + return local->func->reset_port(dev); | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | @@ -1199,7 +1173,7 @@ | ||
| 153 | local->iw_mode = *mode; | ||
| 154 | |||
| 155 | if (local->iw_mode == IW_MODE_MONITOR) | ||
| 156 | - hostap_monitor_mode_enable(local); | ||
| 157 | + return hostap_monitor_mode_enable(local); | ||
| 158 | else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt && | ||
| 159 | !local->fw_encrypt_ok) { | ||
| 160 | printk(KERN_DEBUG "%s: defaulting to host-based encryption as " | ||
| 161 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_main.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_main.c | ||
| 162 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_main.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 163 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_main.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 164 | @@ -331,7 +331,7 @@ | ||
| 165 | if (local->iw_mode == IW_MODE_REPEAT) | ||
| 166 | return HFA384X_PORTTYPE_WDS; | ||
| 167 | if (local->iw_mode == IW_MODE_MONITOR) | ||
| 168 | - return HFA384X_PORTTYPE_PSEUDO_IBSS; | ||
| 169 | + return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/ | ||
| 170 | return HFA384X_PORTTYPE_HOSTAP; | ||
| 171 | } | ||
| 172 | |||
| 173 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_main.c.orig | ||
| 174 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_pci.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_pci.c | ||
| 175 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_pci.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 176 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_pci.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 177 | @@ -48,6 +48,8 @@ | ||
| 178 | { 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID }, | ||
| 179 | /* Samsung MagicLAN SWL-2210P */ | ||
| 180 | { 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID }, | ||
| 181 | + /* NETGEAR MA311 */ | ||
| 182 | + { 0x1385, 0x3872, PCI_ANY_ID, PCI_ANY_ID }, | ||
| 183 | { 0 } | ||
| 184 | }; | ||
| 185 | |||
| 186 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_pci.c.orig | ||
| 187 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_plx.c linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_plx.c | ||
| 188 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_plx.c 2006-09-21 01:26:27.000000000 -0400 | ||
| 189 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_plx.c 2006-09-21 01:30:18.000000000 -0400 | ||
| 190 | @@ -101,6 +101,7 @@ | ||
| 191 | { 0xc250, 0x0002 } /* EMTAC A2424i */, | ||
| 192 | { 0xd601, 0x0002 } /* Z-Com XI300 */, | ||
| 193 | { 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */, | ||
| 194 | + { 0xd601, 0x0010 } /* Zcomax XI-325H 100mW */, | ||
| 195 | { 0, 0} | ||
| 196 | }; | ||
| 197 | |||
| 198 | Only in linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap: hostap_plx.c.orig | ||
| 199 | diff -ur linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_wlan.h linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_wlan.h | ||
| 200 | --- linux-2.6.18-gentoo/drivers/net/wireless/hostap/hostap_wlan.h 2006-09-21 01:26:27.000000000 -0400 | ||
| 201 | +++ linux-2.6.18-gentoo-rawtx/drivers/net/wireless/hostap/hostap_wlan.h 2006-09-21 01:30:18.000000000 -0400 | ||
| 202 | @@ -575,6 +575,7 @@ | ||
| 203 | int (*hw_config)(struct net_device *dev, int initial); | ||
| 204 | void (*hw_reset)(struct net_device *dev); | ||
| 205 | void (*hw_shutdown)(struct net_device *dev, int no_disable); | ||
| 206 | + int (*monitor_enable)(struct net_device *dev); | ||
| 207 | int (*reset_port)(struct net_device *dev); | ||
| 208 | void (*schedule_reset)(local_info_t *local); | ||
| 209 | int (*download)(local_info_t *local, | ||
