1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/luci-app-glorytun-udp/root/etc/hotplug.d/iface/30-glorytun-udp

36 lines
1,021 B
Text
Raw Normal View History

2020-12-03 10:23:57 +00:00
#!/bin/sh
#
# Load the glorytun config
#
# Author: Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3 or later
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
. /lib/functions.sh
. /lib/functions/network.sh
set_default() {
2020-12-15 14:43:42 +00:00
local localip
local remoteip
local config="$1"
local iface
config_get enable "$config" enable
config_get iface "$config" dev
[ "$iface" = "$DEVICE" ] && [ "$enable" = "1" ] && {
config_get localip "$config" localip
config_get remoteip "$config" remoteip
config_get kxtimeout "$config" kxtimeout "7d"
config_get timetolerance "$config" timetolerance "10m"
config_get keepalive "$config" keepalive "25s"
[ "$remoteip" != "" ] && [ "$localip" != "" ] && ifconfig $DEVICE $localip pointopoint $remoteip up
while [ -z "$(glorytun-udp list | grep $iface)" ]; do
2020-12-16 09:05:25 +00:00
sleep 1
2020-12-15 14:43:42 +00:00
done
2020-12-16 09:05:25 +00:00
glorytun-udp set dev $iface kxtimeout $kxtimeout timetolerance $timetolerance keepalive $keepalive
2020-12-15 14:43:42 +00:00
}
2020-12-03 10:23:57 +00:00
}
config_load glorytun-udp
config_foreach set_default glorytun-udp