Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Supplicant in Linux

lock attach
Attachments are accessible only for community members.

Supplicant in Linux

PrasanthR_06
Employee
Employee
First comment on KBA 5 questions asked First question asked

The objective of this post is to install wpa_supplicant on the ARM target running Linux.

Introduction

wpa_supplicant is a WPA Supplicant for Linux, BSD, Mac OS X, and Windows with support for WPA and WPA2 (IEEE 802.11i / RSN). It is suitable for both desktop/laptop computers and embedded systems. Supplicant is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.

wpa_supplicant is designed to be a "daemon" program that runs in the background and acts as the backend component controlling the wireless connection. wpa_supplicant supports separate front-end programs and a text-based front-end (wpa_cli) and a GUI (wpa_gui) are included with wpa_supplicant. wpa_supplicant uses a flexible build configuration that can be used to select which features shall be included and that allows to generate minimal code size binary.

Refer to WPA_Supplicant page for more information on the features supported. Also, refer to the attached developer's document on Supplicant and Hostapd which might be a helpful reference.

Dependencies

The following dependent libraries need to be installed on the target in order to run HostApd.

  • Libnl
  • OpenSSL

The installation steps for Libnl and OpenSSL is same as written for Hostapd. Check this blog to setup the dependencies before proceeding to the following section.

Install wpa_supplicant sources

Host commands

   1. Download the wpa_supplicant open-source package. Extract the file and go to root folder of the package.

$ wget http://hostap.epitest.fi/releases/wpa_supplicant-2.6.tar.gz

$ tar -xzf wpa_supplicant-2.6.tar.gz

$ cd wpa_supplicant-2.6/wpa_supplicant

   2. Copy the existing "defconfig" file to ".config". Edit the .config as shown below.

$ cp defconfig .config

$ vi .config

Now edit .config and make sure to set the following:

CONFIG_DRIVER_NL80211=y

CFLAGS += -I/usr/include/libnl3

CONFIG_LIBNL32=y

   3. Export the "pkgconfig" location.

       $ export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig

   4. Cross-compile the sources and install the binaries to destination folder.

$ make CC=arm-linux-gnueabi-gcc

$ make install DESTDIR=<target_rootfs>

Start the WPA_Supplicant

  • wpa_supplicant runs as a daemon and requires a configuration file. Create a file called /etc/wpa_supplicant.conf with the following contents:

Secured networkOpen network

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

update_config=1

ap_scan=1

network={

ssid="MySSID"

key_mgmt=WPA-PSK

proto=RSN

pairwise=CCMP TKIP

psk="MyPassPhrase"

}

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

update_config=1

ap_scan=1

network={

        ssid="MySSID"

        key_mgmt=NONE

}

$ lsmod

Module                  Size  Used by

brcmfmac              209662  0

brcmutil                8504  1 brcmfmac

cfg80211              236740  1 brcmfmac

compat                  2028  2 brcmfmac,cfg80211

  • Start the supplicant to run in background. Basically the below command takes driver(nl80211), interface(wlan0), configuration file(/etc/wpa_supplicant).

$ wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B

Attachments
5518 Views
Comments
Anonymous
Not applicable

Any reason to stick to the 2.2 version of wpa_supplicant, which is from 2014?

PrasanthR_06
Employee
Employee
First comment on KBA 5 questions asked First question asked

You can also take the latest version of wpa_supplicant and follow the steps.

PrasanthR_06
Employee
Employee
First comment on KBA 5 questions asked First question asked

Updated the blog taking latest version.

Contributors