WPA_ACTION(8)

πŸ“¦
version 2.11 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– WPA_ACTION πŸ’–

okay bestie, welcome to the wpa_action manual page β€” section 8, system administration tools, iykyk ✨


🌸 NAME 🌸

wpa_action β€” it's the wpa_cli action script. that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

wpa_action IFACE ACTION

πŸ¦‹ DESCRIPTION πŸ¦‹

so wpa_action is a shell script, right? and its whole job is controlling the ifupdown framework based on the ACTION events it gets handed from wpa_supplicant. the way it works is: wpa_cli receives the CONNECTED and DISCONNECTED events from wpa_supplicant through the crtl_iface socket, and then it gives that ACTION event to the wpa_action script as an argument β€” along with the IFACE it's supposed to act upon. iconic teamwork honestly. 🫢

wpa_action also receives an environment variable from wpa_cli called WPA_ID_STR, which holds 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 it gives you a way to map the ACTION to a LOGICAL interface that's configured in the interfaces file. it's giving ✨mapping✨.

if either the ifupdown interfaces file or the ifstate file can't be found, wpa_action will exit silently (status 0). no drama, no error, just gone. πŸ’€

wpa_action will search these locations to check whether they exist:

  • /etc/network/run/ifstate
  • /run/network/ifstate
  • /etc/network/interfaces

πŸŽ€ IFACE πŸŽ€

the network interface that's getting acted upon β€” like 'eth1' or 'wlan0'. simple as that, no cap.


πŸ’… ACTION πŸ’…

an ACTION that gets performed on the IFACE. here's the menu of options, bestie:

CONNECTED

wpa_supplicant has finished authentication, periodt. πŸŽ‰ ifup IFACE=WPA_ID_STR is invoked, and the action gets logged to syslog. network settings for the LOGICAL interface WPA_ID_STR are applied.

DISCONNECTED

wpa_supplicant has detected a disconnection 😭. ifdown IFACE=WPA_ID_STR is invoked, and the action gets logged to syslog. network settings for the LOGICAL interface WPA_ID_STR are undone.

stop

the 'stop' ACTION is 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 . and 'restart' is a synonym for 'reload', so you can use them equally, no favourites here. 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 gets exported to wpa_action as an environment variable, WPA_ID_STR. and when 'id_str' is not configured for the CURRENT network block, 'default' is substituted in for that absent WPA_ID_STR environment variable. the substitute teacher of env vars fr fr.

a unique network identifier, WPA_ID, is also exported to wpa_action. it's the number assigned to the CURRENT wpa_supplicant network block (network_id).


⭐ USAGE ⭐

ngl, the only reasons you'd ever explicitly run wpa_action yourself are to stop wpa_cli from controlling ifupdown, or to reload the wpa_supplicant.conf file after you've edited it. those are the only two.

wpa_action eth1 stop

otherwise, wpa_action gets handed to a wpa_cli daemon as an argument:

wpa_cli -i eth1 -a /usr/sbin/wpa_action -B

and you can do all of this 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, because it's going to 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. and if one or more networks requires additional network configuration, provide a unique 'id_str' for each network, plus an interfaces stanza that uses 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'. look at her go. 🌟

here's 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
}

and 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 πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

this manual page was written by Kel Modderman <kel@otaku42.de> for the Debian GNU system (but may be used by others). we stan. πŸ’œ


okay that's the whole page bestie, you ate it, you understood it, main character energy all around πŸŒˆπŸ’–

this little gem comes from the WPA_ACTION(8) manual, dated 26 May 2006 β€” so yes, she's vintage, she's iconic, and she still runs the ifupdown roost. mwah. πŸ’…βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ«Ά