small-package/luci-app-bypass/root/etc/hotplug.d/iface/21-bypass

16 lines
528 B
Bash
Executable File

#!/bin/sh
if [ "$ACTION" = ifup -a "$INTERFACE" != wan_6 ];then
if uci -q get bypass.@global[0].global_server >/dev/null;then
if ipset list bypass_all >/dev/null 2>&1;then
ipset -F bypass_all
for i in $(ip -4 add show | grep -v $(uci -qP /tmp/state get network.wan.ifname || echo 127.0.0.1) | grep inet | grep -v 127.0.0.1 | awk '{print$2}');do
ipset -! add bypass_all $i
done
fi
if pidof smartdns >/dev/null;then
killall -q -9 smartdns
$(which smartdns) -c /var/etc/smartdns/smartdns.conf
fi
fi
fi