-
<%:All router settings%>
-
-
<%=luci.sys.exec("uci show")%>
-
+
+
<%:All router settings%>
+
+
<%=luci.sys.exec("uci show")%>
-
+
<%+footer%>
diff --git a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter
index 755e06753..ef773e801 100755
--- a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter
+++ b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter
@@ -33,40 +33,6 @@ omr_intf_set() {
fi
}
-set_ipv6_state() {
- local disable_ipv6=$1
- local sysctl_ipv6=0
- sysctl -w net.ipv6.conf.all.disable_ipv6=$sysctl_ipv6
- sed -i 's:^net.ipv6.conf.all.disable_ipv6=[0-9]*:net.ipv6.conf.all.disable_ipv6=$sysctl_ipv6:' /etc/sysctl.d/zzz_openmptcprouter.conf
-
- uci -q set firewall.@defaults[0].disable_ipv6=$disable_ipv6
- uci -q commit firewall
-
- if [ "$disable_ipv6" == "1" ]; then
- uci -q set dhcp.lan.ra_default="0"
- uci -q set network.lan.ipv6="0"
- uci -q delete network.lan.ipv6
- uci -q delete dhcp.lan.dhcpv6
- uci -q delete dhcp.lan.ra
- uci -q delete dhcp.lan.ra_default
- uci -q delete dhcp.lan.ra_preference
- uci -q set shadowsocks-libev.hi.local_address="0.0.0.0"
- else
- uci -q set dhcp.lan.ra_default="1"
- uci -q set dhcp.lan.ra_preference="high"
- uci -q set network.lan.ipv6="1"
- uci -q set network.lan.delegate="0"
- uci -q set shadowsocks-libev.hi.local_address="::"
- fi
- uci -q commit shadowsocks-libev
- uci -q commit dhcp
- uci -q commit network
- #if [ "$disable_ipv6" == "1" ]; then
- # /etc/init.d/odhcpd stop >/dev/null 2>&1
- # /etc/init.d/odhcpd disable >/dev/null 2>&1
- #fi
-}
-
start_service() {
local scaling_min_freq scaling_max_freq
@@ -94,11 +60,6 @@ start_service() {
echo $scaling_governor > $c/scaling_governor
done
}
- config_get disable_ipv6 settings disable_ipv6 "0"
- if [ "$(uci -q get firewall.@defaults[0].disable_ipv6)" != "$disable_ipv6" ]; then
- set_ipv6_state $disable_ipv6
- fi
-
# remove sysctl already defined in /etc/sysctl.d/
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' /etc/sysctl.conf
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' /etc/sysctl.d/10-default.conf
diff --git a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter
index 8f61db6c7..1076e312c 100755
--- a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter
+++ b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter
@@ -449,7 +449,10 @@ end
function disableipv6(disable_ipv6)
-- Disable IPv6
- set_ipv6_state(disable_ipv6)
+ ucic:set("openmptcprouter","settings","disable_ipv6",disable_ipv6)
+ ucic:save("openmptcprouter")
+ ucic:commit("openmptcprouter")
+ luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
end
function externalcheck(externalcheck)
@@ -1042,7 +1045,7 @@ function interfaces_status()
local ipv6_discover = "NONE"
if ifname ~= "" and ifname ~= nil and mArray.openmptcprouter["ipv6"] == "enabled" then
local ipv6_result = ""
- --local ipv6_result = _ipv6_discover(ifname)
+ local ipv6_result = _ipv6_discover(ifname)
if type(ipv6_result) == "table" and #ipv6_result > 0 then
local ipv6_addr_test
for k,v in ipairs(ipv6_result) do
@@ -1051,9 +1054,9 @@ function interfaces_status()
ipv6_addr_test = sys.exec("ip -6 addr | grep " .. v.RecursiveDnsServer)
if ipv6_addr_test == "" then
ipv6_discover = "DETECTED"
- if connectivity == "OK" then
- connectivity = "WARNING"
- end
+ --if connectivity == "OK" then
+ -- connectivity = "WARNING"
+ --end
end
end
end
@@ -1183,67 +1186,6 @@ function _ipv6_discover(interface)
return ra6_result
end
-function set_ipv6_state(disable_ipv6)
- -- Disable/Enable IPv6 support
- luci.sys.exec("sysctl -qw net.ipv6.conf.all.disable_ipv6=%s" % disable_ipv6)
- luci.sys.exec("sed -i 's:^net.ipv6.conf.all.disable_ipv6=[0-9]*:net.ipv6.conf.all.disable_ipv6=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % disable_ipv6)
- --luci.sys.exec("sysctl -qw net.ipv6.conf.all.disable_ipv6=" % disable_ipv6)
- --luci.sys.exec("sed -i 's:^net.ipv6.conf.all.disable_ipv6=[0-9]*:net.ipv6.conf.all.disable_ipv6=0:' /etc/sysctl.d/zzz_openmptcprouter.conf" % disable_ipv6)
-
- -- Disable/Enable IPv6 for firewall
- ucic:set("firewall",ucic:get_first("firewall","defaults"),"disable_ipv6",disable_ipv6)
- ucic:save("firewall")
- ucic:commit("firewall")
-
- -- Disable/Enable IPv6 in OpenMPTCProuter settings
- ucic:set("openmptcprouter","settings","disable_ipv6",disable_ipv6)
- ucic:save("openmptcprouter")
- ucic:commit("openmptcprouter")
-
- -- Disable/Enable route announce of IPv6
- if disable_ipv6 == "1" then
- ucic:set("dhcp","lan","ra_default","0")
- ucic:set("network","lan","ipv6","0")
- --luci.sys.call("uci -q del network.lan.ipifaceid")
- else
- -- ucic:set("dhcp","lan","ra_default","1")
- ucic:set("network","lan","ipv6","1")
- ucic:set("network","lan","delegate","0")
- --ucic:set("network","lan","ipifaceid","random")
- end
- ucic:save("network")
- ucic:commit("network")
-
- -- Disable/Enable IPv6 DHCP and change Shadowsocks listen address
- if disable_ipv6 == "1" then
- luci.sys.call("uci -q del dhcp.lan.dhcpv6")
- luci.sys.call("uci -q del dhcp.lan.ra")
- luci.sys.call("uci -q del dhcp.lan.ra_default")
- luci.sys.call("uci -q del dhcp.lan.ra_management")
- luci.sys.call("uci -q del dhcp.lan.ra_preference")
- ucic:set("shadowsocks-libev","hi","local_address","0.0.0.0")
- else
- ucic:set("dhcp","lan","dhcpv6","server")
- ucic:set("dhcp","lan","ra","server")
- ucic:set("dhcp","lan","ra_default","1")
- ucic:set("dhcp","lan","ra_preference","high")
- ucic:set("dhcp","lan","ra_management","1")
- ucic:set("shadowsocks-libev","hi","local_address","::")
- end
- ucic:save("shadowsocks-libev")
- ucic:commit("shadowsocks-libev")
- ucic:save("dhcp")
- ucic:commit("dhcp")
- luci.sys.exec("/etc/init.d/omr-6in4 restart >/dev/null 2>&1")
- --if disable_ipv6 == "1" then
- -- luci.sys.exec("/etc/init.d/odhcpd stop >/dev/null 2>&1")
- -- luci.sys.exec("/etc/init.d/odhcpd disable >/dev/null 2>&1")
- --else
- -- luci.sys.exec("/etc/init.d/odhcpd start >/dev/null 2>&1")
- -- luci.sys.exec("/etc/init.d/odhcpd enable >/dev/null 2>&1")
- --end
-end
-
local methods = {
status = {
call = function()
diff --git a/omr-6in4/files/etc/init.d/omr-6in4 b/omr-6in4/files/etc/init.d/omr-6in4
index b491cf3af..1a30908c0 100755
--- a/omr-6in4/files/etc/init.d/omr-6in4
+++ b/omr-6in4/files/etc/init.d/omr-6in4
@@ -10,8 +10,51 @@
USE_PROCD=1
}
+set_ipv6_state() {
+ local disable_ipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)"
+ [ -z "$disable_ipv6" ] && disable_ipv6="1"
+ sysctl -w net.ipv6.conf.all.disable_ipv6=$disable_ipv6
+ sed -i 's:^net.ipv6.conf.all.disable_ipv6=[0-9]*:net.ipv6.conf.all.disable_ipv6=$disable_ipv6:' /etc/sysctl.d/zzz_openmptcprouter.conf
+
+ uci -q batch <<-EOF >/dev/null
+ set firewall.@defaults[0].disable_ipv6=$disable_ipv6
+ commit firewall
+ EOF
+
+ if [ "$disable_ipv6" == "1" ]; then
+ uci -q batch <<-EOF >/dev/null
+ set dhcp.lan.ra_default="0"
+ set network.lan.ipv6="0"
+ delete network.lan.ipv6
+ delete dhcp.lan.dhcpv6
+ delete dhcp.lan.ra
+ delete dhcp.lan.ra_default
+ delete dhcp.lan.ra_management
+ delete dhcp.lan.ra_preference
+ set shadowsocks-libev.hi.local_address="0.0.0.0"
+ EOF
+ else
+ uci -q batch <<-EOF >/dev/null
+ set dhcp.lan.dhcpv6="server1"
+ set dhcp.lan.ra="server"
+ set dhcp.lan.ra_default="1"
+ set dhcp.lan.ra_preference="high"
+ set dhcp.lan.ra_management="1"
+ set network.lan.ipv6="1"
+ set network.lan.delegate="0"
+ set shadowsocks-libev.hi.local_address="::"
+ EOF
+ fi
+ uci -q batch <<-EOF >/dev/null
+ commit network
+ commit dhcp
+ commit shadowsocks-libev
+ EOF
+}
+
start_service() {
+ [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "$(sysctl -w net.ipv6.conf.all.disable_ipv6)" ] && set_ipv6_state
[ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "1" ] && return
procd_open_instance
# shellcheck disable=SC2086
diff --git a/omr-6in4/files/etc/uci-defaults/9010-omr-6in4 b/omr-6in4/files/etc/uci-defaults/9010-omr-6in4
index f2f321c72..521f6cd5e 100755
--- a/omr-6in4/files/etc/uci-defaults/9010-omr-6in4
+++ b/omr-6in4/files/etc/uci-defaults/9010-omr-6in4
@@ -12,6 +12,7 @@ if [ "$(uci -q show network | grep omr6in4)" = "" ]; then
set network.omr6in4.peeraddr=10.255.255.1
set network.omr6in4.gateway=fe80::a00:1
set network.omr6in4.ip6addr=fe80::a00:2
+ set network.omr6in4.auto='0'
commit network
EOF
fi
diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps
index 242bd356b..3ff4abc53 100755
--- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps
+++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps
@@ -854,7 +854,7 @@ _backup_get() {
EOF
return
}
- vps_backup=$(_get_json "backup")
+ vps_backup=$(_get_json "backupget")
[ -z "$vps_backup" ] && return
backup_data="$(echo "$vps_backup" | jsonfilter -q -e '@.data')"
backup_sha256sum="$(echo "$vps_backup" | jsonfilter -q -e '@.sha256sum')"
@@ -869,6 +869,36 @@ backup_get() {
config_foreach _backup_get server
}
+_backup_list() {
+ servername=$1
+ [ -z "$(uci -q get openmptcprouter.${servername}.username)" ] && return
+ [ -z "$(uci -q get openmptcprouter.${servername}.password)" ] && return
+ [ -z "$(uci -q get openmptcprouter.${servername}.port)" ] && return
+ token=""
+ vps_config=""
+ _login
+ [ -z "$token" ] && {
+ logger -t "OMR-VPS" "Can't get token, try later"
+ uci -q batch <<-EOF >/dev/null
+ set openmptcprouter.${servername}.admin_error=1
+ EOF
+ return
+ }
+ vps_backup=$(_get_json "backuplist")
+ [ -z "$vps_backup" ] && return
+ backup_lastmodif="$(echo "$vps_backup" | jsonfilter -q -e '@.modif')"
+ [ -n "$backup_lastmodif" ] && {
+ uci -q set openmptcprouter.$servername.lastbackup=$backup_lastmodif
+ }
+}
+
+
+
+backup_list() {
+ config_load openmptcprouter
+ config_foreach _backup_list server
+}
+
_count_server() {
local servername=$1
@@ -919,6 +949,7 @@ _config_service() {
[ -z "$(_set_glorytun_vps)" ] && error=1
[ -z "$(_set_openvpn_vps)" ] && error=1
_set_vps_firewall
+ _backup_list
redirect_port="0"
if [ "$(uci -q get openmptcprouter.${servername}.redirect_ports)" = "1" ] || [ "$(uci -q get upnpd.config.enabled)" = "1" ]; then
redirect_port="1"
diff --git a/openmptcprouter/files/etc/uci-defaults/1920-omr-network b/openmptcprouter/files/etc/uci-defaults/1920-omr-network
index 6dde4e4cd..dc109d8d7 100755
--- a/openmptcprouter/files/etc/uci-defaults/1920-omr-network
+++ b/openmptcprouter/files/etc/uci-defaults/1920-omr-network
@@ -96,6 +96,7 @@ set network.lan.ipaddr=192.168.100.1
set network.lan.netmask=255.255.255.0
set network.lan.ifname=${lanif}
set network.lan.metric=2048
+set network.lan.ipv6=0
set network.lan.delegate=0
EOF