Hi all,
I've written a sniffing application that captures probe request and send them via MQTT to some broker using libpcap and paho-mqtt3cs.
I would like to add some proactive verification to guarantee it's operation. If some process call (like adding new SSID on radio0 using luci) makes my monitor interface goes down I would like some daemon for restarting the application automatically a few seconds later.
Is it possible to achieve this with hotplug/iface scripts by setting my monitor interface name on DEVICE or IFACE? I'd like some directions towards debugging my scripts on the hotplug.d folder as well
Yes, I'd trigger on up/down of your monitor interface.
First would be to write a script that logs the events that you get and their environment so that you understand how the events occur and what you can trigger off of. >> /tmp/some/log/file
For debugging, you can use "printf debugging" or set -x or the like to track the execution.
hey @jeff
Based on the doc page for hotplug the events being triggered at the iface are ifup/ifdown and my monitor interface event on dmesg is device mon0 left promiscuous mode. I tried to echo a message to /tmp/log/mylog without success, i've also tried to change the iface, action and devices to trigger in events on eth0, lan and none seem to trigger my script.
#!bin/sh
if [ "$ACTION" = "ifdown" ] && [ "$DEVICE" = "mon0" ]; then
echo "Device: $DEVICE went Action: $ACTION" >> /tmp/log/mylog
fi
I placed under /etc/hotplug.d/iface and save as 99-my-script and add the +x flag using chmod.
am I failing to trigger the event for the hotplug execute its commands or am I making a mistake on the script?
To add to my initial question, how do I guarantee that my hotplug script run when it should?
As per the manual ar150 has to be set up via WiFi. If you get into serial console and turn off WiFi (ifconfig wlan0 down) router restarts the interface automatically after 10 15 seconds. Don’t know if the behavior stops after first set up or not