summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-03 17:49:58 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-03 17:56:58 +0100
commit284918bfaf2f6d7e46fb11377bb9a537b35dd58a (patch)
tree3513e26d15b92f44dc78f607754f1807d1f64c97 /modules
parent7a2fefc671ff7b5533620e809a4de07cb3b564a3 (diff)
treewide: move templates and libraries not used by the core to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm73
-rw-r--r--modules/luci-compat/Makefile19
-rw-r--r--modules/luci-compat/luasrc/model/network.lua (renamed from modules/luci-base/luasrc/model/network.lua)0
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_3g.lua49
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_4x6.lua64
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_6x4.lua50
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_dhcpv6.lua16
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_hnet.lua16
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_ipip.lua40
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_modemmanager.lua55
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_ncm.lua69
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_openconnect.lua45
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_ppp.lua82
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_pppossh.lua40
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_qmi.lua55
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_relay.lua158
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_vpnc.lua46
-rw-r--r--modules/luci-compat/luasrc/model/network/proto_wireguard.lua42
-rw-r--r--modules/luci-compat/luasrc/view/cbi/firewall_zonelist.htm (renamed from modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm)0
-rw-r--r--modules/luci-compat/luasrc/view/cbi/network_ifacelist.htm (renamed from modules/luci-base/luasrc/view/cbi/network_ifacelist.htm)0
-rw-r--r--modules/luci-compat/luasrc/view/cbi/network_netinfo.htm (renamed from modules/luci-base/luasrc/view/cbi/network_netinfo.htm)0
-rw-r--r--modules/luci-compat/luasrc/view/cbi/network_netlist.htm (renamed from modules/luci-base/luasrc/view/cbi/network_netlist.htm)0
22 files changed, 846 insertions, 73 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm b/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm
deleted file mode 100644
index dc251dbd94..0000000000
--- a/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm
+++ /dev/null
@@ -1,73 +0,0 @@
-<%+cbi/valueheader%>
-
-<%-
- local utl = require "luci.util"
- local fwm = require "luci.model.firewall".init()
- local nwm = require "luci.model.network".init()
-
- local zone, fwd, fz
- local value = self:formvalue(section)
- if not value or value == "-" then
- value = self:cfgvalue(section) or self.default
- end
-
- local def = fwm:get_defaults()
- local zone = fwm:get_zone(value)
- local empty = true
-
- local function render_zone(zone)
--%>
- <label class="zonebadge" style="background-color:<%=zone:get_color()%>">
- <strong><%=zone:name()%></strong>
- <div class="cbi-tooltip">
- <%-
- local zempty = true
- for _, net in ipairs(zone:get_networks()) do
- net = nwm:get_network(net)
- if net then
- zempty = false
- -%>
- <span class="ifacebadge<% if net:name() == self.network then %> ifacebadge-active<% end %>"><%=net:name()%>:&#160;
- <%
- local nempty = true
- for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
- nempty = false
- %>
- <img<%=attr("title", iface:get_i18n())%> src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
- <% end %>
- <% if nempty then %><em><%:(empty)%></em><% end %>
- </span>
- <%- end end -%>
- <% if zempty then %><span class="ifacebadge"><em><%:(empty)%></em></span><% end %>
- </div>
- </label>
-<%-
- end
--%>
-
-<% if zone then %>
-<div class="zone-forwards">
- <div class="zone-src">
- <%=render_zone(zone)%>
- </div>
- <span>&#8658;</span>
- <div class="zone-dest">
- <%
- for _, fwd in ipairs(zone:get_forwardings_by("src")) do
- fz = fwd:dest_zone()
- if fz then
- empty = false
- render_zone(fz)
- end
- end
- if empty then
- %>
- <label class="zonebadge zonebadge-empty">
- <strong><%=def:forward():upper()%></strong>
- </label>
- <% end %>
- </div>
-</div>
-<% end %>
-
-<%+cbi/valuefooter%>
diff --git a/modules/luci-compat/Makefile b/modules/luci-compat/Makefile
new file mode 100644
index 0000000000..d73ca070a1
--- /dev/null
+++ b/modules/luci-compat/Makefile
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2019 Jo-Philipp Wich <jo@mein.io>
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luci-compat
+
+LUCI_TYPE:=mod
+LUCI_BASENAME:=compat
+
+LUCI_TITLE:=LuCI compatibility libraries
+LUCI_DEPENDS:=+luci-base
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-compat/luasrc/model/network.lua
index a36a23f321..a36a23f321 100644
--- a/modules/luci-base/luasrc/model/network.lua
+++ b/modules/luci-compat/luasrc/model/network.lua
diff --git a/modules/luci-compat/luasrc/model/network/proto_3g.lua b/modules/luci-compat/luasrc/model/network/proto_3g.lua
new file mode 100644
index 0000000000..60d8e2ebae
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_3g.lua
@@ -0,0 +1,49 @@
+-- Copyright 2018 Florian Eckert <fe@dev.tdt.de>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+
+local proto = netmod:register_protocol("3g")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("UMTS/GPRS/EV-DO")
+end
+
+function proto.ifname(self)
+ return "3g-" .. self.sid
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/3g.sh")
+end
+
+function proto.opkg_package(self)
+ return "comgt"
+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)
+ if self:is_floating() then
+ return (netmod:ifnameof(ifc) == self:ifname())
+ else
+ return netmod.protocol.contains_interface(self, ifc)
+ end
+end
+
+netmod:register_pattern_virtual("^3g%-%w")
diff --git a/modules/luci-compat/luasrc/model/network/proto_4x6.lua b/modules/luci-compat/luasrc/model/network/proto_4x6.lua
new file mode 100644
index 0000000000..0b329d8a92
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_4x6.lua
@@ -0,0 +1,64 @@
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Copyright 2013 Steven Barth <steven@midlink.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+
+local _, p
+for _, p in ipairs({"dslite", "map", "464xlat"}) do
+
+ local proto = netmod:register_protocol(p)
+
+ function proto.get_i18n(self)
+ if p == "dslite" then
+ return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
+ elseif p == "map" then
+ return luci.i18n.translate("MAP / LW4over6")
+ elseif p == "464xlat" then
+ return luci.i18n.translate("464XLAT (CLAT)")
+ end
+ end
+
+ function proto.ifname(self)
+ return p .. "-" .. self.sid
+ end
+
+ function proto.opkg_package(self)
+ if p == "dslite" then
+ return "ds-lite"
+ elseif p == "map" then
+ return "map-t"
+ elseif p == "464xlat" then
+ return "464xlat"
+ end
+ end
+
+ function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/" .. p .. ".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
+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/modules/luci-compat/luasrc/model/network/proto_6x4.lua b/modules/luci-compat/luasrc/model/network/proto_6x4.lua
new file mode 100644
index 0000000000..2fd0b11957
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_6x4.lua
@@ -0,0 +1,50 @@
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+
+local _, p
+for _, p in ipairs({"6in4", "6to4", "6rd"}) do
+
+ local proto = netmod:register_protocol(p)
+
+ function proto.get_i18n(self)
+ if p == "6in4" then
+ return luci.i18n.translate("IPv6-in-IPv4 (RFC4213)")
+ elseif p == "6to4" then
+ return luci.i18n.translate("IPv6-over-IPv4 (6to4)")
+ elseif p == "6rd" then
+ return luci.i18n.translate("IPv6-over-IPv4 (6rd)")
+ end
+ end
+
+ function proto.ifname(self)
+ return p .. "-" .. self.sid
+ end
+
+ function proto.opkg_package(self)
+ return p
+ end
+
+ function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/" .. p .. ".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("^%s%%-%%w" % p)
+end
diff --git a/modules/luci-compat/luasrc/model/network/proto_dhcpv6.lua b/modules/luci-compat/luasrc/model/network/proto_dhcpv6.lua
new file mode 100644
index 0000000000..0b45dad050
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_dhcpv6.lua
@@ -0,0 +1,16 @@
+-- Copyright 2013 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local proto = luci.model.network:register_protocol("dhcpv6")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("DHCPv6 client")
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/dhcpv6.sh")
+end
+
+function proto.opkg_package(self)
+ return "odhcp6c"
+end
diff --git a/modules/luci-compat/luasrc/model/network/proto_hnet.lua b/modules/luci-compat/luasrc/model/network/proto_hnet.lua
new file mode 100644
index 0000000000..f525061be4
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_hnet.lua
@@ -0,0 +1,16 @@
+-- Copyright 2014 Steven Barth <steven@midlink.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local proto = luci.model.network:register_protocol("hnet")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("Automatic Homenet (HNCP)")
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/hnet.sh")
+end
+
+function proto.opkg_package(self)
+ return "hnet-full"
+end
diff --git a/modules/luci-compat/luasrc/model/network/proto_ipip.lua b/modules/luci-compat/luasrc/model/network/proto_ipip.lua
new file mode 100644
index 0000000000..04d2e78b09
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_ipip.lua
@@ -0,0 +1,40 @@
+-- Copyright 2016 Roger Pueyo Centelles <roger.pueyo@guifi.net>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("ipip")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("IPv4-in-IPv4 (RFC2003)")
+end
+
+function proto.ifname(self)
+ return "ipip-" .. self.sid
+end
+
+function proto.opkg_package(self)
+ return "ipip"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/ipip.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("^ipip%-%w")
diff --git a/modules/luci-compat/luasrc/model/network/proto_modemmanager.lua b/modules/luci-compat/luasrc/model/network/proto_modemmanager.lua
new file mode 100644
index 0000000000..3ad15dfd22
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_modemmanager.lua
@@ -0,0 +1,55 @@
+-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("modemmanager")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("Mobile Data")
+end
+
+function proto.ifname(self)
+ local base = netmod._M.protocol
+ local ifname = base.ifname(self) -- call base class "protocol.ifname(self)"
+
+ -- Note: ifname might be nil if the adapter could not be determined through ubus (default name to qmi-wan in this case)
+ if ifname == nil then
+ ifname = "modemmanager-" .. self.sid
+ end
+ return ifname
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+ return "modemmanager"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/modemmanager.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("^mobiledata%-%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/modules/luci-compat/luasrc/model/network/proto_ncm.lua b/modules/luci-compat/luasrc/model/network/proto_ncm.lua
new file mode 100644
index 0000000000..49abe23472
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_ncm.lua
@@ -0,0 +1,69 @@
+--[[
+LuCI - Network model - NCM protocol extension
+
+Copyright 2015 Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+]]--
+
+local netmod = luci.model.network
+
+local proto = netmod:register_protocol("ncm")
+local interface = luci.model.network.interface
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("NCM")
+end
+
+function proto.opkg_package(self)
+ return "comgt-ncm"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/ncm.sh")
+end
+
+function proto.is_floating(self)
+ return true
+end
+
+function proto.is_virtual(self)
+ return true
+end
+
+function proto.get_interface(self)
+ local _ifname=netmod.protocol.ifname(self)
+ if not _ifname then
+ _ifname = "wan"
+ end
+ return interface(_ifname, self)
+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("^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/modules/luci-compat/luasrc/model/network/proto_openconnect.lua b/modules/luci-compat/luasrc/model/network/proto_openconnect.lua
new file mode 100644
index 0000000000..0944c7fe6a
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_openconnect.lua
@@ -0,0 +1,45 @@
+-- Copyright 2012 David Woodhouse
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("openconnect")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("OpenConnect (CISCO AnyConnect)")
+end
+
+function proto.ifname(self)
+ return "vpn-" .. self.sid
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+ return "openconnect"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/openconnect.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("^vpn%-%w")
diff --git a/modules/luci-compat/luasrc/model/network/proto_ppp.lua b/modules/luci-compat/luasrc/model/network/proto_ppp.lua
new file mode 100644
index 0000000000..f87b30fcc1
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_ppp.lua
@@ -0,0 +1,82 @@
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+
+local _, p
+for _, p in ipairs({"ppp", "pptp", "pppoe", "pppoa", "l2tp"}) do
+
+ local proto = netmod:register_protocol(p)
+
+ function proto.get_i18n(self)
+ if p == "ppp" then
+ return luci.i18n.translate("PPP")
+ elseif p == "pptp" then
+ return luci.i18n.translate("PPtP")
+ elseif p == "pppoe" then
+ return luci.i18n.translate("PPPoE")
+ elseif p == "pppoa" then
+ return luci.i18n.translate("PPPoATM")
+ elseif p == "l2tp" then
+ return luci.i18n.translate("L2TP")
+ end
+ end
+
+ function proto.ifname(self)
+ return p .. "-" .. self.sid
+ end
+
+ function proto.opkg_package(self)
+ if p == "ppp" then
+ return p
+ elseif p == "pptp" then
+ return "ppp-mod-pptp"
+ elseif p == "pppoe" then
+ return "ppp-mod-pppoe"
+ elseif p == "pppoa" then
+ return "ppp-mod-pppoa"
+ elseif p == "l2tp" then
+ return "xl2tpd"
+ end
+ end
+
+ function proto.is_installed(self)
+ if p == "pppoa" then
+ return (nixio.fs.glob("/usr/lib/pppd/*/pppoatm.so")() ~= nil)
+ elseif p == "pppoe" then
+ return (nixio.fs.glob("/usr/lib/pppd/*/rp-pppoe.so")() ~= nil)
+ elseif p == "pptp" then
+ return (nixio.fs.glob("/usr/lib/pppd/*/pptp.so")() ~= nil)
+ elseif p == "l2tp" then
+ return nixio.fs.access("/lib/netifd/proto/l2tp.sh")
+ else
+ return nixio.fs.access("/lib/netifd/proto/ppp.sh")
+ end
+ end
+
+ function proto.is_floating(self)
+ return (p ~= "pppoe")
+ end
+
+ function proto.is_virtual(self)
+ return true
+ end
+
+ function proto.get_interfaces(self)
+ if self:is_floating() then
+ return nil
+ else
+ return netmod.protocol.get_interfaces(self)
+ end
+ end
+
+ function proto.contains_interface(self, ifc)
+ if self:is_floating() then
+ return (netmod:ifnameof(ifc) == self:ifname())
+ else
+ return netmod.protocol.contains_interface(self, ifc)
+ end
+ end
+
+ netmod:register_pattern_virtual("^%s%%-%%w" % p)
+end
diff --git a/modules/luci-compat/luasrc/model/network/proto_pppossh.lua b/modules/luci-compat/luasrc/model/network/proto_pppossh.lua
new file mode 100644
index 0000000000..a0e2a510c9
--- /dev/null
+++ b/modules/luci-compat/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/modules/luci-compat/luasrc/model/network/proto_qmi.lua b/modules/luci-compat/luasrc/model/network/proto_qmi.lua
new file mode 100644
index 0000000000..c414378d80
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_qmi.lua
@@ -0,0 +1,55 @@
+-- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("qmi")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("QMI Cellular")
+end
+
+function proto.ifname(self)
+ local base = netmod._M.protocol
+ local ifname = base.ifname(self) -- call base class "protocol.ifname(self)"
+
+ -- Note: ifname might be nil if the adapter could not be determined through ubus (default name to qmi-wan in this case)
+ if ifname == nil then
+ ifname = "qmi-" .. self.sid
+ end
+ return ifname
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+ return "uqmi"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/qmi.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("^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/modules/luci-compat/luasrc/model/network/proto_relay.lua b/modules/luci-compat/luasrc/model/network/proto_relay.lua
new file mode 100644
index 0000000000..3b811d44d1
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_relay.lua
@@ -0,0 +1,158 @@
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local device = luci.util.class(netmod.interface)
+
+netmod:register_pattern_virtual("^relay%-%w")
+
+local proto = netmod:register_protocol("relay")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("Relay bridge")
+end
+
+function proto.ifname(self)
+ return "relay-" .. self.sid
+end
+
+function proto.opkg_package(self)
+ return "relayd"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/etc/init.d/relayd")
+end
+
+function proto.is_floating(self)
+ return true
+end
+
+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
+
+function proto.get_interfaces(self)
+ if not self.ifaces then
+ local ifs = { }
+ local _, net, dev
+
+ for net in luci.util.imatch(self:_get("network")) do
+ net = netmod:get_network(net)
+ if net then
+ dev = net:get_interface()
+ if dev then
+ ifs[dev:name()] = dev
+ end
+ end
+ end
+
+ for dev in luci.util.imatch(self:_get("ifname")) do
+ dev = netmod:get_interface(dev)
+ if dev then
+ ifs[dev:name()] = dev
+ end
+ end
+
+ self.ifaces = { }
+
+ for _, dev in luci.util.kspairs(ifs) do
+ self.ifaces[#self.ifaces+1] = dev
+ end
+ end
+
+ return self.ifaces
+end
+
+function proto.uptime(self)
+ local net
+ local upt = 0
+ for net in luci.util.imatch(self:_get("network")) do
+ net = netmod:get_network(net)
+ if net then
+ upt = math.max(upt, net:uptime())
+ end
+ end
+ return upt
+end
+
+function proto.errors(self)
+ return nil
+end
+
+
+function device.__init__(self, ifname, network)
+ self.ifname = ifname
+ self.network = network
+end
+
+function device.type(self)
+ return "tunnel"
+end
+
+function device.is_up(self)
+ if self.network then
+ local _, dev
+ for _, dev in ipairs(self.network:get_interfaces()) do
+ if not dev:is_up() then
+ return false
+ end
+ end
+ return true
+ end
+ return false
+end
+
+function device._stat(self, what)
+ local v = 0
+ if self.network then
+ local _, dev
+ for _, dev in ipairs(self.network:get_interfaces()) do
+ v = v + dev[what](dev)
+ end
+ end
+ return v
+end
+
+function device.rx_bytes(self) return self:_stat("rx_bytes") end
+function device.tx_bytes(self) return self:_stat("tx_bytes") end
+function device.rx_packets(self) return self:_stat("rx_packets") end
+function device.tx_packets(self) return self:_stat("tx_packets") end
+
+function device.mac(self)
+ if self.network then
+ local _, dev
+ for _, dev in ipairs(self.network:get_interfaces()) do
+ return dev:mac()
+ end
+ end
+end
+
+function device.ipaddrs(self)
+ local addrs = { }
+ if self.network then
+ addrs[1] = luci.ip.IPv4(self.network:_get("ipaddr"))
+ end
+ return addrs
+end
+
+function device.ip6addrs(self)
+ return { }
+end
+
+function device.shortname(self)
+ return "%s %q" % { luci.i18n.translate("Relay"), self.ifname }
+end
+
+function device.get_type_i18n(self)
+ return luci.i18n.translate("Relay Bridge")
+end
diff --git a/modules/luci-compat/luasrc/model/network/proto_vpnc.lua b/modules/luci-compat/luasrc/model/network/proto_vpnc.lua
new file mode 100644
index 0000000000..6c3136e384
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_vpnc.lua
@@ -0,0 +1,46 @@
+-- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("vpnc")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("VPNC (CISCO 3000 (and others) VPN)")
+end
+
+function proto.ifname(self)
+ return "vpn-" .. self.sid
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+ return "vpnc"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/vpnc.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("^vpn%-%w")
+
diff --git a/modules/luci-compat/luasrc/model/network/proto_wireguard.lua b/modules/luci-compat/luasrc/model/network/proto_wireguard.lua
new file mode 100644
index 0000000000..d6937618a7
--- /dev/null
+++ b/modules/luci-compat/luasrc/model/network/proto_wireguard.lua
@@ -0,0 +1,42 @@
+-- Copyright 2016 Dan Luedtke <mail@danrl.com>
+-- Licensed to the public under the Apache License 2.0.
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("wireguard")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("WireGuard VPN")
+end
+
+function proto.ifname(self)
+ return self.sid
+end
+
+function proto.get_interface(self)
+ return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+ return "wireguard-tools"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/wireguard.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
diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm b/modules/luci-compat/luasrc/view/cbi/firewall_zonelist.htm
index 7ecec10a8f..7ecec10a8f 100644
--- a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm
+++ b/modules/luci-compat/luasrc/view/cbi/firewall_zonelist.htm
diff --git a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm b/modules/luci-compat/luasrc/view/cbi/network_ifacelist.htm
index f23e51d18d..f23e51d18d 100644
--- a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm
+++ b/modules/luci-compat/luasrc/view/cbi/network_ifacelist.htm
diff --git a/modules/luci-base/luasrc/view/cbi/network_netinfo.htm b/modules/luci-compat/luasrc/view/cbi/network_netinfo.htm
index 4fd84112a4..4fd84112a4 100644
--- a/modules/luci-base/luasrc/view/cbi/network_netinfo.htm
+++ b/modules/luci-compat/luasrc/view/cbi/network_netinfo.htm
diff --git a/modules/luci-base/luasrc/view/cbi/network_netlist.htm b/modules/luci-compat/luasrc/view/cbi/network_netlist.htm
index 3ee4274a33..3ee4274a33 100644
--- a/modules/luci-base/luasrc/view/cbi/network_netlist.htm
+++ b/modules/luci-compat/luasrc/view/cbi/network_netlist.htm