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

Johan Almbladh ja at anyfi.net
Thu Nov 20 12:14:46 EST 2014


Thanks for the ubus pointers, Bastian. That should solve it :)

Johan




On Mon, Nov 17, 2014 at 10:34 AM, Bastian Bittorf <bittorf at bluebottle.com>
wrote:

> * 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20141120/40329452/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list