Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
wpa_supplicant and /etc/conf.d/net
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
jamarkha
n00b
n00b


Joined: 23 Jan 2004
Posts: 10
Location: Grand Rapids, MI

PostPosted: Fri Jan 20, 2006 2:52 pm    Post subject: wpa_supplicant and /etc/conf.d/net Reply with quote

Having trouble with getting wpa_supplicant to work the way I want.

My versions:
kernel: 2.6.14-gentoo-r5
baselayout: 1.11.14-r1
ndiswrapper: 1.8
wpa_supplicant: 0.5.0-r1
wireless-tools: 28_pre10

My /etc/wpa_supplicant.conf:

Code:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=2
opensc_engine_path=/usr/lib/opensc/engine_opensc.so
pkcs11_engine_path=/usr/lib/opensc/engine_pkcs11.so
pkcs11_module_path=/usr/lib/pkcs11/opensc-pkcs11.so
update_config=1

network={
   ssid="<xxxxxxxxxxx>"
   psk="<xxxxxxxxxx>"
   proto=WPA
   key_mgmt=WPA-PSK
   pairwise=TKIP
   bssid=<xx:xx:xx:xx:xx:xx>
}



I know it's in my hackish, grotesque /etc/conf.d/net which I will shamelessly post below:

Code:

preup() {

   # Set Firestarter interface to dial-up in case eth0 or wlan0 crap out
   perl -pi -e 's/IF="\d*\w*"/IF="ppp0"/' /etc/firestarter/configuration
   perl -pi -e 's/EXT_PPP="\d*\w*"/EXT_PPP="on"/' /etc/firestarter/configuration

   if [[ ${IFACE} == "wlan0" ]]
   then
      if iwlist ${IFACE} scanning 2> /dev/null | grep -q 'Address: <xx:xx:xx:xx:xx:xx>'
      then       
         modules=( "wpa_supplicant" )
         wpa_supplicant_wlan0="-Dndiswrapper"
         wpa_timeout_wlan0=45
         einfo "Using WPA supplicant on $IFACE"
      else
         modules=( "iwconfig" )
         mode_wlan0="managed"
         einfo "Using iwconfig on $IFACE"

      fi
   fi

   return 0
}

postup() {
   # If eth0 or wlan0 didn't crap out, set Firestarter interface to whichever one didn't
   perl -pi -e 's/IF="\d*\w*"/IF="'${IFACE}'"/' /etc/firestarter/configuration
   perl -pi -e 's/EXT_PPP="\d*\w*"/EXT_PPP="off"/' /etc/firestarter/configuration
}

modules=( "dhcpcd" )
iface_eth0="dhcp"
dhcpcd_eth0="-t 8 -D -N -h ${HOSTNAME}"

iface_wlan0="dhcp"
dhcpcd_wlan0="-t 8 -D -N -h ${HOSTNAME}"


Under this setup, I'm getting the following:

Code:

jeffmar@<xxxxxxxxx> ~ $ sudo /etc/init.d/net.wlan0 start
 * Starting wlan0
 *   Running preup function
 *     Using WPA supplicant on wlan0
 *   Configuring wireless network for wlan0
 *   Couldn't find any access points on wlan0
 *   Failed to configure wireless for wlan0                                                                                            [ !! ]


But I know all the pieces (w/o baselayout) work because running the commands below works like a charm. I'm connected to the AP I specify in /etc/wpa_supplicant.conf with WPA/TKIP all working perfectly.

Code:

jeffmar@<xxxxxxxxx> ~ $ sudo wpa_supplicant -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf -B
jeffmar@<xxxxxxxxx> ~ $ sudo dhcpcd -t 8 -D -N -h <xxxxxxxxx> wlan0


The reason for the different scenarios in /etc/conf.d/net is that this is on an IBM ThinkPad I use for work. I travel during the week so in the hotels, I'm getting my wireless via iwconfig. At home, I have a Linksys WRT54G w/WPA/TKIP with broadcast SSID off. This is the network specified in /etc/wpa_supplicant.conf. If neither eth0 or wlan0 are available, I use a dialup connection (ppp0) to work.

And getting wlan0 to connect with iwconfig when I'm on the road with the above settings is no problem either.

Thanks in advance for any and all advice that anybody may be able to offer.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Jan 20, 2006 3:32 pm    Post subject: Reply with quote

That's not going to work - the modules directive is parsed before running pre/post/up/down functions.

A good solution would be to create a runlevel that defines iwconfig instead of wpa_supplicant (or vice versa) and use that.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
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