newbie questions about wpa_supplicant

Jouni Malinen jkmaline at
Sat Nov 12 11:46:22 EST 2005

On Fri, Nov 11, 2005 at 03:52:33PM -0800, Osho GG wrote:

> My question concerns regarding starting of dhcpcd. Everytime I have to
> manually start the dhcpcd once wpa_supplicant establishes the connection
> with the Access point. Is there a way wpa_supplicant can do it
> automatically?

Yes, or well, to be more exact, wpa_supplicant can be used to generate
an event when network connection is established and an external program
would be used to do whatever network configuration is needed. I believe
some Linux distributions have already done this kind of integration.

I added following description into the README file on how to do this
with wpa_cli:

wpa_cli can used to run external programs whenever wpa_supplicant
connects or disconnects from a network. This can be used, e.g., to
update network configuration and/or trigget DHCP client to update IP
addresses, etc.

One wpa_cli process in "action" mode needs to be started for each
interface. For example, the following command starts wpa_cli for the
default ingterface (-i can be used to select the interface in case of
more than one interface being used at the same time):

wpa_cli -a/sbin/ -B

The action file (-a option, /sbin/ in this example) will
be executed whenever wpa_supplicant completes authentication (connect
event) or detects disconnection). The action script will be called
with two command line arguments: interface name and event (CONNECTED
or DISCONNECTED). If the action script needs to get more information
about the current network, it can use 'wpa_cli status' to query
wpa_supplicant for more information.

Following example can be used as a simple template for an action



if [ "$CMD" == "CONNECTED" ]; then
    SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
    # configure network, signal DHCP client, etc.

if [ "$CMD" == "DISCONNECTED" ]; then
    # remove network configuration, if needed

> My other question is can wpa_supplicant handle wired interfaces?

Yes, driver_wired.c (-Dwired on command line) can be used to
authenticate wired interfaces with IEEE 802.1X. Example from README:

6) Authentication for wired Ethernet. This can be used with 'wired'
   (-Dwired on command line).


Jouni Malinen                                            PGP id EFC895FA

More information about the HostAP mailing list