diff options
Diffstat (limited to 'protocols')
23 files changed, 153 insertions, 98 deletions
diff --git a/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua b/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua index 1b2e23cc42..e05e3a47fd 100644 --- a/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua +++ b/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua @@ -47,7 +47,9 @@ dialnumber.placeholder = "*99***1#" if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", ListValue, "ipv6") + ipv6 = section:taboption("advanced", ListValue, "ipv6", + translate("Obtain IPv6-Address")) + ipv6:value("auto", translate("Automatic")) ipv6:value("0", translate("Disabled")) ipv6:value("1", translate("Manual")) diff --git a/protocols/luci-proto-hnet/Makefile b/protocols/luci-proto-hnet/Makefile new file mode 100644 index 0000000000..10beb032bc --- /dev/null +++ b/protocols/luci-proto-hnet/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 Florian Eckert <fe@dev.tdt.de> +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Support for hnet +LUCI_DEPENDS:= + +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Steven Barth <steven@midlink.org> + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_hnet.lua b/protocols/luci-proto-hnet/luasrc/model/cbi/admin_network/proto_hnet.lua index 2ed34faf71..2ed34faf71 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_hnet.lua +++ b/protocols/luci-proto-hnet/luasrc/model/cbi/admin_network/proto_hnet.lua diff --git a/protocols/luci-proto-ipv6/luasrc/model/network/proto_hnet.lua b/protocols/luci-proto-hnet/luasrc/model/network/proto_hnet.lua index f525061be4..f525061be4 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/network/proto_hnet.lua +++ b/protocols/luci-proto-hnet/luasrc/model/network/proto_hnet.lua diff --git a/protocols/luci-proto-ipv6/Makefile b/protocols/luci-proto-ipv6/Makefile index b28c8d5895..b0c8395e86 100644 --- a/protocols/luci-proto-ipv6/Makefile +++ b/protocols/luci-proto-ipv6/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=Support for DHCPv6/6in4/6to4/6rd/DS-Lite -LUCI_DEPENDS:= +LUCI_DEPENDS:=@IPV6 PKG_LICENSE:=Apache-2.0 diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua index 16245b80e5..3c9f41f6b5 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua @@ -33,7 +33,7 @@ local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"), translate("This is the prefix routed to you by the tunnel broker for use by clients")) -ip6prefix.datatype = "ip6addr" +ip6prefix.datatype = "list(ip6addr)" local update = section:taboption("general", Flag, "_update", diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua index 76caedcb37..49281ee41d 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua @@ -38,7 +38,7 @@ o.default = o.enabled o = section:taboption("advanced", Value, "ip6prefix", translate("Custom delegated IPv6-prefix")) -o.dataype = "ip6addr" +o.dataype = "list(ip6addr)" o = section:taboption("advanced", DynamicList, "dns", diff --git a/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua b/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua index ad99073ad6..7508e0d4b0 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua @@ -52,12 +52,13 @@ for _, p in ipairs({"dslite", "map", "464xlat"}) do function proto.contains_interface(self, ifname) return (netmod:ifnameof(ifc) == self:ifname()) end - - if p == "dslite" then - netmod:register_pattern_virtual("^ds%-%w") - elseif p == "map" then - netmod:register_pattern_virtual("^map%-%w") - elseif p == "464xlat" then - netmod:register_pattern_virtual("^464%-%w") - end end + +netmod:register_pattern_virtual("^464%-%w") +netmod:register_pattern_virtual("^ds%-%w") +netmod:register_pattern_virtual("^map%-%w") + +netmod:register_error_code("AFTR_DNS_FAIL", luci.i18n.translate("Unable to resolve AFTR host name")) +netmod:register_error_code("INVALID_MAP_RULE", luci.i18n.translate("MAP rule is invalid")) +netmod:register_error_code("NO_MATCHING_PD", luci.i18n.translate("No matching prefix delegation")) +netmod:register_error_code("UNSUPPORTED_TYPE", luci.i18n.translate("Unsupported MAP type")) diff --git a/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua b/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua index 917c88c92c..318db7e774 100644 --- a/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua +++ b/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua @@ -12,27 +12,23 @@ You may obtain a copy of the License at local map, section, net = ... -local device, apn, service, pincode, username, password, dialnumber -local ipv6, maxwait, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand +local device, apn, service, pincode, username, password +local ipv6, delay, defaultroute, metric, peerdns, dns device = section:taboption("general", Value, "device", translate("Modem device")) device.rmempty = false -local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*") - or nixio.fs.glob("/dev/ttyUSB*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end +local dev +for dev in nixio.fs.glob("/dev/ttyUSB*") do + device:value(dev) +end +for dev in nixio.fs.glob("/dev/cdc-wdm*") do + device:value(dev) end - mode = section:taboption("general", Value, "mode", translate("Service Type")) -mode.default = "auto" +mode:value("", translate("Modem default")) mode:value("preferlte", translate("Prefer LTE")) mode:value("preferumts", translate("Prefer UMTS")) mode:value("lte", "LTE") @@ -41,6 +37,13 @@ mode:value("gsm", translate("GPRS only")) mode:value("auto", translate("auto")) +mode = section:taboption("general", Value, "pdptype", translate("IP Protocol")) +mode.default = "IP" +mode:value("IP", translate("IPv4")) +mode:value("IPV4V6", translate("IPv4+IPv6")) +mode:value("IPV6", translate("IPv6")) + + apn = section:taboption("general", Value, "apn", translate("APN")) @@ -53,8 +56,6 @@ username = section:taboption("general", Value, "username", translate("PAP/CHAP u password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) password.password = true -dialnumber = section:taboption("general", Value, "dialnumber", translate("Dial number")) -dialnumber.placeholder = "*99***1#" if luci.model.network:has_ipv6() then @@ -67,12 +68,12 @@ if luci.model.network:has_ipv6() then end -maxwait = section:taboption("advanced", Value, "maxwait", +delay = section:taboption("advanced", Value, "delay", translate("Modem init timeout"), translate("Maximum amount of seconds to wait for the modem to become ready")) -maxwait.placeholder = "20" -maxwait.datatype = "min(1)" +delay.placeholder = "10" +delay.datatype = "min(1)" defaultroute = section:taboption("advanced", Flag, "defaultroute", @@ -103,55 +104,3 @@ dns:depends("peerdns", "") dns.datatype = "ipaddr" dns.cast = "string" - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/protocols/luci-proto-ncm/luasrc/model/network/proto_ncm.lua b/protocols/luci-proto-ncm/luasrc/model/network/proto_ncm.lua index 4f835701ce..49abe23472 100644 --- a/protocols/luci-proto-ncm/luasrc/model/network/proto_ncm.lua +++ b/protocols/luci-proto-ncm/luasrc/model/network/proto_ncm.lua @@ -59,3 +59,11 @@ function proto.contains_interface(self, ifc) end netmod:register_pattern_virtual("^ncm%-%w") + +netmod:register_error_code("CONFIGURE_FAILED", luci.i18n.translate("Configuration failed")) +netmod:register_error_code("DISCONNECT_FAILED", luci.i18n.translate("Disconnection attempt failed")) +netmod:register_error_code("FINALIZE_FAILED", luci.i18n.translate("Finalizing failed")) +netmod:register_error_code("GETINFO_FAILED", luci.i18n.translate("Modem information query failed")) +netmod:register_error_code("INITIALIZE_FAILED", luci.i18n.translate("Initialization failure")) +netmod:register_error_code("SETMODE_FAILED", luci.i18n.translate("Setting operation mode failed")) +netmod:register_error_code("UNSUPPORTED_MODEM", luci.i18n.translate("Unsupported modem")) diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua index 355d9b5b39..5f468bc14c 100644 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua +++ b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua @@ -103,7 +103,7 @@ function keepalive_interval.write(self, section, value) if f > 0 then m:set(section, "keepalive", "%d %d" %{ f, i }) else - m:del(section, "keepalive") + m:set(section, "keepalive", "0") end end diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua index a5f76a38ad..004fd7ef67 100644 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua +++ b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua @@ -109,7 +109,7 @@ function keepalive_interval.write(self, section, value) if f > 0 then m:set(section, "keepalive", "%d %d" %{ f, i }) else - m:del(section, "keepalive") + m:set(section, "keepalive", "0") end end diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua index 1ea9b3ea72..063d8c07eb 100644 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua +++ b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua @@ -103,7 +103,7 @@ function keepalive_interval.write(self, section, value) if f > 0 then m:set(section, "keepalive", "%d %d" %{ f, i }) else - m:del(section, "keepalive") + m:set(section, "keepalive", "0") end end diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua index 462d7019f0..6a828efe96 100644 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua +++ b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua @@ -82,7 +82,7 @@ function keepalive_interval.write(self, section, value) if f > 0 then m:set(section, "keepalive", "%d %d" %{ f, i }) else - m:del(section, "keepalive") + m:set(section, "keepalive", "0") end end diff --git a/protocols/luci-proto-ppp/luasrc/model/network/proto_ppp.lua b/protocols/luci-proto-ppp/luasrc/model/network/proto_ppp.lua index 3afb7de4f5..f87b30fcc1 100644 --- a/protocols/luci-proto-ppp/luasrc/model/network/proto_ppp.lua +++ b/protocols/luci-proto-ppp/luasrc/model/network/proto_ppp.lua @@ -4,7 +4,7 @@ local netmod = luci.model.network local _, p -for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp", "pppossh"}) do +for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp"}) do local proto = netmod:register_protocol(p) @@ -19,8 +19,6 @@ for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp", "pppossh"}) do return luci.i18n.translate("PPPoATM") elseif p == "l2tp" then return luci.i18n.translate("L2TP") - elseif p == "pppossh" then - return luci.i18n.translate("PPPoSSH") end end @@ -39,8 +37,6 @@ for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp", "pppossh"}) do return "ppp-mod-pppoa" elseif p == "l2tp" then return "xl2tpd" - elseif p == "pppossh" then - return "pppossh" end end @@ -53,8 +49,6 @@ for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp", "pppossh"}) do return (nixio.fs.glob("/usr/lib/pppd/*/pptp.so")() ~= nil) elseif p == "l2tp" then return nixio.fs.access("/lib/netifd/proto/l2tp.sh") - elseif p == "pppossh" then - return nixio.fs.access("/lib/netifd/proto/pppossh.sh") else return nixio.fs.access("/lib/netifd/proto/ppp.sh") end diff --git a/protocols/luci-proto-pppossh/Makefile b/protocols/luci-proto-pppossh/Makefile new file mode 100644 index 0000000000..1c0a63b0f2 --- /dev/null +++ b/protocols/luci-proto-pppossh/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 Florian Eckert <fe@dev.tdt.de> +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Support for pppossh +LUCI_DEPENDS:=+pppossh + +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com> + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppossh.lua b/protocols/luci-proto-pppossh/luasrc/model/cbi/admin_network/proto_pppossh.lua index eca7bdd4d3..e53262b5dc 100644 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppossh.lua +++ b/protocols/luci-proto-pppossh/luasrc/model/cbi/admin_network/proto_pppossh.lua @@ -105,7 +105,7 @@ function keepalive_interval.write(self, section, value) if f > 0 then m:set(section, "keepalive", "%d %d" %{ f, i }) else - m:del(section, "keepalive") + m:set(section, "keepalive", "0") end end diff --git a/protocols/luci-proto-pppossh/luasrc/model/network/proto_pppossh.lua b/protocols/luci-proto-pppossh/luasrc/model/network/proto_pppossh.lua new file mode 100644 index 0000000000..a0e2a510c9 --- /dev/null +++ b/protocols/luci-proto-pppossh/luasrc/model/network/proto_pppossh.lua @@ -0,0 +1,40 @@ +-- Copyright 2018 Florian Eckert <fe@dev.tdt.de> +-- Licensed to the public under the Apache License 2.0. + +local netmod = luci.model.network + +local proto = netmod:register_protocol("pppossh") + +function proto.get_i18n(self) + return luci.i18n.translate("PPPoSSH") +end + +function proto.ifname(self) + return "pppossh-" .. self.sid +end + +function proto.opkg_package(self) + return "pppossh" +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/pppossh.sh") +end + +function proto.is_floating(self) + return true +end + +function proto.is_virtual(self) + return true +end + +function proto.get_interfaces(self) + return nil +end + +function proto.contains_interface(self, ifc) + return (netmod:ifnameof(ifc) == self:ifname()) +end + +netmod:register_pattern_virtual("^pppossh%-%w") diff --git a/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua b/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua index 8a28ad4716..c414378d80 100644 --- a/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua +++ b/protocols/luci-proto-qmi/luasrc/model/network/proto_qmi.lua @@ -49,3 +49,7 @@ function proto.contains_interface(self, ifc) end netmod:register_pattern_virtual("^qmi%-%w") + +netmod:register_error_code("CALL_FAILED", luci.i18n.translate("Call failed")) +netmod:register_error_code("NO_CID", luci.i18n.translate("Unable to obtain client ID")) +netmod:register_error_code("PLMN_FAILED", luci.i18n.translate("Setting PLMN failed")) diff --git a/protocols/luci-proto-relay/luasrc/model/network/proto_relay.lua b/protocols/luci-proto-relay/luasrc/model/network/proto_relay.lua index a2dabf9afe..3b811d44d1 100644 --- a/protocols/luci-proto-relay/luasrc/model/network/proto_relay.lua +++ b/protocols/luci-proto-relay/luasrc/model/network/proto_relay.lua @@ -32,6 +32,11 @@ function proto.is_virtual(self) return true end +function proto.is_up(self) + local iface = self:get_interface() + return iface and iface:is_up() or false +end + function proto.get_interface(self) return device(self.sid, self) end @@ -80,6 +85,10 @@ function proto.uptime(self) return upt end +function proto.errors(self) + return nil +end + function device.__init__(self, ifname, network) self.ifname = ifname diff --git a/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua b/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua index d8217ce8d3..3d85d02f40 100644 --- a/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua +++ b/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua @@ -8,7 +8,7 @@ local authgroup, interface, passgroup, hexpassgroup local domain, vendor, natt_mode, dh_group local pfs, enable_single_des, enable_no_enc local mtu, local_addr, local_port, dpd_idle -local auth_mode, target_network +local auth_mode, target_network, defaultroute local ifc = net:get_interface():name() @@ -77,3 +77,9 @@ dpd_idle.placeholder = "600" ifname = section:taboption("general", Value, "target_network", translate("Target network")) port.placeholder = "0.0.0.0/0" port.datatype = "network" + +defaultroute = section:taboption("general", ListValue, "defaultroute", + translate("Default Route"), + translate("Set VPN as Default Route")) +defaultroute:value("0", translate("No")) +defaultroute:value("1", translate("Yes")) diff --git a/protocols/luci-proto-wireguard/Makefile b/protocols/luci-proto-wireguard/Makefile index 0dc70cf31e..3540a74acd 100644 --- a/protocols/luci-proto-wireguard/Makefile +++ b/protocols/luci-proto-wireguard/Makefile @@ -10,8 +10,6 @@ LUCI_TITLE:=Support for WireGuard VPN LUCI_DEPENDS:=+kmod-wireguard +wireguard-tools LUCI_PKGARCH:=all -PKG_MAINTAINER:=Dan Luedtke <mail@danrl.com> - include ../../luci.mk # call BuildPackage - OpenWrt buildroot signature diff --git a/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua b/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua index 056f6a6e76..64e256a517 100644 --- a/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua +++ b/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua @@ -5,7 +5,7 @@ local map, section, net = ... local ifname = net:get_interface():name() local private_key, listen_port -local metric, mtu, preshared_key +local metric, mtu, preshared_key, description local peers, public_key, allowed_ips, endpoint, persistent_keepalive @@ -96,6 +96,16 @@ peers.anonymous = true peers.addremove = true +description = peers:option( + Value, + "description", + translate("Description"), + translate("Optional. Description of peer.")) +description.placeholder = "My Peer" +description.datatype = "string" +description.optional = true + + public_key = peers:option( Value, "public_key", |