Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/init.d/wpa_supplicant script error [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ser_f
n00b
n00b


Joined: 29 Nov 2011
Posts: 2

PostPosted: Tue Nov 29, 2011 5:50 am    Post subject: /etc/init.d/wpa_supplicant script error [solved] Reply with quote

I wasn't to sure were to post this so here it is.
wpa_supplicant gui would not start correctly with 2 or more wireless cards attached. Only the first network card that was detected was accessible via the gui. The error was in the in the script /etc/init.d/wpa_supplicant

see new code below
hopefully this will get updated :)

#!/sbin/runscript
# Copyright (c) 2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
# Edited 2011 Frank Serafin <fserafin_@hotmail.com> fix bug where
# wpa_supplicant would only connect to a single wireless card not 2 or
# more

command=/usr/sbin/wpa_supplicant
: ${wpa_supplicant_conf:=/etc/wpa_supplicant/wpa_supplicant.conf}
wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if
command_args="$wpa_supplicant_args -B $wpa_supplicant_if "
name="WPA Supplicant Daemon"

depend()
{
need localmount
use logger
after bootmisc modules
before dns dhcpcd net
keyword -shutdown
}

find_wireless()
{
local iface=

case "$RC_UNAME" in
Linux)
for iface in /sys/class/net/*; do
if [ -e "$iface"/wireless -o \
-e "$iface"/phy80211 ]
then
echo "${iface##*/}"
#return 0
fi
done
;;
*)
for iface in /dev/net/* $(ifconfig -l 2>/dev/null); do
if ifconfig "${iface##*/}" 2>/dev/null | \
grep -q "[ ]*ssid "
then
echo "${iface##*/}"
return 0
fi
done
;;
esac

return 1
}

append_wireless()
{
local iface= i=
local n_ifaces=0

iface=$(find_wireless)
if [ -n "$iface" ]; then
for i in $iface; do
if [ $n_ifaces -ne 0 ]
then
command_args="$command_args -N "
fi

command_args="$command_args -c$wpa_supplicant_conf -i$i"
n_ifaces=$(($n_ifaces+1))
done
else
eerror "Could not find a wireless interface"
fi
}

start_pre()
{
case " $command_args" in
*" -i"*) ;;
*) append_wireless;;
esac
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum