From 2bf33b6dd152aff73df18af81891212990009b05 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 18 Dec 2020 19:43:58 +0100 Subject: [PATCH 1/6] Fix error if adding firewall rules while rules are incorrect --- openmptcprouter/files/etc/init.d/openmptcprouter-vps | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 05ef1c2de..0ec6b55de 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -467,6 +467,13 @@ _get_gre_tunnel() { set network.omrip${i}.netmask="255.255.255.252" set network.omrip${i}.lookup="667${i}" commit network + EOF + allintf=$(uci -q get firewall.zone_vpn.network) + uci -q del firewall.zone_vpn.network + for intf in $allintf; do + uci -q add_list firewall.zone_vpn.network=$intf + done + uci -q batch <<-EOF >/dev/null add_list firewall.zone_vpn.network="omrip${i}gre" add_list firewall.zone_vpn.network="omrip${i}" commit firewall From 768fcfd33bcb90671ce23d29e6c0756740712333 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 18 Dec 2020 19:44:51 +0100 Subject: [PATCH 2/6] Use omr settings to get current vpn --- .../luasrc/view/openmptcprouter/wizard.htm | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 13f998979..ee213ed86 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -295,17 +295,17 @@ for _, vpn in pairs(available_vpns) do if vpn == "glorytun_tcp" then %> - <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> + <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> <% elseif vpn == "glorytun_udp" then %> - <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> + <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> <% elseif vpn == "dsvpn" then %> - <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> <% elseif vpn == "mlvpn" then %> - <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> <% elseif vpn == "ubond" then %> - <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> + <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> <% elseif vpn == "openvpn" then %> - <% if nixio.fs.access("/etc/init.d/openvpn") then %><% end %> + <% if nixio.fs.access("/etc/init.d/openvpn") then %><% end %> <% elseif vpn == "openvpn_bonding" then %> <% if nixio.fs.access("/etc/init.d/openvpnbonding") then %><% end %> <% @@ -316,12 +316,12 @@ <% else %> - <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> - <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> - <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> - <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> - <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> - <% if nixio.fs.access("/etc/init.d/openvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> + <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> + <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> + <% if nixio.fs.access("/etc/init.d/openvpn") then %><% end %> <% if nixio.fs.access("/etc/init.d/openvpnbonding") then %><% end %> <% From 38c06cef0c3c13a2e5c86ca1b1ac21541ae6cd9b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 18 Dec 2020 19:45:15 +0100 Subject: [PATCH 3/6] Change help line for DHCP --- .../htdocs/luci-static/resources/view/network/dhcp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index dafb89b26..d51c0b33d 100644 --- a/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -491,7 +491,7 @@ return view.extend({ so.datatype = 'or(ip4addr,"ignore")'; so.rmempty = true; - so = ss.option(form.Value, 'leasetime', _('Lease time'), _('The lease time is in seconds, or minutes (eg 45m) or hours (eg 1h) or "infinite"')); + so = ss.option(form.Value, 'leasetime', _('Lease time'), _('The lease time is minutes (mini 2m), hours (eg 1h) or "infinite"')); so.placeholder = '12h'; so.rmempty = true; From f8b1e3a5e569a3c69a80d4c90c57a644b076bf6b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 18 Dec 2020 20:42:44 +0100 Subject: [PATCH 4/6] Firewall zone must be a list --- .../htdocs/luci-static/resources/view/firewall/zones.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js index 00e272677..5ece96be2 100644 --- a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js +++ b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js @@ -163,8 +163,10 @@ return view.extend({ var name = uci.get('firewall', section_id, 'name'), cfgvalue = this.cfgvalue(section_id); + /* if (typeof(cfgvalue) == 'string' && Array.isArray(formvalue) && (cfgvalue == formvalue.join(' '))) return; + */ var tasks = [ firewall.getZone(name) ]; From 5bcc428e64de1f485aa65a8d00f99b263a71b57b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 19 Dec 2020 07:16:10 +0100 Subject: [PATCH 5/6] Fix typo --- luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index ee213ed86..da0649831 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -318,7 +318,7 @@ %> <% if nixio.fs.access("/usr/sbin/glorytun") then %><% end %> <% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><% end %> - <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> + <% if nixio.fs.access("/usr/sbin/dsvpn") then %><% end %> <% if nixio.fs.access("/usr/sbin/mlvpn") then %><% end %> <% if nixio.fs.access("/usr/sbin/ubond") then %><% end %> <% if nixio.fs.access("/etc/init.d/openvpn") then %><% end %> From de776701e874eb26ada19d84647cdae8f755caab Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 21 Dec 2020 09:53:37 +0100 Subject: [PATCH 6/6] Set uhttpd config only at first boot and update fstab at update --- .../files/etc/uci-defaults/2050-omr-uhttpd | 14 ++++++++------ .../files/etc/uci-defaults/2060-omr-system | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openmptcprouter/files/etc/uci-defaults/2050-omr-uhttpd b/openmptcprouter/files/etc/uci-defaults/2050-omr-uhttpd index 9c5e28002..a2076f640 100755 --- a/openmptcprouter/files/etc/uci-defaults/2050-omr-uhttpd +++ b/openmptcprouter/files/etc/uci-defaults/2050-omr-uhttpd @@ -1,8 +1,10 @@ #!/bin/sh -uci -q batch <<-EOF >/dev/null - set uhttpd.main.redirect_https=0 - set uhttpd.main.script_timeout=240 - set uhttpd.main.network_timeout=240 - set uhttpd.main.http_keepalive=0 -EOF +if [ "$(uci -q get openmptcprouter.settings.version)" = "" ]; then + uci -q batch <<-EOF >/dev/null + set uhttpd.main.redirect_https=0 + set uhttpd.main.script_timeout=240 + set uhttpd.main.network_timeout=240 + set uhttpd.main.http_keepalive=0 + EOF +fi exit 0 \ No newline at end of file diff --git a/openmptcprouter/files/etc/uci-defaults/2060-omr-system b/openmptcprouter/files/etc/uci-defaults/2060-omr-system index 3b578e3fc..0acd9fd6f 100755 --- a/openmptcprouter/files/etc/uci-defaults/2060-omr-system +++ b/openmptcprouter/files/etc/uci-defaults/2060-omr-system @@ -12,6 +12,8 @@ uci -q batch <<-EOF >/dev/null commit fstab EOF +/sbin/block detect > /etc/config/fstab + [ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ "$(uci -q get openmptcprouter.settings.scaling_governor)" != "performance" ] && { # force CPU speed for RPI uci -q set openmptcprouter.settings.scaling_min_freq=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq | tr -d "\n")