On Saturday 12 July 2008, Glenn Saberton wrote: > Netcfg's current behavior is to associate to any open access point. > Even if the user sets an essid when reconfiguring wireless, if the > essid is hidden, netcfg will default to another open access point as > there is no actual essid string to choose from if its hidden. This > patch changes the behavior to use the essid that the user has set if > he/she goes back and reconfigures the wireless network. Thanks for the patch. Have not tried it yet, but I will. Below some additional info. This time with the AP set to broadcast the ESSID. It no longer sets the channel (at least not during initial configuration), but still fails completely. > Personally I would rather change the default behaviour around to ask > for an essid first and then default to open/any if the user doesn't > supply an essid himself. We may need to change the logic anyway. After looking at the current code it seems really fragile and inconsistent. Especially the assumptions about what info to ask for seems wrong. IMO there are currently just too many APs around to assume that "if there is a totally open AP, the user will probably want that one". Besides a high risk that that could well just be not what he wants, it is also potentially insecure, especially for installs. Also, the way the "save settings" and "trying to associate" are implemented is completely different for ESSID and WEP. Right. The new test results. One issue in my initial mail was the totally unpredictable behavior of when a rescan would happen. I have found the reason for this and it is related to this BR: http://bugs.debian.org/403983. Basically, the ath5k driver will only trigger a rescan if a setting changes while the interface is "up". If it is "down", changes in settings are accepted, but do not result in a rescan. A change in the status of the interface (down to up) will not result in a rescan. netcfg roughly has the following code: - get current settings - ask user input - set new settings - loop to try association - interface up - get settings <---- _g_et, not _s_et - interface down As can be seen, it never _sets_ settings while the interface is up. Attached logs for both ath5k and madwifi that clearly show the difference (exact same command sequence, with iwevent running in background). With ath5k there is no rescan on 'link up', with madwifi there is. netcfg clearly depends on the behavior that madwifi shows. Attached also a rough patch that could solve this for ESSID, while keeping a set for "mode" _before_ the interface is brought up. Totally untested. Cheers, FJP P.S. I have NMUed wireless-tools (10-day delay). The new udeb is available here (i386 and amd64): http://people.debian.org/~fjp/tmp/wireless-tools/
# ip link show ath0 10: ath0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"" Mode:Managed Channel:0 Access Point: Not-Associated Tx-Power=0 dBm Retry min limit:7 RTS thr:off Fragment thr=2346 B Encryption key:off Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # iwconfig ath0 essid fjptest 01:22:26.192469 ath0 Set ESSID:"fjptest" # ip link show ath0 10: ath0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"fjptest" Mode:Managed Channel:0 Access Point: Not-Associated Tx-Power=0 dBm Retry min limit:7 RTS thr:off Fragment thr=2346 B Encryption key:off Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # ip link set ath0 up # ip link show ath0 10: ath0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000 link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"fjptest" Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated Tx-Power=27 dBm Retry min limit:7 RTS thr:off Fragment thr=2346 B Encryption key:off Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # iwconfig ath0 essid fjptest 01:22:30.284756 ath0 Set ESSID:"fjptest" 01:22:31.386578 ath0 Scan request completed 01:22:31.391004 ath0 Custom driver event:ASSOCINFO(ReqIEs=0007666a7074657374010802040b16182430483202606c RespIEs=010882848b962430486c32040c121860dd09001018020013000000) 01:22:31.391150 ath0 New Access Point/Cell address:00:14:C1:38:E5:15 # ip link show ath0 10: ath0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"fjptest" Mode:Managed Frequency:2.457 GHz Access Point: 00:14:C1:38:E5:15 Bit Rate=1 Mb/s Tx-Power=27 dBm Retry min limit:7 RTS thr:off Fragment thr=2346 B Encryption key:off Link Quality=59/100 Signal level=-59 dBm Noise level=-97 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Index: wireless.c =================================================================== --- wireless.c (revision 54233) +++ wireless.c (working copy) @@ -34,6 +34,7 @@ wireless_config wconf; char* tf = NULL, *user_essid = NULL, *ptr = wconf.essid; + interface_down(iface); iw_get_basic_config (wfd, iface, &wconf); debconf_subst(client, "netcfg/wireless_essid", "iface", iface); @@ -52,6 +53,8 @@ wconf.has_mode = 1; wconf.mode = mode; + + iw_set_basic_config (wfd, iface, &wconf); debconf_input(client, priority ? priority : "low", "netcfg/wireless_essid"); @@ -71,8 +74,6 @@ wconf.essid[0] = '\0'; wconf.essid_on = 0; - iw_set_basic_config (wfd, iface, &wconf); - /* Wait for association.. (MAX_SECS seconds)*/ #define MAX_SECS 3 @@ -87,7 +88,7 @@ interface_up(iface); sleep (1); - iw_get_basic_config (wfd, iface, &wconf); + iw_set_basic_config (wfd, iface, &wconf); if (!empty_str(wconf.essid)) { /* Save for later */
# ip link show ath0 14: ath0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11b ESSID:"" Nickname:"" Mode:Managed Channel:0 Access Point: Not-Associated Bit Rate:0 kb/s Tx-Power:0 dBm Sensitivity=1/1 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=0/70 Signal level=0 dBm Noise level=0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # iwconfig ath0 essid fjptest 01:30:51.996698 ath0 Set ESSID:"fjptest" # ip link show ath0 14: ath0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11b ESSID:"fjptest" Nickname:"" Mode:Managed Channel:0 Access Point: Not-Associated Bit Rate:0 kb/s Tx-Power:0 dBm Sensitivity=1/1 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=0/70 Signal level=0 dBm Noise level=0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # ip link set ath0 up 01:30:56.565090 ath0 Scan request completed 01:30:56.732522 ath0 New Access Point/Cell address:00:14:C1:38:E5:15 # ip link show ath0 14: ath0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"fjptest" Nickname:"" Mode:Managed Frequency:2.457 GHz Access Point: 00:14:C1:38:E5:15 Bit Rate:36 Mb/s Tx-Power:16 dBm Sensitivity=1/1 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=38/70 Signal level=-53 dBm Noise level=-91 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # iwconfig ath0 essid fjptest 01:30:59.032824 ath0 New Access Point/Cell address:Not-Associated 01:30:59.032866 ath0 Set ESSID:"fjptest" # sleep 2 01:30:59.038027 ath0 New Access Point/Cell address:00:14:C1:38:E5:15 # ip link show ath0 14: ath0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 00:03:2f:1f:e4:6e brd ff:ff:ff:ff:ff:ff # iwconfig ath0 ath0 IEEE 802.11g ESSID:"fjptest" Nickname:"" Mode:Managed Frequency:2.457 GHz Access Point: 00:14:C1:38:E5:15 Bit Rate:54 Mb/s Tx-Power:16 dBm Sensitivity=1/1 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=38/70 Signal level=-53 dBm Noise level=-91 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Attachment:
signature.asc
Description: This is a digitally signed message part.