From: Denis V. <vd...@po...> - 2005-04-05 07:02:22
|
This patch: a) Renames ACX_MODE_xxx consts so that they do not contain useless parts (we dont need MANAGED in ACX_MODE_3_MANAGED_AP), adds MONITOR and OFF, removes AUTO. b) Removes a bunch of priv->xxx members which do not seem to be needed. We already have far too many. Code is changed to work without them. In particular, we do not need macmode_wanted, macmode_chosen, macmode_joined triplet. We need macmode. Period. Auto mode is silly. User shall just make up his mind ad decide does he want ad-hoc or infrastructure mode. Thus macmode_wanted==macmode_chosen. Also we do not expect to want to join ad-hoc cell but suddenly find ourself in joined to an AP (that will be utterly strange), thus macmode_wanted==macmode_joined. (I plan to rename it it acx_mode, and status to acx_status for better grep. Later.) c) acx_scan_chan and acx_join_bssid got _cmd_ added to name (to make it clearer that they just submit a cmd to firmware) d) switched many places from if() to switch() to make code paths related to different iwconfig modes more visible e) made ah-hoc, ap, monitor, off modes work right at least in regard to emitting (or not emitting) proper beacons. Monitor mode tested for capture. This is the most important part of the patch. f) added and trimmed comments, WLAN_ defines, switched from numeric consts to symbolic, other minor work. Patch was run tested. Please review/apply. Bugs and strange things observed: "iwconfig ad-hoc; iwconfig monitor" continues to send beacons! Fixed: cmd_join with invalid macmode (0xfe) 4 extra bytes at end of packets in monitor mode with PRISM+802.11 header: 00:23:25.228930 0us Beacon[|802.11] 0x0000: 4100 0000 9000 0000 776c 616e 3000 8000 A.......wlan0... 0x0010: 0000 ffff ffff ffff 4110 0000 0000 0400 ........A....... 0x0020: 2dd4 9c00 4120 0000 0000 0400 4c84 270d -...A.......L.'. 0x0030: 4130 0000 0000 0400 0100 0000 4140 0000 A0..........A@.. 0x0040: 0100 0400 0000 0000 4150 0000 0100 0400 ........AP...... 0x0050: 0000 0000 4160 0000 0000 0400 0000 0000 ....A`.......... 0x0060: 4170 0000 0000 0400 1100 0000 4180 0000 Ap..........A... 0x0070: 0100 0400 0000 0000 4190 0000 0000 0400 ........A....... 0x0080: 0000 0000 4160 0000 0000 0400 4300 0000 ....A`......C... 0x0090: 8000 0000 ffff ffff ffff 0009 5b67 8f70 ............[g.p 0x00a0: 0009 5b67 8f70 7024 d022 ec07 0000 0000 ..[g.pp$."...... 0x00b0: 6400 1200 0006 686f 7374 6170 0104 8284 d.....hostap.... 0x00c0: 0b16 0301 0106 0200 0005 0400 0100 0000 ................ ^^ 0x00d0: e916 bf ... ^^^^^^^ Is this FCS? Same packet captured by Prism2.5 sniffer (without 802.11 header): 00:23:25.229057 0us Beacon (hostap) [1.0* 2.0* 5.5 11.0 Mbit] IBSS CH: 1, PRIVACY 0x0000: 8000 0000 ffff ffff ffff 0009 5b67 8f70 ............[g.p 0x0010: 0009 5b67 8f70 7024 d022 ec07 0000 0000 ..[g.pp$."...... 0x0020: 6400 1200 0006 686f 7374 6170 0104 8284 d.....hostap.... 0x0030: 0b16 0301 0106 0200 0005 0400 0100 00 ............... Flaky ESS beacons. Fix: cmd_join(macmode=adhoc). 'Fixed' beacon: 23:35:16.574676 Beacon (acx) [1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 Mbit] ESS CH: 1 0x0000: 8000 0000 ffff ffff ffff 00e0 98ba 20c3 ................ 0x0010: 00e0 98ba 20c3 e092 29d1 e50d 0000 0000 ........)....... bssid^^^^^^^^^ seq^ timestamp^^^^^^^^^^ 0x0020: 6400 4100 0003 6163 7801 0882 848b 0c12 d.A...acx....... bint cap^ ssid^^^^^^^^rates^^^^^^^^^^^^ 0x0030: 9618 2403 0101 3205 2c30 4860 6c ..$...2.,0H`l ^^^^^^^DSparm^ ExtRates^^^^^^^^^ We still miss TIM IE (not coded yet). Can this be the reason? Example of good beacons from other hardware: (TODO: send to Jouni!!!! IBSS parm + TIM is a BUG!!!) 21:01:47.770212 0us Beacon (hostap) [1.0* 2.0* 5.5 11.0 Mbit] IBSS CH: 1, PRIVACY 0x0000: 8000 0000 ffff ffff ffff 0009 5b67 8f70 ............[g.p 0x0010: 0009 5b67 8f70 4005 80d2 8400 0000 0000 ..[g.p@......... bssid^^^^^^^^^ seq^ timestamp^^^^^^^^^^ 0x0020: 6400 1200 0006 686f 7374 6170 0104 8284 d.....hostap.... bint cap^ ssid^^^^^^^^^^^^^^^ rates^^^^ 0x0030: 0b16 0301 0106 0200 0005 0400 0100 00 ............... ^^^^ DSparm^IBSSparm^^TIM^^^^^^^^^^^^ 21:59:25.116214 0us Beacon (hostap) [1.0* 2.0* 5.5 11.0 Mbit] ESS CH: 1, PRIVACY 0x0000: 8000 0000 ffff ffff ffff 0009 5b67 8f70 ............[g.p 0x0010: 0009 5b67 8f70 4009 d662 2200 0000 0000 ..[g.p@..b"..... bssid^^^^^^^^^ seq^ timestamp^^^^^^^^^^ 0x0020: 6400 1100 0006 686f 7374 6170 0104 8284 d.....hostap.... bint cap^ ssid^^^^^^^^^^^^^^^ rates^^^^ 0x0030: 0b16 0301 0105 0400 0100 00 ........... ^^^^ DSparm^TIM^^^^^^^^^^^^ Our buggy beacons: 20:58:38.234162 0us Beacon () [1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 Mbit] ESS CH: 1 0x0000: 8000 0000 ffff ffff ffff 00e0 98ba 20c3 ................ 0x0010: 00e0 98ba 20c3 00f3 dc60 6701 0000 0000 .........`g..... seq^ timestamp^^^^^^^^^^ 0x0020: 6400 4100 0003 6d6f 6e01 0882 848b 0c12 d.A...mon....... bint cap^ ssid^^^^^^^^rates^^^^^^^^^^^^ 0x0030: 9618 2403 0101 3205 2c30 4860 6c00 0000 ..$...2.,0H`l... ^^^^^^^DSparm^ ExtRates^^^^^^^^^garbage follows!!! 0x0040: 0a00 0000 0000 0000 0000 0000 0000 0000 ................ 0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0110: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0120: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0130: 0000 0000 0000 0000 0000 0000 00 ............. 20:58:38.336529 0us Beacon (mon) [1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 Mbit] ESS CH: 1 0x0000: 8000 0000 ffff ffff ffff 00e0 98ba 20c3 ................ 0x0010: 00e0 98ba 20c3 10f3 dcf0 6801 0000 0000 ..........h..... 0x0020: 6400 4100 0003 6d6f 6e01 0882 848b 0c12 d.A...mon....... 0x0030: 9618 2403 0101 3205 2c30 4860 6c00[0009] <======================== CHANGING 0x0040: 0a00 0000 0000 0000 0000 0000 0000 0000 ................ 0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0110: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0120: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0130: 0000 0000 0000 0000 0000 0000 00 ............. 20:58:38.438933 0us Beacon (mon) [1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 Mbit] ESS CH: 1 0x0000: 8000 0000 ffff ffff ffff 00e0 98ba 20c3 ................ 0x0010: 00e0 98ba 20c3 20f3 db80 6a01 0000 0000 ..........j..... 0x0020: 6400 4100 0003 6d6f 6e01 0882 848b 0c12 d.A...mon....... 0x0030: 9618 2403 0101 3205 2c30 4860 6c00 0008 ..$...2.,0H`l... 0x0040: 0a00 0000 0000 0000 0000 0000 0000 0000 ................ 0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0110: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0120: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0130: 0000 0000 0000 0000 0000 0000 00 ............. -- vda |