1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Fix when VPS API doesn't answer

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-09-02 10:08:06 +02:00
parent 8f499e9f2f
commit df4708ee92

View file

@ -218,7 +218,7 @@ _get_vps_config() {
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.client_ip')"
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.host_ip')"
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ]; then
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ] && [ "$port" != "" ]; then
uci -q batch <<-EOF >/dev/null
set glorytun.vpn.port=$port
EOF
@ -262,7 +262,7 @@ _get_vps_config() {
client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.client_ip')"
host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.host_ip')"
port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')"
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ]; then
if [ "$(uci -q get glorytun.vpn.port)" != "$port" ] && [ "$port" != "" ]; then
uci -q batch <<-EOF >/dev/null
set glorytun.vpn.port=$port
EOF
@ -391,7 +391,7 @@ _get_gre_tunnel() {
peeraddr="$(echo $tunnel | jsonfilter -q -e '@.remote_ip')"
ipaddr="$(echo $tunnel | jsonfilter -q -e '@.local_ip')"
publicaddr="$(echo $tunnel | jsonfilter -q -e '@.public_ip')"
if [ "$(uci -q get network.omrip${i}.peeraddr)" != "$peeraddr" ] || [ "$(uci -q get network.omrip${i}.ipaddr)" != "$ipaddr" ] || [ "$(uci -q get network.omrip${i}gre.ipaddr)" != "$vpnip_local" ]; then
if [ "$peeraddr" != "" ] && [ "$ipaddr" != "" ] && [ "$publicaddr" != "" ] && ([ "$(uci -q get network.omrip${i}.peeraddr)" != "$peeraddr" ] || [ "$(uci -q get network.omrip${i}.ipaddr)" != "$ipaddr" ] || [ "$(uci -q get network.omrip${i}gre.ipaddr)" != "$vpnip_local" ]); then
uci -q batch <<-EOF >/dev/null
set network.omrip${i}gre=interface
set network.omrip${i}gre.label="GRE tunnel for $publicaddr"
@ -1415,6 +1415,7 @@ _config_service() {
_get_vps_config
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
[ -z "$vps_config" ] && return
user_permission="$(echo "$vps_config" | jsonfilter -q -e '@.user.permission')"
if [ "$(uci -q get openmptcprouter.settings.firstboot)" != "0" ]; then