[][Add auto hook toggling for pptp/l2tp]
[Description]
Add a script to automatically enable/disable HNAT hooks
because HNAT cannot support pptp/l2tp protocol.
- when pptp/l2tp interface is up -> disable hnat
- when pptp/l2tp interface is down -> enable hnat
[Release-log]
N/A
Change-Id: Icb0bafc5750522aae921d062334fe18345ba630f
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4731853
diff --git a/target/linux/mediatek/base-files/etc/hotplug.d/iface/98-mtk-vpn b/target/linux/mediatek/base-files/etc/hotplug.d/iface/98-mtk-vpn
new file mode 100644
index 0000000..d169567
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/hotplug.d/iface/98-mtk-vpn
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+proto=`uci -q get network.$INTERFACE.proto`
+
+if [ "$proto" = l2tp ] || [ "$proto" = pptp ]; then
+ if [ "$ACTION" = ifup ]; then
+ echo 0 > /sys/kernel/debug/hnat/hook_toggle
+ elif [ "$ACTION" = ifdown ]; then
+ echo 1 > /sys/kernel/debug/hnat/hook_toggle
+ fi
+fi