Debian Codegraph @

patches/old/wlanng-0.2.1-pre26.patch

raw
1 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/p80211/p80211netdev.c linux-wlan-ng-0.2.1-pre26/src/p80211/p80211netdev.c
2 --- linux-wlan-ng-0.2.1-pre26-orig/src/p80211/p80211netdev.c 2005-01-11 18:43:54.000000000 +0100
3 +++ linux-wlan-ng-0.2.1-pre26/src/p80211/p80211netdev.c 2005-03-14 13:58:11.000000000 +0100
4 @@ -525,7 +525,7 @@
5 * and return success .
6 * TODO: we need a saner way to handle this
7 */
8 - if(skb->protocol != ETH_P_80211_RAW) {
9 + if(skb->protocol != htons(ETH_P_80211_RAW)) {
10 p80211netdev_start_queue(wlandev);
11 WLAN_LOG_NOTICE(
12 "Tx attempt prior to association, frame dropped.\n");
13 @@ -537,7 +537,7 @@
14 }
15
16 /* Check for raw transmits */
17 - if(skb->protocol == ETH_P_80211_RAW) {
18 + if(skb->protocol == htons(ETH_P_80211_RAW)) {
19 if (!capable(CAP_NET_ADMIN)) {
20 return(-EPERM);
21 }
22 @@ -965,8 +965,9 @@
23 dev->set_mac_address = p80211knetdev_set_mac_address;
24 #endif
25 #ifdef HAVE_TX_TIMEOUT
26 - dev->tx_timeout = &p80211knetdev_tx_timeout;
27 - dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
28 +// KoreK: still not implemented
29 +// dev->tx_timeout = &p80211knetdev_tx_timeout;
30 +// dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
31 #endif
32
33 }
34 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/Makefile linux-wlan-ng-0.2.1-pre26/src/prism2/driver/Makefile
35 --- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/Makefile 2005-01-25 02:41:44.000000000 +0100
36 +++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/Makefile 2005-03-14 13:58:11.000000000 +0100
37 @@ -88,7 +88,7 @@
38 MODVERDIR=$(WLAN_SRC)/.tmp_versions modules
39 else # kbuild 2.4
40
41 - $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(PWD) WLAN_SRC=$(PWD) \
42 + $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(PWD) WLAN_SRC=$(WLAN_SRC) \
43 modules
44
45 endif # kbuild switch
46 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x.c
47 --- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x.c 2005-01-25 01:38:50.000000000 +0100
48 +++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x.c 2005-03-14 15:21:02.000000000 +0100
49 @@ -1941,8 +1941,14 @@
50
51 DBFENTER;
52
53 - cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
54 - HFA384x_CMD_AINFO_SET(enable);
55 + if (enable == HFA384x_MONITOR_ENABLE) {
56 + // KoreK: get into test mode 0x0a
57 + cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
58 + HFA384x_CMD_AINFO_SET(0x0a);
59 + } else {
60 + cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
61 + HFA384x_CMD_AINFO_SET(enable);
62 + }
63 cmd.parm0 = 0;
64 cmd.parm1 = 0;
65 cmd.parm2 = 0;
66 @@ -3178,13 +3184,26 @@
67 HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
68 #endif
69
70 - /* if we're using host WEP, increase size by IV+ICV */
71 - if (p80211_wep->data) {
72 - txdesc.data_len = host2hfa384x_16(skb->len+8);
73 - // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
74 - } else {
75 - txdesc.data_len = host2hfa384x_16(skb->len);
76 - }
77 + if (skb->protocol != htons(ETH_P_80211_RAW)) {
78 + /* if we're using host WEP, increase size by IV+ICV */
79 + if (p80211_wep->data) {
80 + txdesc.data_len = host2hfa384x_16(skb->len+8);
81 + // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
82 + } else {
83 + txdesc.data_len = host2hfa384x_16(skb->len);
84 + }
85 + } else {
86 + /* KoreK: raw injection (monitor mode): pull the rest of
87 + the header and ssanity check on txdesc.data_len */
88 + memcpy(&(txdesc.data_len), skb->data, 16);
89 + skb_pull(skb,16);
90 + if (txdesc.data_len != host2hfa384x_16(skb->len)) {
91 + printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
92 + return 0;
93 + }
94 +
95 + txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
96 + }
97
98 txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
99 /* copy the header over to the txdesc */
100 @@ -3207,7 +3226,7 @@
101 spin_lock(&hw->cmdlock);
102
103 /* Copy descriptor+payload to FID */
104 - if (p80211_wep->data) {
105 + if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) {
106 result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
107 &txdesc, sizeof(txdesc),
108 p80211_wep->iv, sizeof(p80211_wep->iv),
109 @@ -3657,6 +3676,16 @@
110 switch( HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) )
111 {
112 case 0:
113 + /* KoreK: this testmode uses macport 0 */
114 + if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
115 + (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
116 + if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
117 + hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
118 + } else {
119 + WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
120 + }
121 + goto done;
122 + }
123
124 fc = ieee2host16(rxdesc.frame_control);
125
126 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x_usb.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c
127 --- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x_usb.c 2005-01-17 17:24:40.000000000 +0100
128 +++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c 2005-03-14 15:27:57.000000000 +0100
129 @@ -1143,8 +1143,14 @@
130
131 DBFENTER;
132
133 - cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
134 - HFA384x_CMD_AINFO_SET(enable);
135 + if (enable == HFA384x_MONITOR_ENABLE) {
136 + // KoreK: get into test mode 0x0a
137 + cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
138 + HFA384x_CMD_AINFO_SET(0x0a);
139 + } else {
140 + cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
141 + HFA384x_CMD_AINFO_SET(enable);
142 + }
143 cmd.parm0 = 0;
144 cmd.parm1 = 0;
145 cmd.parm2 = 0;
146 @@ -3258,37 +3264,59 @@
147 HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
148 HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
149 #endif
150 - hw->txbuff.txfrm.desc.tx_control =
151 - host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
152
153 - /* copy the header over to the txdesc */
154 - memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
155 + if (skb->protocol != htons(ETH_P_80211_RAW)) {
156 + hw->txbuff.txfrm.desc.tx_control =
157 + host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
158 +
159 + /* copy the header over to the txdesc */
160 + memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
161 + sizeof(p80211_hdr_t));
162 +
163 + /* if we're using host WEP, increase size by IV+ICV */
164 + if (p80211_wep->data) {
165 + hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
166 + // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
167 + usbpktlen+=8;
168 + } else {
169 + hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
170 + }
171 + } else {
172 + /* KoreK: raw injection (monitor mode): pull the rest of
173 + the header and ssanity check on txdesc.data_len */
174 + memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
175 + skb_pull(skb,16);
176 + if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
177 + printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
178 + return 0;
179 + }
180
181 - /* if we're using host WEP, increase size by IV+ICV */
182 - if (p80211_wep->data) {
183 - hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
184 - // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
185 - usbpktlen+=8;
186 - } else {
187 - hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
188 + hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
189 + hw->txbuff.txfrm.desc.tx_control =
190 + host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
191 +
192 + /* copy the header over to the txdesc */
193 + memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
194 + sizeof(p80211_hdr_t));
195 }
196
197 usbpktlen += skb->len;
198
199 /* copy over the WEP IV if we are using host WEP */
200 ptr = hw->txbuff.txfrm.data;
201 - if (p80211_wep->data) {
202 + if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
203 memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
204 ptr+= sizeof(p80211_wep->iv);
205 memcpy(ptr, p80211_wep->data, skb->len);
206 } else {
207 memcpy(ptr, skb->data, skb->len);
208 }
209 +
210 /* copy over the packet data */
211 ptr+= skb->len;
212
213 /* copy over the WEP ICV if we are using host WEP */
214 - if (p80211_wep->data) {
215 + if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
216 memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
217 }
218
219 @@ -4105,6 +4133,17 @@
220 switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status))
221 {
222 case 0:
223 + /* KoreK: this testmode uses macport 0 */
224 + if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
225 + (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
226 + if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
227 + hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
228 + } else {
229 + WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
230 + }
231 + goto done;
232 + }
233 +
234 w_hdr = (p80211_hdr_t *) &(usbin->rxfrm.desc.frame_control);
235 fc = ieee2host16(usbin->rxfrm.desc.frame_control);
236
237 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2mgmt.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2mgmt.c
238 --- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2mgmt.c 2005-01-25 01:38:50.000000000 +0100
239 +++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2mgmt.c 2005-03-14 13:58:11.000000000 +0100
240 @@ -2855,9 +2855,10 @@
241 }
242
243 /* Now if we're already sniffing, we can skip the rest */
244 - if (wlandev->netdev->type != ARPHRD_ETHER) {
245 + if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
246 + (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
247 /* Set the port type to pIbss */
248 - word = HFA384x_PORTTYPE_PSUEDOIBSS;
249 + word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
250 result = hfa384x_drvr_setconfig16(hw,
251 HFA384x_RID_CNFPORTTYPE, word);
252 if ( result ) {
253 @@ -2869,6 +2870,8 @@
254 }
255 if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
256 /* Set the wepflags for no decryption */
257 + /* doesn't work - done from the CLI */
258 + /* Fix? KoreK */
259 word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT |
260 HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
261 result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
262 @@ -2914,7 +2917,8 @@
263 goto failed;
264 }
265
266 - if (wlandev->netdev->type == ARPHRD_ETHER) {
267 + if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
268 + (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
269 WLAN_LOG_INFO("monitor mode enabled\n");
270 }
271
272 diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2sta.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2sta.c
273 --- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2sta.c 2005-01-25 01:38:50.000000000 +0100
274 +++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2sta.c 2005-03-14 13:58:11.000000000 +0100
275 @@ -649,7 +649,8 @@
276 DBFENTER;
277
278 /* If necessary, set the 802.11 WEP bit */
279 - if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
280 + if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
281 + && (skb->protocol != htons(ETH_P_80211_RAW))) {
282 p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
283 }
284