diff --git a/package/lean/luci-app-n2n_v2/Makefile b/package/lean/luci-app-n2n_v2/Makefile index 5ce0746511..9f06c75267 100644 --- a/package/lean/luci-app-n2n_v2/Makefile +++ b/package/lean/luci-app-n2n_v2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=n2n_v2 VPN Configuration module LUCI_DEPENDS:=+n2n-edge +n2n-supernode LUCI_PKGARCH:=all -PKG_VERSION:=2.8.0 +PKG_VERSION:=2.8.1 PKG_RELEASE:=2 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua index 22ee684346..c9085ffcc0 100644 --- a/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua +++ b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua @@ -5,21 +5,6 @@ local fs = require "nixio.fs" function get_mask(v) - v:value("1 ", "128.0.0.0(1)") - v:value("2 ", "192.0.0.0(2)") - v:value("3 ", "224.0.0.0(3)") - v:value("4 ", "240.0.0.0(4)") - v:value("5 ", "248.0.0.0(5)") - v:value("6 ", "252.0.0.0(6)") - v:value("7 ", "254.0.0.0(7)") - v:value("8 ", "255.0.0.0(8)") - v:value("9 ", "255.128.0.0(9)") - v:value("10", "255.192.0.0(10)") - v:value("11", "255.224.0.0(11)") - v:value("12", "255.240.0.0(12)") - v:value("13", "255.248.0.0(13)") - v:value("14", "255.252.0.0(14)") - v:value("15", "255.254.0.0(15)") v:value("16", "255.255.0.0(16)") v:value("17", "255.255.128.0(17)") v:value("18", "255.255.192.0(18)") @@ -35,8 +20,6 @@ function get_mask(v) v:value("28", "255.255.255.240(28)") v:value("29", "255.255.255.248(29)") v:value("30", "255.255.255.252(30)") - v:value("31", "255.255.255.254(31)") - v:value("32", "255.255.255.255(32)") end m = Map("n2n_v2", translate("N2N v2 VPN"), translatef( @@ -131,4 +114,8 @@ o.optional = false o.datatype = "ip4addr" o.rmempty = false +---- Description +o = s:option(Value, "desc", translate("Description")) +o.optional = false + return m diff --git a/package/lean/luci-app-n2n_v2/po/zh_Hans/n2n_v2.po b/package/lean/luci-app-n2n_v2/po/zh_Hans/n2n_v2.po index 7d3fb233cd..248e478cd7 100644 --- a/package/lean/luci-app-n2n_v2/po/zh_Hans/n2n_v2.po +++ b/package/lean/luci-app-n2n_v2/po/zh_Hans/n2n_v2.po @@ -72,4 +72,7 @@ msgid "Mask" msgstr "掩码" msgid "Gateway" -msgstr "网关" \ No newline at end of file +msgstr "网关" + +msgid "Description" +msgstr "描述" diff --git a/package/lean/n2n_v2/files/n2n_v2.init b/package/lean/n2n_v2/files/n2n_v2.init index 31b0fce59a..c1d7fa8a5f 100755 --- a/package/lean/n2n_v2/files/n2n_v2.init +++ b/package/lean/n2n_v2/files/n2n_v2.init @@ -29,6 +29,10 @@ start_instance() { eval "$(ipcalc.sh "$ipaddr/$prefix")" netmask="$NETMASK" /usr/bin/edge -u 0 -g 0 -d $tunname -a ${mode}:${address} -s $netmask -c $community $([ -n "$key" ] && echo -k $key) -l ${supernode}:${port} $args $mtu + sleep 1 + iptables -I FORWARD -i "$tunname" -j ACCEPT + iptables -I FORWARD -o "$tunname" -j ACCEPT + iptables -t nat -I POSTROUTING -o "$tunname" -j MASQUERADE ;; supernode) config_get_bool enabled "$cfg" 'enabled' '0' @@ -54,6 +58,10 @@ stop_instance() { case "$type" in edge) + config_get tunname "$cfg" 'tunname' + iptables -D FORWARD -i "$tunname" -j ACCEPT 2>/dev/null + iptables -D FORWARD -o "$tunname" -j ACCEPT 2>/dev/null + iptables -t nat -D POSTROUTING -o "$tunname" -j MASQUERADE 2>/dev/null killall -9 edge ;; supernode) @@ -72,6 +80,6 @@ start() { stop() { config_load 'n2n_v2' - killall -9 edge + config_foreach stop_instance 'edge' ps | grep supernode | grep -v grep 2>&1 >/dev/null && killall -9 supernode }