Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 139705 - wpa_supplicant has errors in its rcscript
Summary: wpa_supplicant has errors in its rcscript
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-08 12:53 UTC by BTreeHugger
Modified: 2006-07-09 10:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BTreeHugger 2006-07-08 12:53:12 UTC
The rcscript for wpa_supplicant-0.5.4 has at least two errors: it uses a capital -W instead of -w for calling wpa_supplicant (which causes wpa_cli to fail with a wpa_ctrl_open not found error since wpa_supplicant has no such flag and hence does not start) and also a bug that causes successful backgrounding of the network interface to prematurely stop the init script (meaning that there is proper authentication to the WPA access point, but other modules such as DHCP or route addition are never run). The errors can be fixed with the following edits to /lib/rcscripts/net/wpa_supplicant/sh, although I doubt they are optimal fixes as iproute2 is having trouble assigning static IPs (I must use DHCP).

Line 304: change -W (capital) to -w (lowercase) for the wpa_supplicant opts.
Line 161: change "exit 0" to "assoc_success=1" and follow that with a new line "return 0"
Line 328: add these lines after the wpa_supplicant_associate line:
	if [[ ${assoc_success} = 2 ]] ; then
		return 0
	fi

The assoc_success variable hack is terribly ugly, but this was the quickest solution I could find.

Another possible issue I haven't looked into is fairly random, but I sometimes have to stop my interface twice; /etc/init.d/net.wlan0 stop will not always stop the entire set of services right away.

Finally, is it possible to clear wpa_* in /var/run so that cryptic errors do not come up because wpa_supplicant's PID makes it look like it's already running? Otherwise wpa_cli gives a similar generic "wpa_ctrl_open not found" error..

Thanks.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-07-08 13:14:03 UTC
Has nothing to do w/ portage tools.
Comment 2 Roy Marples (RETIRED) gentoo-dev 2006-07-09 06:29:44 UTC
wpa_supplicant-0.4.x supports the -W flag. It means don't associate with anything until wpa_cli connects to us as a daemon.

Also, reporter neglected to attach emerge --info so I have no idea which baselayout version you are using. I'm guessing that you're using 1.11 - try 1.12.1
Comment 3 BTreeHugger 2006-07-09 09:38:07 UTC
My apologies for the messy report. I am testing with baselayout-1.12.1 and wpa_supplicant-0.5.4, whose manpage does not mention -W at all. My emerge --info is:

Gentoo Base System version 1.12.1
Portage 2.1.1_pre2-r6 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-reiser4-r10 i686)
=================================================================
System uname: 2.6.16-reiser4-r10 i686 Mobile AMD Athlon(tm) 64 Processor 3000+
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -fomit-frame-pointer -pipe -ffast-math -fweb -ftracer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf"
CXXFLAGS="-march=k8 -O2 -fomit-frame-pointer -pipe -ffast-math -fweb -ftracer -fvisibility-inlines-hidden"
DISTDIR="/mnt/bartond/shared/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -s"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--timeout=180"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.1.105/portage-sync/"
USE="x86 3dnow 3dnowex 3dnowext X alsa apm avi berkdb bitmap-fonts cairo cjk cli crypt cups dlloader dri eds emboss encode fam foomaticdb fortran gdbm gif glitz gpm gstreamer gtk2 imlib ipv6 isdnlog jikes jpeg kdeenablefinal libg++ libgda libwww mad mikmod mmx mmx2 mmxext motif mp3 mpeg ncurses nls nptl nptlonly ogg opengl pam pcmcia pcre pdflib perl pic png pppd python quicktime readline reflection samba session spell spl sse ssl tcpd truetype truetype-fonts type1-fonts udev unicode userlocales vorbis xinerama xml xorg xprint xv zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev input_devices_synaptics kernel_linux linguas_en userland_GNU video_cards_radeon video_cards_vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL
Comment 4 Roy Marples (RETIRED) gentoo-dev 2006-07-09 10:02:43 UTC
wpa_supplicant -h
will show the -W option.

Basically what happens is this. net.wlan0 will launch wpa_supplicant, wpa_cli, mark net.wlan0 as inactive and then exit. When wpa_supplicant asscociates it then calls net.wlan0 again to complete the connection.

This is what you're seeing and this is correct behaviour.

We cannot clean /var/run of wpa_supplicant entries because there maybe more than one instance of wpa_supplicant running. wpa_supplicant-0.5.x should clean itself properly.