Public bug reported: Binary package hint: wpasupplicant
This bug is present in the 0.6.0+0.5.8-0ubuntu1 (gutsy) version of the package and is probably just a really simple scripting error. When using wpa_supplicant with the 'ifup' command the optional access group specified in the wpa_supplicant.conf file is ignored. BUG REPRODUCTION: To reproduce, create /etc/wpa_supplicant/wpa_supplicant.conf as follows: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin network={ # insert wlan details here } The 'admin' group can be any group you are a member of. Also set up an interface in /etc/network/interfaces as follows: auto wlan0 iface wlan0 inet dhcp wpa-driver wext wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf Feel free to substitute your own interface name and/or appropriate wpa-driver as necessary. Now run 'sudo ifup wlan0'. When that finishes run 'wpa_cli' from a user account which is a member of the group you specified in wpa_supplicant.conf (NOT as root). wpa_cli will come up with the following: Selected interface 'wlan0' Could not connect to wpa_supplicant - re-trying BUG EXPLANATION: wpa_cli is a command-line interface to a running wpa_supplicant process. It communicates with wpa_supplicant through a control interface that wpa_supplicant creates in a set directory (usually /var/run/wpa_supplicant). wpa_supplicant supports setting this directory via a config file (usually /etc/wpa_supplicant/wpa_supplicant.conf) or alternatively through a command-line option ('-C'). There is also an option to permit access to the interface to a user group in addition to root, so that wpa_cli may be used by this group. The help for wpa_supplicant and manpages for wpa_supplicant and wpa_supplicant.conf are all well out of date in this area. The config file option is called 'ctrl_interface' and is set in the following way: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin previously there were two options, 'ctrl_interface' for the directory and 'ctrl_interface_group' for the group, which might be where this problem has come from. In any case, in the '/etc/wpa_supplicant/ifupdown.sh' script (line 80) there is a three-command sed script which retrieves the value of the 'ctrl_interface' parameter from a config file, in order to then pass it to wpa_supplicant on the command-line. This should not be necessary as if a config file has been specified then it is supposed to have a higher priority than command-line options anyway! Although it actually doesn't, which is either a bug or an error in the wpa_supplicant help. Back to the sed script, which is also wrong. The first command removes comments, the second (I assume) is supposed to remove indented lines, and the third retrieves the parameter. The second command is: s/[[:space:]]\+.*$//g; This will actually delete the contents of every line after at least one whitespace character is encountered. This means that: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin is parsed to: ctrl_interface=DIR=/var/run/wpa_supplicant A better command might be s/^[[:space:]]\+.*$//; The carat means the whitespace must be at the start of the line, and the terminating 'g' is unnecessary as it will only ever match once. The third command is also odd: s/^\(ctrl_interface\|DIR\)=\(.*\)/\2/p This matches either ctrl_interface or DIR, and saves this text to a variable (never used) before saving the rest of the parameter to another variable. It's strange because the matching used on the third command is such that neither of the first two commands make any difference and could be removed without effect. An alternative command would be: s/^ctrl_interface=\(.*\)/\1/p Even this doesn't fix the problem on its own as the space between the DIR and GROUP sub-params ensures that the command-line '-C' option will misfire. When running wpa_supplicant yourself from the command-line, it is possible to enclose both sub-params in speechmarks (i.e. -C "DIR=/var/run/wpa_supplicant GROUP=admin") but I haven't had any success modifying ifupdown.sh in this way, having tried both speechifying and escaping the space between them. BUG SOLUTION: The easiest way to resolve this problem is to edit ifupdown.sh, go to line 84, and remove the '-C $WPA_CTRL_DIR' stanza from the WPA_SUP_CONF assignment, ignoring the sed script and leaving ifupdown.sh as wrong. I'd have just said that instead of this novel except that I don't understand why the option was there in the first place, so someone with a better understanding of networking in ubuntu should take a look. The best thing to do would be to revise all scripts and documentation included with this package to reflect the current state of wpa_supplicant! Boy it took forever to teach myself bash, sed and regex so I could nail this problem. Not to mention how long it took to get my wireless working properly in the first place! wpa_gui is much better than the network manager, btw. ** Affects: wpasupplicant (Ubuntu) Importance: Undecided Status: New -- non-root use of wpa_cli not possible https://bugs.launchpad.net/bugs/162775 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs