WiFi Tool Transplant Wap_supplicant

Source: Internet
Author: User
Tags ftp openssl openssl lib
Welcome Reprint ~~~~~~ http://www.linuxfromscratch.org/blfs/view/svn/basicnet/wpa_supplicant.html can refer to this document
Note: Different opensll and LIBNL and wpa_supplicant may cause some problems)
Problem set:
First error: The wpa_supplicant selected here is the latest version 4.0
/# Wpa_supplicant-b-c/etc/wpa_wpa2.conf-iwlan0
Successfully initialized Wpa_supplicant
Nl80211:deinit Ifname=wlan0 disabled_11b_rates=0
Wlan0:failed to initialize driver interface
The second type of error:
/# Wpa_supplicant-b-c/etc/wpa_wpa2.conf-iwlan0//can be connected to the Internet normally
/# Wpa_cli-iwlan0 Status//And this has always produced such errors
Failed to connect to Non-global Ctrl_ifname:wlan0 Error:connection refused
The above two errors, during these days of torture, the configuration of the kernel and the Wi-Fi drive repeatedly modified still have no effect.
Finally, this problem is solved by constantly porting different versions of OPENSLL and Libnlwap_supplicant. (For specific reasons not clear)
Have to know how to modify the specific problem, please make sure to leave a message to publish.


It is recommended that you use:
The first type: libnl-3.2.23 openssl-1.0.1d wpa_supplicant-2.0
The second kind: libnl-3.2.25 openssl-1.0.2c wpa_supplicant-2.0
1, Wap_supplicant introduction

When we ported the IW tool to Linux, we talked about how IW supports two "authentication/Encryption" methods: Open and WEP, respectively. However, many wireless encryption methods are now encrypted in WPA and WPA2 (AES) mode. So here comes the IW tool can no longer be used with WPA and WPA2 Wireless encryption.

So the next step is to transplant a wpa_supplicant tool: This tool supports the four ways described above:

1.1. Open

1.2. WEP

1.3. WPA (TKJP)

1.4, WAP2 (AES)

2. Transplant Wpa_supplicant Tools

2.1, before the transplant, we first need to transplant Libopenssl library

2.1. Download in ftp://ftp.openssl.org/snapshot/

Openssl-1.0.2-stable-snap-20150630.tar.gz

2.2. Decompression OpenSSL

#tar Xzf openssl-1.0.2-stable-snap-20150630.tar.gz

#cd openssl-1.0.2-stable-snap-20150630/

#./config shared no-asm--prefix= $PWD/tmp

2.3. Modify the makefile to use the cross compiler

Modify Makefile:

Cc= ARM-LINUX-GCC

Ar= Arm-linux-ar $ (arflags) R

ranlib= Arm-linux-ranlib

Nm= arm-linux-nm

makedepprog= ARM-LINUX-GCC

2.4. Recompile OpenSSL

[root@localhost openssl-1.0.2-stable-snap-20150630]# make
making all in crypto ...
Make[1]: Entering directory '/work/a9_board/wifitools/sta/tools/openssl-1.0.2-stable-snap-20150630/crypto '
/usr/bin/perl. /util/mkbuildinf.pl "Arm-linux-gcc-i-I.. -I.. /include  -fpic-dopenssl_pic-dopenssl_threads-d_reentrant-ddso_dlfcn-dhave_dlfcn_h-march=pentium-dl_endian -o3-fomit-frame-pointer-wall "Linux-elf" >buildinf.h
Arm-linux-gcc-i.-I.. /include  -fpic-dopenssl_pic-dopenssl_threads-d_reentrant-ddso_dlfcn-dhave_dlfcn_h-march=pentium-dl_endian -o3-fomit-frame-pointer-wall  -c-o cversion.o cversion.c
Cversion.c:1:0:error:bad value (Pentium) For-march = Switch
Make[1]: * * [CVERSION.O] Error 1
make[1]: Leaving directory '/work/a9_board/wifitools/sta/tools/openssl-1 .0.2-stable-snap-20150630/crypto '
Make: * * [Build_crypto] Error 1
[root@localhost openssl-1.0.2-stable-snap-20150630]#    

Workaround: Remove "-march=pentium" from cflag= in makefile

3. Transplant Wpa_supplicant

3.1. Download wpa_supplicant-2.0.tar.gz

3.2. Decompression

#tar Xzf wpa_supplicant-2.0.tar.gz

3.3. Configuration

#cd wpa_supplicant-2.0/wpa_supplicant/

#cp defconfig. config

3.3.1, modify the. config file, specify the cross compiler with OpenSSL and Libn's library with header file path

cc=arm-linux-gcc
# # # Add LIBNL include
CFLAGS + =-i/work/a9_board/wifitools/sta/tools/libnl-3.2.24/tmp/include/libnl3
# # # Add LIBNL Lib
-LIB + =-l/work/a9_board/wifitools/sta/tools/libnl-3.2.24/tmp/lib-lnl-3-lnl-genl-3
# Add OpenSSL include
Wuyi CFLAGS + =-i/work/a9_board/wifitools/sta/tools/openssl-1.0.2-stable-snap-20150630/tmp/in clude
# Add OpenSSL Lib
+ LIB + =-l/work/a9_board/wifitools/sta/tools/openssl-1.0.2-stable-snap-20150630/tmp/lib-lssl-lcrypto
[Root@localhost wpa_supplicant]# make

3.3.2, compiling and installing

[Root@localhost wpa_supplicant]# make destdir= $PWD/tmp Install

3.4, the use of wpa_supplicant on ARM (WPA2 mode)

The 3.4.1, Wpa_supplicant contains two main executable tools:

Wpa_supplicant and WPA_CLI. The relationship between Wpa_supplicant and Wpa_cli is the relationship between the server and the client. When in use: Run Wpa_supplicant in the background and use WPA_CLI to search, set up, and link to the network.

3.4.2 configuration file with configuration WPA2 mode

/etc/wpa_wpa2.conf in the Development Board file system

Ctrl_interface=/var/run/wpa_supplicant

network={

Ssid= "zxl407"

Psk= "1 2 3 4a"

}

3.4.3, turn on wpa_supplicant make it link on router, configure, ping

Myroot/# wpa_supplicant-b-c/etc/wpa_wpa2.conf-iwlan0

Myroot/# wpa_cli-iwlan0 Status

Myroot/# ifconfig wlan0 192.168.1.234

Myroot/# Ping 192.168.1.1

PING 192.168.1.1 (192.168.1.1): Data bytes

Bytes from 192.168.1.1:seq=0 ttl=64 time=5593.111 ms

Bytes from 192.168.1.1:seq=2 ttl=64 time=3592.853 ms

Bytes from 192.168.1.1:seq=3 ttl=64 time=2592.651 ms

Bytes from 192.168.1.1:seq=4 ttl=64 time=2614.203 ms

Bytes from 192.168.1.1:seq=5 ttl=64 time=1614.140 ms

^c

---192.168.1.1 ping statistics---

Packets transmitted, 5 packets received, 58% packet loss

Round-trip Min/avg/max = 1614.140/3201.391/5593.111 ms

3.4.4, testing whether to access the extranet

Myroot/# Ping www.baidu.com

Ping:bad address ' www.baidu.com '

Ping Baidu, there is an incorrect address. Need to add/etc/resolv.conf add DNS

Myroot # vi/etc/resolv.conf

Nameserver 192.168.1.1

Next, you have to configure the gateway to use the route to see

Myroot/# Route

Kernel IP Routing Table

Destination Gateway genmask Flags Metric Ref use Iface

Default 192.168.1.1 0.0.0.0 UG 0 0 0 Wlan0

Default 192.168.18.1 0.0.0.0 UG 0 0 0 eth0

192.168.1.0 * 255.255.255.0 U 0 0 0 Wlan0

192.168.18.0 * 255.255.255.0 U 0 0 0 eth0

From the above, Wlan0 's gateway has been set, if not set, you can use the following command to add a gateway:

Myroot/# route add default GW 192.168.1.1 Dev Wlan0

Myroot/# Ping www.baidu.com

PING www.baidu.com (180.97.33.107): Data bytes

Bytes from 180.97.33.107:seq=0 ttl=54 time=897.973 ms

Bytes from 180.97.33.107:seq=1 ttl=54 time=888.785 ms

Bytes from 180.97.33.107:seq=2 ttl=54 time=253.869 ms

Bytes from 180.97.33.107:seq=3 ttl=54 time=966.799 ms

Bytes from 180.97.33.107:seq=4 ttl=54 time=182.072 ms

At this point Usbwifi is able to connect to the extranet.









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.