wpa_supplicant for WPA wifi

Pankaj
Hi

The 2.6.29 image only has iwconfig which only works for WEP enabled
connections. To access WPA enabled connections I need wpa_supplicant but it
doesnt seem to be available in the linux image that comes on the CD with
the mini2440. Is it available seperately for download somewhere?

Thanks
Pankaj

S.Onur Selamet
Attachment: wpa_compile_error.txt (2.84 KB)
Hi all,

I was trying to cross compile wpa_supplicant-0.6.10 for mini2440.

I added my libssl-devel-0.9.8g "/usr/include/openssl" folder to
"/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/include-f
ixed"

then

 cross compiled openssl-0.9.8g with ./config -shared and copied
libssl.so,libcrypto.so,libssl.a,libcrypto.a files to
"/usr/local/angstrom/arm/lib".

So far so good. I was sure i made necessary additions to toolchain.

But when i try to cross compile wpa_supplicant i got the errors telling 

"... skipping incompatible /usr/local/angstrom/arm/bin/../lib/libssl.so
when searching for -lssl"

and the same for -lcrypto.

make says they are incompatible. They are both version 0.9.8g. I can not
understand what is wrong with this.

Any ideas?

Thanks.

S.Onur Selamet
I guess there is something wrong with openssl cross-compilation :(

I need to have some rest and try again may be :)

S.Onur Selamet
I wanted to share if you would need.

Here is wpa_supplicant binaries for mini2440 with necessay libs.

http://www.dengebt.com/wpa_supplicant0.6.10_mini2440_dengebt.tar.gz

Hope you enjoy!

S.Onur Selamet
Here you can see it 

http://www.youtube.com/watch?v=AX7SGDP0qYY

contact us at info[at]dengebt.com if you need any technical
assistance,consultancy or training.

Andreas
After starting the wpa supplicatn i got this error:

[root@ARM /]# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:E0:60:17:0E:46
          inet addr:192.168.50.20  Bcast:192.168.50.255  Mask:255.255.255.0
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

[root@ARM /]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated
          Tx-Power=20 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

[root@ARM /]# wpa_supplicant -D wext -i wlan0 -c /etc/wpa-psk-tkip.conf
socket(PF_PACKET): Address family not supported by protocol
[root@ARM /]#
-------------------------------
My wpa-psk-tkip.conf

network={
  ssid="Speedport W 501 V"
  proto=RSN
        key_mgmt=WPA-PSK
  pairwise=CCMP
  group=TKIP
  #psk="i asume its correct :-)"
  psk=blaaaablaaaablaaa
}



Can somebody help me?

Andreas
Okay got it:

1. you need to compile the Kernel with CONFIG_PACKET=y
2. this is my W-LAN-start.sh

ifconfig eth0 down
iwconfig wlan0 essid "Speedport W 501 V" channel 4
ifconfig wlan0 192.168.50.104 up
route add default gw 192.168.50.254
wpa_supplicant -D wext -i wlan0 -c /etc/wpa-psk-tkip.conf


[root@ARM /etc]# cat wpa-psk-tkip.conf
network={
        ssid="Speedport W 501 V"
        proto=WPA RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        group=CCMP TKIP
        #psk="WPA2-PASK"
        psk=WPA2-PSK
}


Thats all ... thank you internet and thank you google :-)

rotceh
Hi Andreas,

Have you managed to put it to rcS to make it automatic WiFi activation
during booting? What is the syntax that you used in rcS?

Thanks,
rotceh

Andreas
Yes i have added a line in my rcS

---------------------------------------
echo "Starting w-kan" > /dev/tty1
./start-wlan.sh
---------------------------------------

and here start-wlan.dh
---------------------------------------------------------------
ifconfig eth0 down
iwconfig wlan0 essid "Speedport W 501 V" channel 4
ifconfig wlan0 192.168.50.104 up
route add default gw 192.168.50.254
wpa_supplicant -D wext -i wlan0 -c /etc/wpa-psk-tkip.conf
----------------------------------------------------------------

My scipt is stoping the eth0 device and starts up the w-lan

geckus
i tried downloading 
http://www.dengebt.com/wpa_supplicant0.6.10_mini2440_dengebt.tar.gz
and putting files in folder /lib/
and /usr/sbin/ and /etc/ 
but upon running wpa_supplicant
i get a Segmentation fault....please help
have been trying 3 different kinds of wifi usb now...now finally using
tl-wn321g

thanks

Andreas
Did you compile your own kernel?

You need to compile the Kernel with CONFIG_PACKET=y
And of course you will need the correct kernel modul for you
W-LAN usb stick...

Yours Andreas

rotceh
Hi Andreas,

I tried to find the CONFIG_PACKET=y, but couldn't locate it in the kernel.
Where can I locate it? I mean, exact folder or file in the kernel?

Thanks,
rotceh

Andreas
I am using this (its similar to Logilink 54mbps)

http://www.pollin.de/shop/dt/MzcxOTgyOTk-/Computer_und_Zubehoer/Netzwerk...

Andreas
http://www.logilink.eu/cmsfiles/modules/i-sell2u/showproduct.htm?isu_zei...

Andreas
forgett the last link .... this is a another modell of the stick wich i
have not tested...

geckus
i just stumbled on this thread because i tried connected with totally no
wep or wpa. added ap and then my routers name for essid.
now
[root@FriendlyARM /]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bg  ESSID:"Anjels"  
          Mode:Managed  Frequency:2.437 GHz  Access Point:
94:0C:6D:A1:66:80   
          Bit Rate=54 Mb/s   Tx-Power=7 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
          Link Quality=60/70  Signal level=-50 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

but the moment i take out my Ethernet cable...
i cant ping the arm.

Andreas
At this point try :

ifconfig eth0 down
ifconfig wlan0 xxx.xxx.xxx.xxx up


the xxx is your IP address !

CU Andreas

Bruno
Guys, I couldn't ping my Server on my wireless...

[root@FriendlyARM /]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bg  ESSID:"Henry"
          Mode:Managed  Access Point: Not-Associated   Tx-Power=7 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

what I have to do now?? *----*

andromeda
hi,

how do i do for configuring wpa with AES ?

i need to replace tkip by AES in config file ?

network={
        ssid="Speedport W 501 V"
        proto=WPA RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP     >== AES ?
        group=CCMP TKIP        <== AES ?
        #psk="WPA2-PASK"
        psk=WPA2-PSK
}

Thanks in adavance.

Andreas
CCMP = WPA2 (CCMP is based on AES)
TKIP = WPA1 (RC4 encryption algorythmus)

Yours Andreas

andromeda
ok thanks , i have recompiled my kernel with PF_PACKET=y but 
i have an error ioctl

i must check PF_PACKET in kernel config on menuconfig?
many options inside this options.
what options i must checked ?

thanks in advance.

andromeda
what version of linux you have ?
i have 2.6.32.2
please, can you put to download link for your .config ?

i recompile my kernel with your .config.

i have ralink alpha usb stick wifi.

it work in wep but not with wpa.

thanks.

Andreas
Hmmm i must first have a look into my .config files ...
I will report back... (maybe to night)

Davi
Hi, S.Onur Selamet released wpa_supplicant binaries, anybody have the
fonts? Or where can i find it?

Davi
Hi, i would like to know the status of my connection using WPA, i noticed
that when i execute the command:

wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant.conf

I can see the response of command, typing the command and while it doesn't
response anything like:
CTRL-EVENT-CONNECTED - Connection to 00:b0:c6:01:28:7d completed (auth)
so my mini is unable to get an IP from DHCP. 

Sometimes when i try to connect using the command above the response
contain:
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
I try again until have the response OK and I start my DHCP client and
everthing works.

My problem its to save this response on a file or any place to read it
after. For example, on my C++ app. Anybody has a idea how a resolve my
problem? Looking for a parameters of wpa_supplicant command anyone concerns
to save the response on a log file, just executing on backgrounding and
increase the debug of command.

Thanks

Fawad Lateef
@S.Onur Selamet:

I used your compiled version and working perfectly fine with
EAP-PEAP-MSCHAPv2 on AT91SAM9260 MCU which is also based on ARMv5l. 

Now please can you give me source tar-ball for all the libraries and
wpa_supplicant you compiled ? I just want to avoid getting into troubles of
compiling this from scratch. 

Thanks,

Fawad Lateef

S.Onur Selamet
As requested necessary lib source tar balls can be found below

(official releases which are used in my release without any modification)

http://www.openssl.org/source/openssl-0.9.8g.tar.gz
http://hostap.epitest.fi/releases/wpa_supplicant-0.6.10.tar.gz

Cross-Compilation (with angstrom toolchain) information might come handy:

wpa supplicant:

first install libssl-devel to your host linux (where cross-compilation
takes place) 

then add /usr/include/openssl folder to
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/include-fixed

make will need lcrypto and lssl libraries in /usr/local/angstrom/arm/lib

crosscompile openssl with ./Configure linux-generic32 -shared -DL_ENDIAN
and modify Makefile for your toolchain
example:
CC= arm-linux-gcc

 then make to get necessary lib files.



boot script with wpa supplicant:

/sbin/ifconfig lo 127.0.0.1                                                
    
/etc/init.d/ifconfig-eth0                                                  
    
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.4 dev eth0   
    
ifconfig wlan0 up                                                          
    
wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf                
    
ifconfig wlan0 192.168.1.222                                               
    
sleep 5                                                                    
    
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev wlan0  
    
route add default gw 192.168.1.1 dev wlan0 

kernel must have socket packet option enabled!

S.Onur Selamet
By the way nobody has mentioned the correct way to have your wpa config
file GENERATED.

Here it is.

wpa_passphrase WIFI_NAME WIFI_PASSWORD >> /etc/wpa_supplicant.conf

replace WIFI_NAME and WIFI_PASSWORD with yours and then use the generated
configuration to activate the connection.

wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

Another option that has not been mentioned here to scan for wireless
networks :

You can use 

iwlist wlan0 scan

command to list all accessible wifi networks in range.

Fawad Lateef
Hi S.Onur Selamet,

Thanks for your help for cross-compilation :) 

Regards,

Fawad Lateef

majil
I have a question. 
How come when I'm connected to Wifi I can't use eth0 anymore?
I need to have both at the same time

davef
What does it say in /etc/network/interfaces

I have mine setup so that if I ever want to go back to eth0 I just modify
this file.  I have never tried enabling both.

Maybe, you can change iptables or the route tables to enable both ... never
tried.

Good luck!

mmao
i have another question,i need some help ;

my driver realtek8192cu,it's a usb wifi device;

i can't connect WPA wifi using this scrip ,and always print
"timeout..."when i run 

./sta_connect.sh wlan0 "test0000" WPAPSK "00000000"

but i can connect the wifi without password,print "connect ok!" when i run

./sta_connect.sh wlan0 "test0000" NONE

please give me some advices; 









this is my sta_connect.sh scrip:
#!/bin/sh
################################################################################












#    Create By czy
################################################################################












WLAN=${1}
SSID="${2}"
SECURITY=${3}
PASSWORD="${4}"

if [ "$#" != "3" -a "$#" != "4" ]; then
  SELF=`basename $0`
  echo "This script support Atheros and Ralink."
  echo "Usage:"
  echo "    $SELF interface ssid {WEP | WPAPSK | NONE} [password]"
  echo "        interface          - network interface, such as wlan0, ra0"
  echo "        ssid               - SSID string."
  echo "        {WEP|WPAPSK|NONE}  - security mode."
  echo "        password           - password when security mode is WEP"
  echo "                             or WPAPSK."
  echo "example:"
  echo "    $SELF wlan0 dlink WEP 0123456789"
  echo "    $SELF wlan0 dlink WPAPSK password"
  echo "    $SELF wlan0 dlink NONE"
  echo;
  exit 0
fi
################################################################################












NORMAL="\033[00m"
RED="\033[31m"
################################################################################












wpa_supplicant_start ()
{
  echo -e $RED'start wpa_supplicant'$NORMAL
  MSG0=`busybox ps`
  MSG=`echo $MSG0 | grep -r "wpa_supplicant -i$WLAN"`
  if [ ss"$MSG" != ss"" ]; then
    echo "wpa_supplicant is running"
    return 0
  fi

  ifconfig $WLAN down
  test -d /var/run/wpa_supplicant || mkdir /var/run/wpa_supplicant
  echo 'ctrl_interface=/var/run/wpa_supplicant' > /etc/wpa_supplicant.conf
  wpa_supplicant -i$WLAN -B -Dwext -c/etc/wpa_supplicant.conf
}
################################################################################












wpa_supplicant_stop ()
{
  echo -e $RED'stop wpa_supplicant.'$NORMAL
  wpa_cli -i$WLAN terminate
}
################################################################################












run ()
{
  cmd=$1
  echo -ne "$cmd - "`eval $cmd`"\n"
}
################################################################################












wait_connect ()
{
  ix=0
  TRYTIMES=20
  echo -ne "connect "
  while [ $ix -lt $TRYTIMES ]; do
    MSG=`wpa_cli -i$WLAN status | grep -r "wpa_state=COMPLETED"`
    if [ ss"$MSG" == ss"" ]; then
      sleep 1s
      ix=$(($ix+1))
      echo -ne "."
    else
      echo " ok"
      return 0
    fi
  done
  echo " timeout"
  return 1
}
################################################################################












wifi_sta_connect ()
{
  REL=1
  echo -e $RED'prepare connect wifi ap.'$NORMAL
  wpa_cli -i$WLAN disable_network all > /dev/null

  run "wpa_cli -i$WLAN remove_network all"
  ifconfig $WLAN down
  ifconfig $WLAN up

  case "$SECURITY" in
  "WPAPSK" )
    wifi_sta_security_wpa_psk
    REL=$?
  ;;
  "WEP" )
    wifi_sta_security_wep
    REL=$?
  ;;
  "NONE" )
    wifi_sta_security_none
    REL=$?
  ;;
  * )
    echo "Not recognise security mode"
    echo "SECURITY=$SECURITY"
    REL=1
  ;;
  esac

  if [ "$REL" == "1" ]; then
    echo -e $RED'connect wifi ap fail.'$NORMAL
    wpa_cli -i$WLAN status
    wpa_cli -i$WLAN remove_network all >/dev/null 2>&1
    ifconfig $WLAN down
    return 1
  else
    echo -e $RED'connect wifi ap success.'$NORMAL
    wpa_cli -i$WLAN status
    return 0
  fi

}
################################################################################












# no password
wifi_sta_security_none ()
{
  NETWORK_ID=`wpa_cli -i$WLAN add_network`
  run "wpa_cli -i$WLAN set_network $NETWORK_ID ssid '\"$SSID\"'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID key_mgmt NONE"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID scan_ssid 1"
  run "wpa_cli -i$WLAN enable_network $NETWORK_ID"
  wait_connect
  return $?
}
################################################################################












# wep
wifi_sta_security_wep ()
{
  NETWORK_ID=`wpa_cli -i$WLAN add_network`
  run "wpa_cli -i$WLAN set_network $NETWORK_ID ssid '\"$SSID\"'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID key_mgmt NONE"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID scan_ssid 1"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID wep_key0 '$PASSWORD'"
  run "wpa_cli -i$WLAN enable_network $NETWORK_ID"
  wait_connect
  return $?
}
################################################################################












# wpa-psk
wifi_sta_security_wpa_psk ()
{
  NETWORK_ID=`wpa_cli -i$WLAN add_network`
  run "wpa_cli -i$WLAN set_network $NETWORK_ID scan_ssid 1"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID ssid '\"$SSID\"'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID proto 'WPA RSN'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID key_mgmt WPA-PSK"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID pairwise 'CCMP TKIP'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID group 'CCMP TKIP'"
  run "wpa_cli -i$WLAN set_network $NETWORK_ID psk '\"$PASSWORD\"'"
  run "wpa_cli -i$WLAN enable_network $NETWORK_ID"
  wait_connect
  return $?
}
################################################################################













echo "=========================================================="
echo "WLAN     =$WLAN"
echo "SSID     =$SSID"
echo "PASSWORD =$PASSWORD"
echo "SECURITY =$SECURITY"
echo "=========================================================="

wpa_supplicant_start
wifi_sta_connect

davef
You just might be in luck here as I am using a ASUS USB N10 dongle and it
was quite a struggle getting this unit working.

I had to re-compile the kernel (3.7) after ticking the boxes:

Device drivers -->
   Staging -->
      RealTek RT8712U (RTL8192SU) Wireless LAN NIC driver

There were a number of other issues.

All your scripts are not familiar, where do they reside?

Good luck.

davef
The next tricky thing was finding a rtl8712u.bin file that worked, goes in
/lib/firmware/rtlwifi

The one that worked for me was found on the RaspberryPi forum.

davef
http://www.friendlyarm.net/forum/topic/12

At the end

mmao
about use the realtek8192cu  usb wireless card connect the WPA net always
response timeout;
 angboby can hlep me !
 help me !