---
name: "wpa_action"
section: "8"
platform: "linux"
package: "wpasupplicant"
version: "2:2.10-24"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wpa_action"
---

# wpa\_action(8)

wpa\_cli action script

## NAME

wpa\_action - wpa\_cli action script

## SYNOPSIS

**wpa\_action** *IFACE ACTION*

## DESCRIPTION

**wpa\_action** is a shell script designed to control the **ifupdown** framework according to *ACTION* events received from **wpa\_supplicant**. **wpa\_cli** receives *CONNECTED* and *DISCONNECTED* events from **wpa\_supplicant** via the crtl\_iface socket and gives the *ACTION* event to the **wpa\_action** script as an argument, along with the *IFACE* to be acted upon.

**wpa\_action** also receives an environment variable from **wpa\_cli**, *WPA\_ID\_STR*, containing an alphanumeric identification string for the *CURRENT* network block. *WPA\_ID\_STR* is provided by the 'id\_str' network block option of **wpa\_supplicant.conf**, and provides a means to map the *ACTION* to a *LOGICAL* interface configured in the **interfaces** file.

If either the ifupdown **interfaces** or *ifstate* file cannot be found, **wpa\_action** will exit silently (status 0). **wpa\_action** will search the following locations for their existence:

```
	/etc/network/run/ifstate
	/run/network/ifstate
	/etc/network/interfaces
```

## IFACE

Network interface to be acted upon, for example 'eth1' or 'wlan0'.

## ACTION

An *ACTION* to be performed on the *IFACE*.

- **CONNECTED**

  **wpa\_supplicant** has completed authentication. **ifup** *IFACE=WPA\_ID\_STR* is invoked and the action is logged to syslog. Network settings for the *LOGICAL* interface *WPA\_ID\_STR* are applied.

- **DISCONNECTED**

  **wpa\_supplicant** has detected disconnection. **ifdown** *IFACE=WPA\_ID\_STR* is invoked and the action is logged to syslog. Network settings for the *LOGICAL* interface *WPA\_ID\_STR* are undone.

- **stop**

  The 'stop' *ACTION* is a called manually by the user, to stop the  **wpa\_cli** daemon, invoke **ifdown** *IFACE* (if the *IFACE* is present in the *ifstate* file) and stop the **wpa\_supplicant** daemon.

- **reload**

  The 'reload' *ACTION* can be used to reload the **wpa\_supplicant** configuration file specified by *wpa-roam* . 'restart' is a synonym  for 'reload' and can be used equally. The action is logged to */var/log/wpa\_action.log*.

## ENVIRONMENT

An alphanumeric identification string provided by the 'id\_str' network block option of **wpa\_supplicant.conf** is exported to **wpa\_action** as an  environment variable, *WPA\_ID\_STR*. When 'id\_str' is not configured for the *CURRENT* network block, 'default' is substituted for the absent *WPA\_ID\_STR* environment variable.

A unique network identifier, *WPA\_ID*, is exported to **wpa\_action**. It is the number assigned to the *CURRENT* **wpa\_supplicant** network block (network\_id).

## USAGE

The only reasons for **wpa\_action** to be explicitly executed by the user is to stop **wpa\_cli** from controlling **ifupdown** or reload the  *wpa\_supplicant.conf* file after editing.

**wpa\_action** *eth1 stop*

Otherwise, **wpa\_action** is given as an argument to a **wpa\_cli** daemon.

**wpa\_cli** *-i eth1 -a /usr/sbin/wpa\_action -B*

This can be done by using the *wpa-roam* option in the **interfaces** file. *wpa-roam* takes one argument, a user provided  **wpa\_supplicant.conf** file.

The inet *METHOD* must be 'manual' for this interface, as it will be configured according to **wpa\_cli** action events. Also supply a 'default' **interfaces** stanza using the dhcp inet *METHOD* so that networks without an 'id\_str' option can fallback to attempting to receive an ip via dhcp. If one or more networks requires additional network configuration, provide an unique 'id\_str' for each network, and an **interfaces** stanza using the 'id\_str' value as a *LOGICAL* interface. The following interfaces file is configured to use dhcp for any network without an 'id\_str', a static ip for the network with an 'id\_str' of 'home\_static' and dhcp plus an additional post-up command for the network with an 'id\_str' of 'uni'.

An example wpa\_supplicant.conf configured to roam between 3 different networks:

```
network={
	ssid="foo"
	id_str="uni"
	key_mgmt=NONE
}
network={
	ssid="bar"
	id_str="home_static"
	psk=123456789...
}
network={
	ssid=""
	key_mgmt=NONE
}
```

The corresponding **interfaces** file would contain *LOGICAL* interfaces, that correlate to each unique 'id\_str' provided by the configuration file:

```
iface eth1 inet manual
	wpa-driver wext
	wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
iface uni inet dhcp
iface home_static inet static
        address 192.168.0.20
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
```

## SEE ALSO

**[wpa\_cli(8)](/wpa_cli/8.md)**, **[wpa\_supplicant(8)](/wpa_supplicant/8.md)**, **[wpa\_supplicant.conf(5)](/wpa_supplicant.conf/5.md)**, **[ifup(8)](/ifup/8.md)**, **[interfaces(5)](/interfaces/5.md)**

## AUTHOR

This manual page was written by Kel Modderman \<kel@otaku42.de\> for the Debian GNU system (but may be used by others).
