diff --git a/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn b/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn index 201c4c226..bb4dbf559 100755 --- a/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn +++ b/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn @@ -74,11 +74,18 @@ if [ "$(uci -q get dsvpn.vpn)" = "" ]; then set dsvpn.vpn.port=65011 set dsvpn.vpn.localip=10.255.251.2 set dsvpn.vpn.remoteip=10.255.251.1 + set dsvpn.vpn.mode=client set dsvpn.vpn.enable=0 commit dsvpn EOF fi +if [ "$(uci -q get dsvpn.vpn.mode)" = "" ]; then + uci -q batch <<-EOF >/dev/null + set dsvpn.vpn.mode=client + commit dsvpn + EOF +fi if [ "$(uci -q show firewall | grep omrvpn)" = "" ]; then uci -q batch <<-EOF >/dev/null @@ -100,6 +107,12 @@ if [ "$(uci -q get ucitrack.@network[-1].affects | grep glorytun)" = "" ]; then commit ucitrack EOF fi +if [ "$(uci -q get ucitrack.@network[-1].affects | grep glorytun-udp)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add_list ucitrack.@network[-1].affects="glorytun-udp" + commit ucitrack + EOF +fi if [ "$(uci -q get ucitrack.@network[-1].affects | grep dsvpn)" = "" ]; then uci -q batch <<-EOF >/dev/null add_list ucitrack.@network[-1].affects="dsvpn" @@ -112,6 +125,28 @@ if [ "$(uci -q get ucitrack.@glorytun[-1].affects | grep openmptcprouter-vps)" = commit ucitrack EOF fi +if [ "$(uci -q get ucitrack.@glorytun-udp[-1].affects | grep openmptcprouter-vps)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add_list ucitrack.@glorytun-udp[-1].affects="openmptcprouter-vps" + commit ucitrack + EOF +fi + +if [ "$(uci -q get glorytun-udp.vpn.key)" = "" ] && [ "$(uci -q get glorytun.vpn.key)" != "" ]; then + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.key=$(uci -q get glorytun.vpn.key) + set glorytun-udp.vpn.host=$(uci -q get glorytun.vpn.host) + EOF + if [ "$(uci -q get glorytun-udp.vpn.proto)" = "udp" ]; then + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.enable=1 + set glorytun.vpn.enable=0 + commit glorytun + EOF + fi + uci -q commit glorytun-udp +fi + rm -f /tmp/luci-indexcache