16 wpa_cli Summaries

V0.0.1

16.1 Histroy

  • 2014-06-16, rayoslee, release V0.0.1

16.2 FAQ

  1. How to use wpa_cli -a?
    • In Ubuntu side
      sudo wpa_cli -iwlan1 -a/home/ray/168_AcSip/wpa_cli_issue/wpa_action.sh &
      sudo wpa_cli -iwlan1
      And enter interactive mode
      list_network to get interface_id
      To trigger wpa-action.sh
      disable_network interface_id to see some events and wpa-action.sh message
      enable_network interface_id to see some events again and wpa-action.sh message
      quit
    • In S605-32 demo kit (only STA mode)
      Almost the same upper case
      ./wpa_cli -p/tmp/wpa_supplicant -a/mnt/nand1-1/wifi/wpa_action.sh -iwlan0 &
      ./wpa_cli -p/tmp/wpa_supplicant -iwlan0

    • In S605-32 demo kit (concurrent with Soft AP and STA mode)
      Almost the same upper case, we can just use p2p_cli instead of wpa_cli because of two sockets definition.
      p2p_cli -p/tmp/wpa_supplicant -a/mnt/nand1-1/wifi/wpa_action.sh -iwlan0 &
      p2p_cli -p/tmp/wpa_supplicant -iwlan0

  2. About wpa_action.sh, this is a example to show the status in changed network.

    #!/bin/sh or #!/bin/bash
    
    #S605=DISABLE
    
    Time=`date`
    echo "rayos: GO======$Time===================" 
    echo "rayos: GO======$Time===================" > wpa.log
    IFNAME=$1
    CMD=$2
    echo "rayos: ========$IFNAME, $CMD==========="
    echo "rayos: ========$IFNAME, $CMD===========" >> wpa.log
    echo "rayos: ========$Time============="
    echo "rayos: ========$Time=============" >> wpa.log
    if [ "$S605" == "DISABLE" ]; then
       SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
       sleep 3
       ADDR=`wpa_cli -i$IFNAME status | grep ^ip_address= | cut -f2- -d=`
    else
       SSID=`./wpa_cli -p/tmp/wpa_supplicant -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
       sleep 3
       ADDR=`./wpa_cli -p/tmp/wpa_supplicant -i$IFNAME status | grep ^ip_address= | cut -f2- -d=`   
    fi
    echo "rayos: ========$SSID============="
    echo "rayos: ========$ADDR============="
    Time2=`date`
    echo -e "rayos: DONE========$Time2======\n"
  3. How to build wpa_supplicant in embedded linux (0.6.10 or 0.7.3)?
    • Download it and cp defconfig .config and modify it
      # Example configuration for various cross-compilation platforms

      #### sveasoft (e.g., for Linksys WRT54G) ######################################
      #CC=mipsel-uclibc-gcc
      ### 20140226, rayoslee@acsip, modify my CC and L
      CC=/usr/local/arm_linux_4.2/bin/arm-linux-gcc -L../../OPENSSL/lib.out/openssl/lib
      #rayoslee
      #CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
      #CFLAGS += -Os
      #CPPFLAGS += -I../src/include -I../../src/router/openssl/include
      #LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
      ###############################################################################

      ….
      # Select TLS implementation
      # openssl = OpenSSL (default)
      # gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
      # internal = Internal TLSv1 implementation (experimental)
      # none = Empty template
      CONFIG_TLS=internal

      ….
      # If CONFIG_TLS=internal is used, additional library and include paths are
      # needed for LibTomMath. Alternatively, an integrated, minimal version of
      # LibTomMath can be used. See beginning of libtommath.c for details on benefits
      # and drawbacks of this option.

      CONFIG_INTERNAL_LIBTOMMATH=y
      #ifndef CONFIG_INTERNAL_LIBTOMMATH

      [options]
      # Driver interface for Host AP driver
      #CONFIG_DRIVER_HOSTAP=y
      # Driver interface for Atmel driver
      #CONFIG_DRIVER_ATMEL=y
      # Driver interface for wired Ethernet drivers
      #CONFIG_DRIVER_WIRED=y
      # EAP-FAST
      # Note: Default OpenSSL package does not include support for all the
      # functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
      # the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
      # to add the needed functions.
      CONFIG_EAP_FAST=y
      # Wi-Fi Protected Setup (WPS)
      CONFIG_WPS=y
      CONFIG_EAP_WPS=y

      ifndef CONFIG_INTERNAL_LIBTOMMATH
      #LTM_PATH=/usr/src/libtommath-0.39
      #20140226, rayoslee@acsip, modify LibTomMath path
      LTM_PATH=../../OPENSSL/lib.out
      #rayoslee
      CFLAGS += -I$(LTM_PATH)
      LIBS += -L$(LTM_PATH)
      LIBS_p += -L$(LTM_PATH)
      endif

    • Modify Makefile
      ifndef CC
      #CC=gcc
      #20140226, rayoslee@acsip
      CC=/usr/local/arm_linux_4.2/bin/arm-linux-gcc -L../../OPENSSL/lib.out/openssl/lib/
      #rayoslee

      endif

      ….
      ifndef CONFIG_ELOOP
      CONFIG_ELOOP=eloop
      endif
      OBJS += ../src/utils/$(CONFIG_ELOOP).o
      #20140615, rayoslee
      ifdef CONFIG_WAPI_SUPPORT
      CFLAGS += -DCONFIG_WAPI_SUPPORT
      endif
      #rayos

    • To make it, to get wpa_supplicant and wpa_cli.