[OpenWrt-Devel] Hooks on wifi up/down for starting/stopping dependent functionality?

Bastian Bittorf bittorf at bluebottle.com
Mon Nov 17 04:34:25 EST 2014

* Johan Almbladh <ja at anyfi.net> [17.11.2014 10:22]:
> The hotplug scripts receive events for interface names, but they know
> nothing about the underlying configuration. Is there any way to map a WLAN
> interface name, e.g. wlan0, to the corresponding UCI config entry in
> /etc/config/wireless?

/sbin/hotplug-call exports some global shell-vars, which you
can use in your script, e.g.:

ACTION - e.g. 'ifup'
INTERFACE - e.g. 'mywan'
DEVICE - e.g. eth0.2

if you need some more, you can query them in your
script with e.g.

ubus call network.interface.mywan status

you can parse the JSON with e.g.

. /usr/share/libubox/jshn.sh
OUT="$( ubus call network.interface.mywan status )"
eval $( jshn -r "$OUT" )
echo $JSON_VAR_status

bye, bastian
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list