Wpa_supplicant Transplantation and use

Source: Internet
Author: User
Tags openssl openssl library

porting wpa_supplicant to Arm6410+linux platform Knowledge Points: (1) Iwconfig native only supports WEP encryption, and most routers now use WPA encryption, Therefore, the use of iwconfig cannot be connected to the router AP regardless of the settings, unless the router has WEP encryption set or no password is set. (2) "Iwconfig wlan0 key XXXX" To set up the connection password, XXXX indicates WEP string "Iwconfig wlan0 key S:xxxx" To set the connection password, XXXX represents the clear password of WEP (XXXX does not mean only four characters)

Because today's wireless WiFi network is mostly WPA encryption. So you need to transplant the Wpa_supplicant tool.
First, download the source code
http://hostap.epitest.fi/wpa_supplicant/

Download wpa_supplicant-0.7.3.tar.gz (OpenSSL to use 0.7.3 provided patch)
#tar XVFZ wpa_supplicant-0.7.3.tar.gz
Download www.openssl.org/source/openssl-0.9.8e.tar.gz
#tar ZXVF openssl-0.9.8e.tar.gz

Second, compile OpenSSL library
Copy the patches in the wpa_supplicant to the OpenSSL
# CP Wpa_supplicant-0.7.3/patches/openssl-0.9.8e-tls-extensions.patch openssl-0.9.8e/
#cd openssl-0.9.8e
#mkdir/usr/local/ssl
#vim Makefile
Cc= ARM-LINUX-GCC
Ar= Arm-linux-ar $ (arflags) R
ranlib= Arm-linux-ranlib
Installtop=/usr/local/ssl
Openssldir=/usr/local/ssl
#make
#make Install

SSL libraries are installed in the/usr/local/ssl directory
#ls/usr/local/ssl
#bin Certs include Lib man misc openssl.cnf private

Later compile wpa_supplicant to rely on Lib and include in OpenSSL

Third, compile Wpa_supplicant
Enter wpa_supplicant-0.7.3.tar.gz decompression generated wpa_supplicant-0.7.3/wpa_supplicant directory:
#cp defconfig. config
#vim. config
Cc= arm-linux-gnu-gcc-l/usr/local/ssl/lib/
Cflags + +-i/usr/local/ssl/include/
LIBS + +-l/usr/local/ssl/lib/
#make

The compiled Wpa_supplicant source program can see two main executable tools: Wpa_supplicant and WPA_CLI. Wpa_supplicant is the core program, its relationship with WPA_CLI is the relationship between service and client: Run Wpa_supplicant in the background, use WPA_CLI to search, set up, and connect to the network.

Iv. Configuration of Wpa_supplicant
(1) First copy wpa_supplicant and wpa-psk-tkip.conf to the Development Board root file system, and rename wpa-psk-tkip.conf to wpa_supplicant.conf

#cp Wpa_supplicant/rootfs/filesystem/bin
#cp wpa_supplicant-0.7.3/wpa_supplicant/examples/wpa-psk-tkip.conf/rootfs/filesystem/etc/wpa_supplicant.conf

(2) Modify the wpa_supplicant.conf configuration file
#vim/rootfs/filesystem/etc/wpa_supplicant.conf

The amendment reads as follows:

# Wpa-psk/tkip

Ctrl_interface=/var/run/wpa_supplicant

network={
Ssid= "FS2410"//user name to fill out the wireless network
Key_mgmt=wpa-psk
Proto=wpa
Pairwise=tkip
Group=tkip
psk= "1234567890"//fill in the password
}

Five, test
(1) In the Development Board terminal:

#mkdir –p/var/run/wpa_supplicant

(2) Write driver load script
#vim load.sh (I put it in the root file system/sdio directory, which reads as follows:)


#!/bin/sh
Cd/sdio
Insmod Libertas.ko
Insmod Libertas_sdio.ko Helper_name=/lib/firmware/mrvl/helper_sd.bin Fw_name=/lib/firmware/mrvl/sd8686.bin


and modify load.sh permissions: chmod 777 load.sh

(3) Load driver
In the Development Board terminal into the/sdio directory, execute./load.sh Load Driver
#cd/sdio
#./load.sh
Driver Load Completion prompts: (if not, then hot plug in your Sdio WiFi card will be visible)
Libertas_sdio:libertas Sdio Driver
Libertas_sdio:copyright Pierre Ossman
LIBERTAS:00:0B:6C:89:62:4B, FW 9.70.3p23, Cap 0x00000303
Libertas:unidentified region code; Using the default (USA)
Libertas:wlan0:Marvell WLAN 802.11 adapter


Ifconfig-a See if you want to create the Wlan0 node.
assigning IP addresses:
#ifconfig wlan0 192.168.1.5//can also dynamically allocate dhclient wlan0 but you have to migrate DHCP.

(4) Create a connection secret password (PSK password), through the plaintext conversion
#cd/etc
#wpa_passphrase FS2410 1234567890 >> wpa_supplicant.conf
This will be generated in the wpa_supplicant.conf file:
network={
Ssid= "FS2410"
#psk = "1234567890"
Psk=4b2bc7cbb3710e9ea43f09e8d57e8bdb3b2a2127af44960d73216c3612f6baba
}

(5) then modify the wpa_supplicant.conf configuration file, the psk= "1234567890" line of the plaintext password to the generated ciphertext password, namely:
Psk=4b2bc7cbb3710e9ea43f09e8d57e8bdb3b2a2127af44960d73216c3612f6baba
Other generated redundant information is deleted, and the final wpa_supplicant.conf file is as follows:


# Wpa-psk/tkip
Ctrl_interface=/var/run/wpa_supplicant

network={
           ssid= "FS2410"      //Fill in the user name of the wireless network
           KEY_MGMT=WPA-PSK
            PROTO=WPA
            Pairwise=tkip
           group=tkip         
            Psk=4b2bc7cbb3710e9ea43f09e8d57e8bdb3b2a2127af44960d73216c3612f6baba
}
 

(6) Connect AP
Entering Wpa_supplicant carriage return at the Development Board terminal displays help information, and finally a:
Example
Wpa_supplicant-dwext-iwlan0-c/etc/wpa_supplicant.conf (can add-B to make the program run in the background,-dwext seem to be able to do not)
Copy example Usage, execute:
# wpa_supplicant-dwext-iwlan0-c/etc/wpa_supplicant.conf & (need to keep running in the background)
Printing information is:
Trying to associate with 00:26:f2:0d:5a:c4 (ssid= ' FS2410 ' freq=2412)
Associated with 00:23:68:28:4E:A8
ctrl-event-disconnected bssid=00:23:68:28:4e:a8 reason=0
Associated with 00:26:F2:0D:5A:C4
Wpa:key negotiation completed with 00:26:F2:0D:5A:C4 [Ptk=tkip Gtk=tkip]
Ctrl-event-connected-connection to 00:26:f2:0d:5a:c4 completed (auth) [Id=0 id_str=]
......
Ping the gateway again and connect successfully:
#ping 192.168.1.1

3 Packets transmitted, 3 packets received, 0% packet loss
Round-trip Min/avg/max = 17.627/20.023/24.631 ms
......

Wireless network card Connection Successful!

Attention:

(1) After the use of Wpa_supplicant-b-dwext-iwlan0-c/etc/wpa_supplicant.conf run, may appear

Ioctl[siocsiwap]: Operation not permitted

IOCTL[SIOCSIWESSID]: Operation not permitted

Seems to mean that the AP failed to connect, but after my test, the wireless card is a normal connection to the AP, so see the above output do not assume that the connection failed.

(2) Let the wireless network card automatically obtain the IP method:

Udhcpc-i Wlan0//Note, don't forget to add-I.

(3) If the original Development Board has a 192.168.1.X network segment of the wired network card, and the wireless AP connected to the router's IP is also 192.168.1.X network segment, then the network is still disconnected after the connection, at this time need to reset the wired network card IP or use ipconfig eth0 Down to disable the NIC.

(4) The above tests are carried by a friendly Rtl8192cu.ko drive, which is usually located under the/lib/module/2.6.38-friendlyarm/extra/directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.