1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix 6in4 from VPS

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-05-26 07:58:48 +02:00
parent fdbdcfe3b0
commit a60922f032

View file

@ -522,7 +522,7 @@ _set_vpn_ip() {
[ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep kernel | awk '{print $1}' | tr -d "\n")
[ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep "proto static src" | awk '{print $3}' | tr -d "\n")
ula="$(uci -q get network.globals.ula_prefix)"
ula_current="$(echo "$vps_config" | jsonfilter -q -e '@.6in4.ula')"
ula_current="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.ula')"
if [ "$vpnip_remote" != "" ] && [ "$vpnip_local" != "" ] && ([ "$vpnip_remote" != "$vpnip_remote_current" ] || [ "$vpnip_local" != "$vpnip_local_current" ] || [ "$ula" != "$ula_current" ]); then
settings='{"remoteip" : "'$vpnip_local'","localip" : "'$vpnip_remote'","ula" : "'$ula'"}'
result=$(_set_json "vpnips" "$settings")
@ -724,7 +724,7 @@ _set_config_from_vps() {
/etc/init.d/omr-tracker restart
fi
ula="$(echo "$vps_config" | jsonfilter -q -e '@.6in4.ula')"
ula="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.ula')"
if [ -n "$ula" ]; then
uci -q batch <<-EOF >/dev/null
set network.globals.ula_prefix=$ula
@ -976,14 +976,17 @@ _set_config_from_vps() {
EOF
fi
omr6in4_vps_localip="$(echo "$vps_config" | jsonfilter -q -e '@.6in4.localip')"
omr6in4_vps_remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.6in4.remoteip')"
omr6in4_vps_localip="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.localip')"
omr6in4_vps_remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.remoteip')"
if ([ -n "$omr6in4_vps_localip" ] && [ "$omr6in4_vps_localip" != "$(uci -q get network.omr6in4.gateway)" ]) || ([ -n "$omr6in4_vps_remoteip" ] && [ "$omr6in4_vps_remoteip" != "$(uci -q get network.omr6in4.ip6addr)" ]); then
logger -t "OMR-VPS" "Set omr6in4 ip address and gateway"
uci -q batch <<-EOF >/dev/null
set network.omr6in4.ip6addr=$omr6in4_vps_remoteip
set network.omr6in4.gateway=$omr6in4_vps_localip
set network.omr6in4.ip6addr="$omr6in4_vps_remoteip"
set network.omr6in4.gateway="$omr6in4_vps_localip"
commit network
EOF
/etc/init.d/network restart
sleep 6
fi
# Get VPS iperf config