diff options
Diffstat (limited to 'modules/niu/luasrc/model')
25 files changed, 0 insertions, 1865 deletions
diff --git a/modules/niu/luasrc/model/cbi/niu/network/assign.lua b/modules/niu/luasrc/model/cbi/niu/network/assign.lua deleted file mode 100644 index b61e4f4007..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/assign.lua +++ /dev/null @@ -1,17 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("assign1", load("niu/network/assign1")) - -function d.on_cancel() - cursor:revert("dhcp") -end - -function d.on_done() - cursor:commit("dhcp") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/assign1.lua b/modules/niu/luasrc/model/cbi/niu/network/assign1.lua deleted file mode 100644 index 0fee331e1c..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/assign1.lua +++ /dev/null @@ -1,96 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- - -local uci = require "luci.model.uci".cursor() -local sys = require "luci.sys" -local fs = require "nixio.fs" - - -local function date_format(secs) - local suff = {"min", "h", "d"} - local mins = 0 - local hour = 0 - local days = 0 - - secs = math.floor(secs) - if secs > 60 then - mins = math.floor(secs / 60) - secs = secs % 60 - end - - if mins > 60 then - hour = math.floor(mins / 60) - mins = mins % 60 - end - - if hour > 24 then - days = math.floor(hour / 24) - hour = hour % 24 - end - - if days > 0 then - return string.format("%.0fd %02.0fh %02.0fmin %02.0fs", days, hour, mins, secs) - else - return string.format("%02.0fh %02.0fmin %02.0fs", hour, mins, secs) - end -end - -m2 = Map("dhcp", "Manage Address Assignment") - -local leasefn, leasefp, leases -uci:foreach("dhcp", "dnsmasq", - function(section) - leasefn = section.leasefile - end -) -local leasefp = leasefn and fs.access(leasefn) and io.lines(leasefn) -if leasefp then - leases = {} - for lease in leasefp do - table.insert(leases, luci.util.split(lease, " ")) - end -end - -if leases then - v = m2:section(Table, leases, translate("Active Leases")) - ip = v:option(DummyValue, 3, translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) - - mac = v:option(DummyValue, 2, translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - - ltime = v:option(DummyValue, 1, translate("Leasetime remaining")) - function ltime.cfgvalue(self, ...) - local value = DummyValue.cfgvalue(self, ...) - return date_format(os.difftime(tonumber(value), os.time())) - end -end - -s = m2:section(TypedSection, "host", "Static Assignment", -"You can assign fixed addresses and DNS names to devices in you local network to make reaching them more easy.") -s.addremove = true -s.anonymous = true -s.template = "cbi/tblsection" - -hn = s:option(Value, "name", translate("Hostname")) -mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) -ip = s:option(Value, "ip", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -sys.net.arptable(function(entry) - ip:value(entry["IP address"]) - mac:value( - entry["HW address"], - entry["HW address"] .. " (" .. entry["IP address"] .. ")" - ) -end) - - -return m2 diff --git a/modules/niu/luasrc/model/cbi/niu/network/ddns.lua b/modules/niu/luasrc/model/cbi/niu/network/ddns.lua deleted file mode 100644 index 0ee821a23e..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/ddns.lua +++ /dev/null @@ -1,18 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("ddns1", load("niu/network/ddns1")) - -function d.on_cancel() - cursor:revert("ddns") -end - -function d.on_done() - cursor:commit("ddns") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua b/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua deleted file mode 100644 index c0873bb2fd..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua +++ /dev/null @@ -1,71 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -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 - -$Id$ -]]-- -local nxo = require "nixio" - -m = Map("ddns", translate("Dynamic DNS"), translate("Dynamic DNS allows that this device can be reached with a fixed hostname while having a dynamically changing IP-Address.")) - -s = m:section(TypedSection, "service", "") -s:depends("enabled", "1") -s.addremove = true - -s.defaults.enabled = "1" -s.defaults.ip_network = "wan" -s.defaults.ip_url = "http://checkip.dyndns.org http://www.whatismyip.com/automation/n09230945.asp" - - -s:tab("general", translate("General Settings")) - -svc = s:taboption("general", ListValue, "service_name", translate("Service")) -svc:value("dyndns.org") -svc:value("no-ip.com") -svc:value("changeip.com") -svc:value("zoneedit.com") - - -s:taboption("general", Value, "username", translate("Username")) -pw = s:taboption("general", Value, "password", translate("Password")) -pw.password = true -local dom = s:taboption("general", Value, "domain", translate("Hostname")) - -local current = s:taboption("general", DummyValue, "_current", "Current IP-Address") - -function current.render(self, section, ...) - if dom:cfgvalue(section) then - return DummyValue.render(self, section, ...) - end -end - -function current.value(self, section) - local dns = nxo.getaddrinfo(dom:cfgvalue(section)) - if dns then - for _, v in ipairs(dns) do - if v.family == "inet" then - return v.address - end - end - end - return "" -end - -s:tab("expert", translate("Expert Settings")) - -local src = s:taboption("expert", ListValue, "ip_source", "External IP Determination") -src.default = "web" -src:value("web", "CheckIP / WhatIsMyIP webservice") -src:value("network", "External Address as seen locally") - - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua b/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua deleted file mode 100644 index 56350b3ff6..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua +++ /dev/null @@ -1,161 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -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 - -$Id$ -]]-- - -local fs = require "nixio.fs" - -local has_ipv6 = fs.access("/proc/net/ipv6_route") -local has_pptp = fs.access("/usr/sbin/pptp") -local has_pppd = fs.access("/usr/sbin/pppd") -local has_pppoe = fs.glob("/usr/lib/pppd/*/rp-pppoe.so")() -local has_pppoa = fs.glob("/usr/lib/pppd/*/pppoatm.so")() - - -m = Map("network", "Configure Ethernet Adapter for Internet Connection") - -s = m:section(NamedSection, "wan", "interface") -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("general", ListValue, "proto", translate("Connection Protocol")) -p.override_scheme = true -p.default = "dhcp" -p:value("dhcp", translate("Cable / Ethernet / DHCP")) -if has_pppoe then p:value("pppoe", "DSL / PPPoE") end -if has_pppoa then p:value("pppoa", "PPPoA") end -if has_pptp then p:value("pptp", "PPTP") end -p:value("static", translate("Static Ethernet")) - - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.rmempty = true -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.rmempty = true -nm:depends("proto", "static") -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") - -gw = s:taboption("general", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") -gw.rmempty = true - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - - -srv = s:taboption("general", Value, "server", translate("<abbr title=\"Point-to-Point Tunneling Protocol\">PPTP</abbr>-Server")) -srv:depends("proto", "pptp") -srv.rmempty = true - -if has_pppd or has_pppoe or has_pppoa or has_pptp then - user = s:taboption("general", Value, "username", translate("Username")) - user.rmempty = true - user:depends("proto", "pptp") - user:depends("proto", "pppoe") - user:depends("proto", "pppoa") - - pass = s:taboption("general", Value, "password", translate("Password")) - pass.rmempty = true - pass.password = true - pass:depends("proto", "pptp") - pass:depends("proto", "pppoe") - pass:depends("proto", "pppoa") - - ka = s:taboption("expert", Value, "keepalive", - translate("Keep-Alive"), - translate("Number of failed connection tests to initiate automatic reconnect") - ) - ka.default = "5" - ka:depends("proto", "pptp") - ka:depends("proto", "pppoe") - ka:depends("proto", "pppoa") - - demand = s:taboption("expert", Value, "demand", - translate("Automatic Disconnect"), - translate("Time (in seconds) after which an unused connection will be closed") - ) - demand:depends("proto", "pptp") - demand:depends("proto", "pppoe") - demand:depends("proto", "pppoa") -end - -if has_pppoa then - encaps = s:taboption("expert", ListValue, "encaps", translate("PPPoA Encapsulation")) - encaps:depends("proto", "pppoa") - encaps:value("", translate("-- Please choose --")) - encaps:value("vc", "VC") - encaps:value("llc", "LLC") - - vpi = s:taboption("expert", Value, "vpi", "VPI") - vpi:depends("proto", "pppoa") - - vci = s:taboption("expert", Value, "vci", "VCI") - vci:depends("proto", "pppoa") -end - -if has_pptp or has_pppd or has_pppoe or has_pppoa or has_3g then ---[[ - defaultroute = s:taboption("expert", Flag, "defaultroute", - translate("Replace default route"), - translate("Let pppd replace the current default route to use the PPP interface after successful connect") - ) - defaultroute:depends("proto", "pppoa") - defaultroute:depends("proto", "pppoe") - defaultroute:depends("proto", "pptp") - defaultroute.rmempty = false - function defaultroute.cfgvalue(...) - return ( AbstractValue.cfgvalue(...) or '1' ) - end -]] - peerdns = s:taboption("expert", Flag, "peerdns", - translate("Use peer DNS"), - translate("Configure the local DNS server to use the name servers adverticed by the PPP peer") - ) - peerdns:depends("proto", "pppoa") - peerdns:depends("proto", "pppoe") - peerdns:depends("proto", "pptp") - peerdns.rmempty = false - peerdns.default = "1" - - if has_ipv6 then - ipv6 = s:taboption("expert", Flag, "ipv6", translate("Enable IPv6 on PPP link") ) - ipv6:depends("proto", "pppoa") - ipv6:depends("proto", "pppoe") - ipv6:depends("proto", "pptp") - end -end - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan.lua b/modules/niu/luasrc/model/cbi/niu/network/lan.lua deleted file mode 100644 index ee70dd2cc7..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/lan.lua +++ /dev/null @@ -1,44 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("lan1", "niu/network/lan1") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("dhcp") -end - -function d.on_done() - if uci.inst_state:get("network", "lan", "ipaddr") ~= cursor:get("network", "lan", "ipaddr") then - local cs = uci.cursor_state() - cs:set("network", "lan", "_ipchanged", "1") - cs:save("network") - end - - if cursor:get("network", "lan", "proto") == "dhcp" then - local emergv4 = cursor:get("network", "lan", "_emergv4") - if emergv4 then - if cursor:get("network", "lan_ea") then - cursor:set("network", "lan_ea", "ipaddr", emergv4) - else - cursor:section("network", "alias", "lan_ea", { - ipaddr = emergv4, - netmask = "255.255.255.0", - network = "lan" - }) - end - else - cursor:delete("network", "lan_ea") - end - end - - cursor:set("network", "lan", "type", "bridge") - cursor:commit("network") - cursor:commit("dhcp") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua deleted file mode 100644 index 62795da15c..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua +++ /dev/null @@ -1,131 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -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 - -$Id$ -]]-- - -local bridge = (arg[1] == "bridgelan") -local niulib = require "luci.niulib" -local fs = require "nixio.fs" -local has_ipv6 = fs.access("/proc/net/ipv6_route") - -m = Map("network", translate("Configure Local Network"), bridge and -translate([[The wireless network will be connected directly to your local network. -Make sure you to assign any address to this device that is in the same subnet -of the other devices in your network but that is not already occupied. -If you have a DHCP-Server in this network you may also choose DHCP for address configuration.]]) -or translate("These settings affect the devices in your local network. ".. -"Usually you do not need to change anything here for this device to work correctly.")) - -s = m:section(NamedSection, "lan", "interface", "Network Settings") -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("expert", ListValue, "proto", translate("Address Configuration")) -p.default = "static" -p:value("static", translate("Static Configuration")) -p:value("dhcp", "DHCP") - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.default = "192.168.0.1" -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.default = "255.255.255.0" -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") -nm:depends("proto", "static") - - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - - -gw = s:taboption(bridge and "general" or "expert", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -emerg = s:taboption("expert", Value, "_emergv4", translate("Emergency Access Address"), -translate([[In case the DHCP request fails you will still be able to access this device using given IP -by configuring your computer to an address in the same subnet and netmask 255.255.255.0.]])) -emerg:depends("proto", "dhcp") -emerg:value("", translate("disable")) -emerg.default = "169.254.255.169" - - -stp = s:taboption("expert", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"), - translate("Enables the Spanning Tree Protocol on this bridge")) - -ifname_multi = s:taboption("expert", MultiValue, "ifname", translate("Interface")) -ifname_multi.widget = "checkbox" -for _, eth in ipairs(niulib.eth_get_available("lan")) do - ifname_multi:value(eth, translate("Ethernet-Adapter (%s)") % eth) -end - - -m2 = Map("dhcp") - -s = m2:section(TypedSection, "dhcp", "DHCP") -s.anonymous = true -s.addremove = false -s.dynamic = false - -s:tab("general", translate("General Settings")) - -s:depends("interface", "lan") - -enable = s:taboption("general", ListValue, "ignore", translate("Automatic address assignment for network devices"), -bridge and -translate("Note: Be careful that you do not accidently two DHCP servers in the same network with overlapping address ranges.") -or "") -enable:value(0, translate("enable"), {["network.lan.proto"] = "static"}) -enable:value(1, translate("disable")) - - -s:tab("expert", translate("Expert Settings")) -start = s:taboption("expert", Value, "start", translate("First leased address")) -start:depends("ignore", "0") -start.default = "100" - -limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "") -limit:depends("ignore", "0") -limit.default = "150" - -time = s:taboption("expert", Value, "leasetime", translate("Lease Time")) -time:depends("ignore", "0") -time.default = "12h" - -local dd = s:taboption("expert", Flag, "dynamicdhcp", translate("Also generate addresses for unknown devices")) -dd.rmempty = false -dd.default = "1" -dd:depends("ignore", "0") - -return m, m2
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wan.lua b/modules/niu/luasrc/model/cbi/niu/network/wan.lua deleted file mode 100644 index b8d572d831..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wan.lua +++ /dev/null @@ -1,88 +0,0 @@ -local cursor = require "luci.model.uci".cursor() - -if not cursor:get("network", "wan") then - cursor:section("network", "interface", "wan", {proto = "none"}) - cursor:save("network") -end - -if not cursor:get("wireless", "client") then - cursor:section("wireless", "wifi-iface", "client", - {device = "_", doth = "1", _niu = "1", mode = "sta"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("network") - local wd = cursor:get("network", "wan", "_wandev") or "" - - if wd == "none" then - cursor:set("network", "wan", "proto", "none") - end - - if wd:find("ethernet:") == 1 then - cursor:set("network", "wan", "defaultroute", "1") - if wd:find("!", 10) == 10 then --Unbridge from LAN - local ethdev = wd:sub(11) - local ifname = cursor:get("network", "lan", "ifname") - local newifname = {} - for k in ifname:gmatch("[^ ]+") do - if k ~= ifname then - newifname[#newifname+1] = k - end - end - cursor:set("network", "lan", "ifname", table.concat(newifname, " ")) - cursor:set("network", "wan", "_wandev", "ethernet:" .. ethdev) - cursor:set("network", "wan", "ifname", ethdev) - else - cursor:set("network", "wan", "ifname", wd:sub(10)) - end - self:set_route("etherwan") - else - cursor:delete("network", "wan", "ifname") - end - - if wd:find("wlan:") == 1 then - local widev = wd:sub(6) - if cursor:get("wireless", "client", "device") ~= widev then - cursor:delete("wireless", "client", "network") - cursor:set("wireless", "client", "mode", "sta") - cursor:set("wireless", "client", "device", widev) - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == widev and s._niu ~= "1" - end) - cursor:set("wireless", widev, "disabled", 0) - end - self:set_route("wlanwan1", "wlanwan2") - else - cursor:delete("wireless", "client", "device") - cursor:delete("wireless", "client", "network") - end - - - cursor:save("wireless") - cursor:save("network") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/network/wandevice") -d:add("deviceroute", deviceroute) -d:set("etherwan", "niu/network/etherwan") -d:set("wlanwan1", "niu/network/wlanwanscan") -d:set("wlanwan2", "niu/network/wlanwan") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("wireless") -end - -function d.on_done() - cursor:commit("network") - cursor:commit("wireless") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua b/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua deleted file mode 100644 index 8917b97c08..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua +++ /dev/null @@ -1,47 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- - -local niulib = require "luci.niulib" - -m = Map("network", "Configure Internet Connection") -s = m:section(NamedSection, "wan", "interface", "Internet Connection Device") -s.anonymous = true -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -l = s:taboption("general", ListValue, "_wandev", "Internet Connection via") - -for _, ifc in ipairs(niulib.eth_get_available("wan")) do - l:value("ethernet:%s" % ifc, "Cable / DSL / Ethernet-Adapter (%s)" % ifc) -end - -for _, wifi in ipairs(niulib.wifi_get_available("client")) do - l:value("wlan:%s" % wifi, "WLAN-Adapter (%s)" % wifi) -end - -for _, ifc in ipairs(niulib.eth_get_bridged("lan")) do - l:value("ethernet:!%s" % ifc, "Used Ethernet-Adapter (%s)" % ifc, {_showused = "1"}) -end - -l:value("none", "No Internet Connection") - -v = s:taboption("expert", ListValue, "_showused", translate("Show ethernet adapters in use")) -v:value("", translate("never")) -v:value("1", translate("from LAN-bridge, unbridge on-demand")) - - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua b/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua deleted file mode 100644 index 40d2486bc4..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua +++ /dev/null @@ -1,284 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -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 - -$Id$ -]]-- - -local fs = require "nixio.fs" -local uci = require "luci.model.uci" -local nixio = require "nixio" -local iwinfo = require "iwinfo" - -local bridge -local iface = "client" -local net = "wan" -if arg[1] == "bridge" then - bridge = true - iface = "bridge" - net = "lan" -end - -local cursor = uci.inst -local state = uci.inst_state -cursor:unload("wireless") -state:unload("wireless") - -local has_ipv6 = fs.access("/proc/net/ipv6_route") -local device = cursor:get("wireless", iface, "device") -local hwtype = cursor:get("wireless", device, "type") - - --- Bring up interface and scan -- - -if not state:get("wireless", iface, "network") then - local olduci = uci.cursor(nil, "") - local oldcl = olduci:get_all("wireless", iface) - olduci:unload("wireless") - - local newuci = uci.cursor() - local newcl = newuci:get_all("wireless", iface) - newcl.network = net - - local proc = nixio.fork() - if proc == 0 then - newuci:delete("wireless", iface, "ssid") - newuci:commit("wireless") - nixio.exec("/sbin/wifi", "up", device) - os.exit(1) - end - nixio.wait(proc) - - newuci:delete("wireless", iface) - newuci:section("wireless", "wifi-iface", iface, oldcl) - newuci:commit("wireless") - newuci:tset("wireless", iface, newcl) - newuci:save("wireless") - newuci:unload("wireless") - - state:unload("wireless") -end - -local ifname = state:get("wireless", iface, "ifname") or "wlan0dummy" -local iwlib = iwinfo.type(ifname) and iwinfo[iwinfo.type(ifname)] -local suggest = {} -local encrdep = { - none = {{["!default"] = 1}}, - wep = {{["!default"] = 1}}, - psk = {{["!default"] = 1}}, - psk2 = {{["!default"] = 1}}, - wpa = {{["!default"] = 1}}, - wpa2 = {{["!default"] = 1}} -} - -if iwlib then - suggest = iwlib.scanlist(ifname) -end - - - --- Form definition -- - -m2 = Map("wireless", translate("Configure WLAN-Adapter for Client Connection"), -bridge and ("<strong>" .. translate([[It is absolutely necessary that the network you are joining -supports and allows bridging (WDS) otherwise your connection will fail.]]) .. "</strong> " .. -translate([[Note: You can use the access point wizard to configure your -private access point to increase the range of the network you are connected to.]])) or "") - -s = m2:section(NamedSection, iface, "wifi-iface", translate("Wireless Settings")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -local ssid = s:taboption("general", Value, "ssid", translate("Network Name (<abbr title=\"Extended Service Set Identifier\">ESSID</abbr>)")) -ssid.rmempty = false - -for _, v in ipairs(suggest) do - if v.mode == "Master" then - ssid:value(v.ssid) - - if not v.wep then - encrdep.wep[#encrdep.wep+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa ~= 1 or (v.wpa == 1 and v.auth_suites[1] ~= "802.1x") then - encrdep.wpa[#encrdep.wpa+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa ~= 1 or (v.wpa == 1 and v.auth_suites[1] ~= "PSK") then - encrdep.psk[#encrdep.psk+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if not v.wpa or v.wpa < 2 or (v.wpa >= 2 and v.auth_suites[1] ~= "802.1x") then - encrdep.wpa2[#encrdep.wpa2+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if not v.wpa or v.wpa < 2 or (v.wpa >= 2 and v.auth_suites[1] ~= "PSK") then - encrdep.psk2[#encrdep.psk2+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa or v.wep then - encrdep.none[#encrdep.none+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - end -end - -mode = s:taboption("expert", ListValue, "mode", translate("Operating Mode")) -mode.override_values = true -mode:value("sta", translate("Client")) - -encr = s:taboption("general", ListValue, "encryption", translate("Encryption")) - - -if hwtype == "mac80211" then - if not bridge then - mode:value("mesh", translate("Mesh (802.11s)")) - local meshid = s:taboption("expert", Value, "mesh_id", translate("Mesh ID")) - meshid:depends("mode", "mesh") - end - - local ps = s:taboption("expert", Flag, "powersave", translate("Enable Powersaving")) - ps:depends("mode", "sta") -elseif hwtype == "atheros" then - s:taboption("expert", Flag, "bursting", translate("Allow Burst Transmissions")) -end - - - --- Encryption -- - -encr.override_values = true -encr.override_depends = true -encr:value("none", "No Encryption", unpack(encrdep.none)) -encr:value("wep", "WEP", unpack(encrdep.wep)) - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - local supplicant = fs.access("/usr/sbin/wpa_supplicant") or os.getenv("LUCI_SYSROOT") - if supplicant then - encr:value("psk", "WPA", unpack(encrdep.psk)) - encr:value("wpa", "WPA-EAP", unpack(encrdep.wpa)) - encr:value("psk2", "WPA2", unpack(encrdep.psk2)) - encr:value("wpa2", "WPA2-EAP (802.11i)", unpack(encrdep.wpa2)) - end -elseif hwtype == "broadcom" then - encr:value("psk", "WPA", unpack(encrdep.psk)) - encr:value("psk2", "WPA2", unpack(encrdep.psk2)) -end - -key = s:taboption("general", Value, "key", translate("Password")) -key:depends("encryption", "wep") -key:depends("encryption", "psk") -key:depends("encryption", "psk2") -key.rmempty = true -key.password = true - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - eaptype = s:taboption("general", ListValue, "eap_type", translate("EAP-Method")) - eaptype:value("TLS") - eaptype:value("TTLS") - eaptype:value("PEAP") - eaptype:depends({encryption="wpa"}) - eaptype:depends({encryption="wpa2"}) - - cacert = s:taboption("general", FileUpload, "ca_cert", translate("Path to CA-Certificate")) - cacert:depends({encryption="wpa"}) - cacert:depends({encryption="wpa2"}) - - privkey = s:taboption("general", FileUpload, "priv_key", translate("Path to Private Key")) - privkey:depends({eap_type="TLS", encryption="wpa2"}) - privkey:depends({eap_type="TLS", encryption="wpa"}) - - privkeypwd = s:taboption("general", Value, "priv_key_pwd", translate("Password of Private Key")) - privkeypwd:depends({eap_type="TLS", encryption="wpa2"}) - privkeypwd:depends({eap_type="TLS", encryption="wpa"}) - - - auth = s:taboption("general", Value, "auth", translate("Authentication")) - auth:value("PAP") - auth:value("CHAP") - auth:value("MSCHAP") - auth:value("MSCHAPV2") - auth:depends({eap_type="PEAP", encryption="wpa2"}) - auth:depends({eap_type="PEAP", encryption="wpa"}) - auth:depends({eap_type="TTLS", encryption="wpa2"}) - auth:depends({eap_type="TTLS", encryption="wpa"}) - - - identity = s:taboption("general", Value, "identity", translate("Identity")) - identity:depends({eap_type="PEAP", encryption="wpa2"}) - identity:depends({eap_type="PEAP", encryption="wpa"}) - identity:depends({eap_type="TTLS", encryption="wpa2"}) - identity:depends({eap_type="TTLS", encryption="wpa"}) - - password = s:taboption("general", Value, "password", translate("Password")) - password:depends({eap_type="PEAP", encryption="wpa2"}) - password:depends({eap_type="PEAP", encryption="wpa"}) - password:depends({eap_type="TTLS", encryption="wpa2"}) - password:depends({eap_type="TTLS", encryption="wpa"}) -end - - - -if not bridge then - -m = Map("network") - -s = m:section(NamedSection, net, "interface", translate("Address Settings")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("general", ListValue, "proto", "Connection Type") -p.override_scheme = true -p.default = "dhcp" -p:value("dhcp", "Automatic Configuration (DHCP)") -p:value("static", "Static Configuration") - - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.rmempty = true -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.rmempty = true -nm:depends("proto", "static") -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") - -gw = s:taboption("general", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") -gw.rmempty = true - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - -return m2, m - -else - -return m2 - -end
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua b/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua deleted file mode 100644 index 4035ff415d..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua +++ /dev/null @@ -1,12 +0,0 @@ -local t = Template("niu/network/wlanwanscan") -function t.parse(self, ...) - local state = Template.parse(self, ...) - if Map.formvalue({readinput = true}, "cbi.delg.back") then - return FORM_SKIP - end - if state == FORM_NODATA then - self.delegator.disallow_pageactions = true - end - return state -end -return t
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/system/general.lua b/modules/niu/luasrc/model/cbi/niu/system/general.lua deleted file mode 100644 index 046691c9c0..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/general.lua +++ /dev/null @@ -1,34 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("general1", load("niu/system/general1")) - -function d.on_cancel() - cursor:revert("luci") -end - -function d.on_done() - local pw1 = cursor:get("luci", "main", "_pw1") - if pw1 and pw1 ~= "**********" then - cursor:delete("luci", "main", "_pw1") - require "luci.sys".user.setpasswd("root", pw1) - end - - local hn = cursor:get("luci", "main", "_uniquename") - if hn then - cursor:foreach("system", "system", function(s) - cursor:set("system", s[".name"], "hostname", hn) - end) - cursor:commit("system") - - require "nixio.fs".writefile("/proc/sys/kernel/hostname", hn) - cursor:delete("luci", "main", "_uniquename") - end - - cursor:commit("luci") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/system/general1.lua b/modules/niu/luasrc/model/cbi/niu/system/general1.lua deleted file mode 100644 index 83481888ce..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/general1.lua +++ /dev/null @@ -1,45 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- - -local fs = require "nixio.fs" -local i18n = require "luci.i18n" -local util = require "luci.util" -local config = require "luci.config" - -m = Map("luci", "Device Settings") - -c = m:section(NamedSection, "main", "core", translate("Local Settings")) - -hn = c:option(Value, "_uniquename", translate("Unique Devicename")) -function hn:cfgvalue(self) - return require "nixio.fs".readfile("/proc/sys/kernel/hostname") -end - -l = c:option(ListValue, "lang", translate("System Language")) -l:value("auto") - -local i18ndir = i18n.i18ndir .. "default." -for k, v in util.kspairs(config.languages) do - local file = i18ndir .. k:gsub("_", "-") - if k:sub(1, 1) ~= "." and fs.access(file .. ".lmo") then - l:value(k, v) - end -end - -pw1 = c:option(Value, "_pw1", translate("Administrator Password")) -pw1.password = true -pw1.default = "**********" - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/system/reboot.lua b/modules/niu/luasrc/model/cbi/niu/system/reboot.lua deleted file mode 100644 index d8f852bdc9..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/reboot.lua +++ /dev/null @@ -1 +0,0 @@ -local f = Form("reboot", "Rebooting Device", "Device is rebooting. Please wait...")
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua b/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua deleted file mode 100644 index bf4e132df1..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua +++ /dev/null @@ -1,20 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("portfw1", load("niu/traffic/portfw1")) - -function d.on_cancel() - cursor:revert("firewall") - cursor:revert("upnpd") -end - -function d.on_done() - cursor:commit("firewall") - cursor:commit("upnpd") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua deleted file mode 100644 index 11ed4aa92d..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua +++ /dev/null @@ -1,65 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- -local fs = require "nixio.fs" -local sys = require "luci.sys" - -m = Map("firewall", translate("Manage Port Forwarding")) - -s = m:section(TypedSection, "redirect", translate("Manual Port Forwarding"), -translate([[To manually define a forwarding rule you have to specify at least -the internal IP-address and port of the service that should be forwarded. -If you ommit the external port it will be the same as the internal port. -You also can forward a range of ports by using the syntax first-last Port -(e.g. 1024-1030) in the port field.]])) -s.template = "cbi/tblsection" -s.addremove = true -s.anonymous = true - -name = s:option(Value, "_name", translate("Name"), translate("optional")) -name.size = 10 - -iface = s:option(ListValue, "src", translate("Zone")) -iface:value("wan", "Internet") -iface.default = "wan" - -proto = s:option(ListValue, "proto", translate("Protocol")) -proto:value("tcp", "TCP") -proto:value("udp", "UDP") -proto:value("tcpudp", "TCP+UDP") - -dport = s:option(Value, "src_dport", translate("Internal Port")) -dport.size = 5 - -to = s:option(Value, "dest_ip", translate("Internal Address"), translate("Device running the service")) -for i, dataset in ipairs(sys.net.arptable()) do - to:value(dataset["IP address"]) -end - -toport = s:option(Value, "dest_port", translate("External Port"), translate("optional")); -toport.size = 5 - -local m2 -if fs.access("/etc/config/upnpd") then - m2 = Map("upnpd") - s = m2:section(NamedSection, "config", "upnpd", translate("Automatic Port Forwarding (UPnP IGD)"), - translate([[Allows UPnP-capable applications to automatically forward ports on the router to their IP-Address. - Be aware that this is a potential security risk as applications are not authenticated.]])) - s.addremove = false - - on = s:option(ListValue, "external_iface", translate("Port Forwarding Restrictions")) - on:value("none", translate("Manual Forwarding Only")) - on:value("wan", translate("Automatic and Manual Forwarding")) -end - -return m, m2 diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua b/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua deleted file mode 100644 index aa1f3f89e4..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua +++ /dev/null @@ -1,36 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() - -if not cursor:get("qos", "wan", "_niuinit") then - -- Load some more sensible default classifications - cursor:delete_all("qos", "classify") - cursor:section("qos", "classify", "dns", - {target = "Priority", ports = "53", _name = "DNS"} - ) - cursor:section("qos", "classify", "inet1", - {target = "Normal", ports = "20,21,22,80,443", _name = "WWW, SSH, FTP"} - ) - cursor:section("qos", "classify", "inet2", - {target = "Normal", ports = "25,110,119,143", _name = "E-Mail, News"} - ) - - cursor:set("qos", "wan", "_niuinit", "1") - cursor:save("qos") -end - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("qos1", load("niu/traffic/qos1")) - -function d.on_cancel() - cursor:revert("qos") -end - -function d.on_done() - cursor:commit("qos") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua deleted file mode 100644 index 6171dfaa71..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua +++ /dev/null @@ -1,89 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -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 - -$Id$ -]]-- - -local sys = require "luci.sys" -local fs = require "nixio.fs" - -m = Map("qos", translate("Manage Prioritization (QoS)"), translate([[Different -kinds of network traffic usually have different transmission requirements. -For example the important factor for a large HTTP-download is bandwith whereas -VoIP has a large focus on low packet latency. Prioritization takes these quality -of service factors into account and optimizes priorities to allow reasonable -performance for time critical services.]])) - -s = m:section(NamedSection, "wan", "interface", translate("General Settings"), -translate([[For QoS to work correctly you need to provide the upload and -download speed of your internet connection. Values are in kilobits per second. -For comparison a standard consumer ADSL connection has between 1000 and 25000 -kbps as donwload speed and between 128 and 1000 kbps upload speed.]])) -s.addremove = false - -local en = s:option(ListValue, "enabled", translate("Prioritization")) -en:value("1", "Enable Quality of Service") -en:value("0", "Disable") - -local dl = s:option(Value, "download", translate("Maximum Download Speed"), "kbps") -dl:depends("enabled", "1") - -local ul = s:option(Value, "upload", translate("Maximum Upload Speed"), "kbps") -ul:depends("enabled", "1") - -s = m:section(TypedSection, "classify", translate("Finetuning"), translate([[ -The QoS application provides different useful default prioritization rules not -listed here that cover many common use-cases. You however can add custom rules -to finetune the prioritization process.]])) -s.template = "cbi/tblsection" - -s.anonymous = true -s.addremove = true - -n = s:option(Value, "_name", translate("Name"), translate("optional")) - -srch = s:option(Value, "srchost", translate("Local IP-Address")) -srch.rmempty = true -srch:value("", translate("all")) -for i, dataset in ipairs(sys.net.arptable()) do - srch:value(dataset["IP address"]) -end - -p = s:option(ListValue, "proto", translate("Protocol")) -p:value("", translate("all")) -p:value("tcp", "TCP") -p:value("udp", "UDP") -p.rmempty = true - -ports = s:option(Value, "ports", translate("Ports")) -ports.rmempty = true -ports:value("", translate("any")) - -if fs.access("/etc/l7-protocols") then - l7 = s:option(ListValue, "layer7", translate("Service")) - l7.rmempty = true - l7:value("", translate("all")) - for f in fs.glob("/etc/l7-protocols/*.pat") do - l7:value(f:sub(19, #f-4)) - end -end - -s:option(Value, "connbytes", translate("Bytes sent"), translate("from[-to]")) - -t = s:option(ListValue, "target", translate("Priority")) -t:value("Priority", translate("Highest")) -t:value("Express", translate("High")) -t:value("Normal", translate("Normal")) -t:value("Bulk", translate("Low")) -t.default = "Normal" - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua b/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua deleted file mode 100644 index f8e8a8af98..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua +++ /dev/null @@ -1,17 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("routes1", load("niu/traffic/routes1")) - -function d.on_cancel() - cursor:revert("network") -end - -function d.on_done() - cursor:commit("network") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua deleted file mode 100644 index f09cf076c2..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua +++ /dev/null @@ -1,57 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- - -m = Map("network", translate("Manage Traffic Routing"), -translate("With additional static routes you allow computers on your network to reach unannounced remote hosts or networks.")) - -local routes6 = luci.sys.net.routes6() -local bit = require "bit" - -m:append(Template("niu/network/rtable")) - -s = m:section(TypedSection, "route", "Static IPv4 Routes") -s.addremove = true -s.anonymous = true - -s.template = "cbi/tblsection" - -iface1 = s:option(ListValue, "interface", translate("Interface")) - -s:option(Value, "target", translate("Target"), translate("Host-<abbr title=\"Internet Protocol Address\">IP</abbr> or Network")) -s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"), translate("if target is a network")).rmemepty = true -s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) - -if routes6 then - s = m:section(TypedSection, "route6", "Static IPv6 Routes") - s.addremove = true - s.anonymous = true - - s.template = "cbi/tblsection" - - iface2 = s:option(ListValue, "interface", translate("Interface")) - - s:option(Value, "target", translate("Target"), translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address or Network (CIDR)")) - s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")).rmempty = true -end - -m.uci:foreach("network", "interface", function(s) - if s[".name"] ~= "loopback" then - iface:value(s[".name"]) - if iface2 then - iface2:value(s[".name"]) - end - end -end) - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua b/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua deleted file mode 100644 index 77325d30cb..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua +++ /dev/null @@ -1,52 +0,0 @@ -local cursor = require "luci.model.uci".cursor() - -if not cursor:get("wireless", "ap") then - cursor:section("wireless", "wifi-iface", "ap", - {device = "_", doth = "1", _niu = "1", mode = "ap"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("wireless") - local d = cursor:get("wireless", "ap", "device") - local t = cursor:get("wireless", "ap", "_cfgtpl") - if d ~= "none" then - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == d and s._niu ~= "1" - end) - cursor:set("wireless", d, "disabled", 0) - cursor:set("wireless", "ap", "network", "lan") - if t and #t > 0 then - cursor:delete("wireless", "ap", "_cfgtpl") - cursor:set("wireless", "ap", "ssid", cursor:get("wireless", "bridge", "ssid")) - cursor:set("wireless", "ap", "encryption", cursor:get("wireless", "bridge", "encryption")) - cursor:set("wireless", "ap", "key", cursor:get("wireless", "bridge", "key")) - cursor:set("wireless", "ap", "wds", "1") - end - - self:set_route("ap1") - else - cursor:delete("wireless", "ap", "network") - end - cursor:save("wireless") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/wireless/apdevice") -d:add("deviceroute", deviceroute) -d:set("ap1", "niu/wireless/ap1") - -function d.on_cancel() - cursor:revert("wireless") -end - -function d.on_done() - cursor:commit("wireless") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua b/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua deleted file mode 100644 index 3ecbf5f4a2..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua +++ /dev/null @@ -1,310 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -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 - -$Id$ -]]-- - -local iface = "ap" -local ap = true - -local fs = require "nixio.fs" -local sys = require "luci.sys" -local cursor = require "luci.model.uci".inst -local state = require "luci.model.uci".inst_state -cursor:unload("wireless") - - -local device = cursor:get("wireless", iface, "device") -local hwtype = cursor:get("wireless", device, "type") - -local nsantenna = cursor:get("wireless", device, "antenna") - -local iw = nil -local tx_powers = {} -local chan = {} - -state:foreach("wireless", "wifi-iface", - function(s) - if s.device == device and not iw then - iw = sys.wifi.getiwinfo(s.ifname or s.device) - chan = iw and iw.freqlist or { } - tx_powers = iw.txpwrlist or { } - end - end) - -local m - - -if ap then -m = Map("wireless", translate("Configure Access Point")) -end - ---- Device Settings --- -s = m:section(NamedSection, device, "wifi-device", "Device Configuration") -s.addremove = false - -s:tab("general", translate("General Settings")) - -ch = s:taboption("general", Value, "channel", translate("Channel")) -ch:value("auto", translate("automatic")) -for _, f in ipairs(chan) do - ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 }) -end - - - -s:tab("expert", translate("Expert Settings")) -if hwtype == "mac80211" then - local macaddr = cursor:get("wireless", device, "macaddr") or "!" - local hwmode = cursor:get("wireless", device, "hwmode") - local modes = {} - local phy - local allowed = {} - for entry in fs.glob("/sys/class/ieee80211/*") do - if (fs.readfile(entry .. "/macaddress") or ""):find(macaddr) == 1 then - phy = entry:sub(22) - end - end - if phy then - local iwp = io.popen("iw phy " .. phy .. " info") - local iwin = iwp:read("*a") - - if iwp then - iwp:close() - local htcap = iwin:match("HT capabilities:%s*0x([0-9a-fA-F]+)") - allowed.n = (htcap and tonumber(htcap, 16) or 0) > 0 - allowed.g = iwin:find("2412 MHz") - allowed.a = iwin:find("5180 MHz") - end - end - - if next(allowed) then - mode = s:taboption("expert", ListValue, "hwmode", translate("Communication Protocol")) - if allowed.n and allowed.g then - mode:value("11ng", "802.11n (2.4 GHz)") - end - if allowed.n and allowed.a then - mode:value("11na", "802.11n (5 GHz)") - end - if allowed.a then - mode:value("11a", "802.11a (5 GHz)") - end - if allowed.g then - mode:value("11g", "802.11g (2.4 GHz)") - mode:value("11bg", "802.11b+g (2.4 GHz)") - mode:value("11b", "802.11b (2.4 GHz)") - end - end - - tp = s:taboption("expert", - (tx_powers and #tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmission Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw and iw.txpwrlist or {}) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end -elseif hwtype == "atheros" then - tp = s:taboption("expert", - (#tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmission Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw.txpwrlist) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end - - mode = s:taboption("expert", ListValue, "hwmode", translate("Communication Protocol")) - mode:value("", translate("automatic")) - mode:value("11g", "802.11g") - mode:value("11b", "802.11b") - mode:value("11bg", "802.11b+g") - mode:value("11a", "802.11a") - mode:value("11gst", "802.11g + Turbo") - mode:value("11ast", "802.11a + Turbo") - - if nsantenna then -- NanoFoo - local ant = s:taboption("expert", ListValue, "antenna", translate("Transmitter Antenna")) - ant:value("auto") - ant:value("vertical") - ant:value("horizontal") - ant:value("external") - ant.default = "auto" - end -elseif hwtype == "broadcom" then - tp = s:taboption("expert", - (#tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmit Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw.txpwrlist) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end - - mp = s:taboption("expert", ListValue, "macfilter", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("allow", translate("Allow listed only")) - mp:value("deny", translate("Allow all except listed")) - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macfilter="allow"}) - ml:depends({macfilter="deny"}) - - s:taboption("expert", Flag, "frameburst", translate("Allow Burst Transmissions")) -elseif hwtype == "prism2" then - s:taboption("expert", Value, "txpower", translate("Transmission Power"), "att units").rmempty = true -end - - - - -s = m:section(NamedSection, iface, "wifi-iface", translate("Interface Details")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - - - -local ssid = s:taboption("general", Value, "ssid", translate("Network Name (<abbr title=\"Extended Service Set Identifier\">ESSID</abbr>)")) - -mode = s:taboption("expert", ListValue, "mode", translate("Operating Mode")) -mode.override_values = true -mode:value("ap", translate("Access Point")) - -encr = s:taboption("expert", ListValue, "encryption", translate("Encryption")) - - -if hwtype == "mac80211" then - mode:value("mesh", translate("Mesh (802.11s)")) - local meshid = s:taboption("expert", Value, "mesh_id", translate("Mesh ID")) - meshid:depends("mode", "mesh") - - s:taboption("expert", Flag, "wds", translate("Enable Bridging and Repeating (WDS)")):depends("mode", "ap") - s:taboption("expert", Flag, "powersave", translate("Enable Powersaving")):depends("mode", "ap") -elseif hwtype == "atheros" then - -- mode:value("wds", translate("Static WDS")) - - mp = s:taboption("expert", ListValue, "macpolicy", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("deny", translate("Allow listed only")) - mp:value("allow", translate("Allow all except listed")) - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macpolicy="allow"}) - ml:depends({macpolicy="deny"}) - - s:taboption("expert", Flag, "wds", translate("Enable Bridging and Repeating (WDS)")) - - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="ap-wds"}) - - isolate = s:taboption("expert", Flag, "isolate", translate("Prevent communication between clients")) - isolate:depends({mode="ap"}) - end - - s:taboption("expert", Flag, "bursting", translate("Allow Burst Transmissions")) -elseif hwtype == "broadcom" then - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="wds"}) - - isolate = s:taboption("expert", Flag, "isolate", translate("Prevent communication between clients")) - isolate:depends({mode="ap"}) - end -elseif hwtype == "prism2" then - mp = s:taboption("expert", ListValue, "macpolicy", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("deny", translate("Allow listed only")) - mp:value("allow", translate("Allow all except listed")) - - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macpolicy="allow"}) - ml:depends({macpolicy="deny"}) - - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="wds"}) - end -end - --- Encryption -- - -encr.default = "wep" -- Early default -encr.override_values = true -encr.override_depends = true -encr:value("none", "No Encryption") -encr:value("wep", "WEP", {mode="ap"}) - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - local hostapd = fs.access("/usr/sbin/hostapd") or os.getenv("LUCI_SYSROOT") - local supplicant = fs.access("/usr/sbin/wpa_supplicant") or os.getenv("LUCI_SYSROOT") - - if hostapd and not supplicant then - encr:value("psk", "WPA", {mode="ap"}) - encr:value("wpa", "WPA-EAP", {mode="ap"}) - encr:value("psk-mixed", "WPA + WPA2", {mode="ap"}) - encr:value("psk2", "WPA2", {mode="ap"}) - encr:value("wpa2", "WPA2-EAP (802.11i)", {mode="ap"}) - encr.default = "psk-mixed" - elseif not hostapd and supplicant then - encr:value("psk", "WPA", {mode="mesh"}) - encr:value("psk2", "WPA2", {mode="mesh"}) - encr.default = "psk2" - elseif hostapd and supplicant then - encr:value("psk", "WPA", {mode="ap"}, {mode="mesh"}) - encr:value("wpa", "WPA-EAP", {mode="ap"}) - encr:value("psk-mixed", "WPA + WPA2", {mode="ap"}) - encr:value("psk2", "WPA2", {mode="ap"}, {mode="mesh"}) - encr:value("wpa2", "WPA2-EAP (802.11i)", {mode="ap"}) - encr.default = "psk-mixed" - end -elseif hwtype == "broadcom" then - encr:value("psk", "WPA") - encr:value("psk+psk2", "WPA + WPA2") - encr:value("psk2", "WPA2") - encr.default = "psk+psk2" -end - -server = s:taboption("general", Value, "server", translate("Radius-Server")) -server:depends({mode="ap", encryption="wpa"}) -server:depends({mode="ap", encryption="wpa2"}) -server.rmempty = true - -port = s:taboption("general", Value, "port", translate("Radius-Port")) -port:depends({mode="ap", encryption="wpa"}) -port:depends({mode="ap", encryption="wpa2"}) -port.rmempty = true - -key = s:taboption("general", Value, "key", translate("Password")) -key:depends("encryption", "wep") -key:depends("encryption", "psk") -key:depends("encryption", "psk2") -key:depends("encryption", "psk+psk2") -key:depends("encryption", "psk-mixed") -key:depends({mode="ap", encryption="wpa"}) -key:depends({mode="ap", encryption="wpa2"}) -key.rmempty = true -key.password = true - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - nasid = s:taboption("general", Value, "nasid", translate("NAS ID")) - nasid:depends({mode="ap", encryption="wpa"}) - nasid:depends({mode="ap", encryption="wpa2"}) - nasid.rmempty = true -end -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua b/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua deleted file mode 100644 index 66b21ab7a4..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua +++ /dev/null @@ -1,46 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- -local niulib = require "luci.niulib" -local cursor = require "luci.model.uci".inst - -m = Map("wireless", translate("Configure Private Access Point")) -s = m:section(NamedSection, "ap", "wifi-iface", translate("Wireless Radio Device"), -translate( -"Select the wireless radio device that should be used to run the interface.".. -" Note that wireless radios will not show up here if you already use".. -" them for other wireless services and are not capable of being used by".. -" more than one service simultaneously or run this specific service at all.")) -s.anonymous = true -s.addremove = false - -local l = s:option(ListValue, "device", translate("Wireless Device")) - -for _, wifi in ipairs(niulib.wifi_get_available("ap")) do - l:value(wifi, translate("WLAN-Adapter (%s)") % wifi) -end -l:value("none", translate("Disable Private Access Point")) - - -local extend = cursor:get("wireless", "bridge", "network") - and cursor:get("wireless", "bridge", "ssid") - -if extend ~= cursor:get("wireless", "ap", "ssid") then - local templ = s:option(ListValue, "_cfgtpl", translate("Configuration Template")) - templ:depends({["!default"] = 1}) - templ:depends({["!reverse"] = 1, device = "none"}) - templ:value("", translate("Access Point (Current Settings)")) - templ:value("bridge", translate("Extend network %s") % extend) -end - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua b/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua deleted file mode 100644 index be5c475ccc..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- -local niulib = require "luci.niulib" - -m = Map("wireless", translate("Join a local WDS network")) -s = m:section(NamedSection, "bridge", "wifi-iface", translate("Wireless Radio Device"), -translate( -"Select the wireless radio device that should be used to run the interface.".. -" Note that wireless radios will not show up here if you already use".. -" them for other wireless services and are not capable of being used by".. -" more than one service simultaneously or run this specific service at all.")) -s.anonymous = true -s.addremove = false - -l = s:option(ListValue, "device", translate("Wireless Device")) - -for _, wifi in ipairs(niulib.wifi_get_available("bridge", {atheros = true, mac80211 = true})) do - l:value(wifi, translate("WLAN-Adapter (%s)") % wifi) -end -l:value("none", translate("Disable Bridge")) - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua b/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua deleted file mode 100644 index 7ac2fff99a..0000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua +++ /dev/null @@ -1,91 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() - -if not cursor:get("wireless", "bridge") then - cursor:section("wireless", "wifi-iface", "bridge", - {device = "_", doth = "1", _niu = "1", mode = "sta", wds = "1"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("wireless") - local d = cursor:get("wireless", "bridge", "device") - if d ~= "none" then - local nc = uci.cursor(nil, "") - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == d and s._niu ~= "1" - end) - if nc:get("wireless", "bridge", "network") - ~= cursor:get("wireless", "bridge", "network") then - cursor:delete("wireless", "bridge", "network") - end - cursor:set("wireless", d, "disabled", 0) - cursor:foreach("dhcp", "dhcp", function(s) - if s.interface == "lan" and s.ignore ~= "1" then - cursor:set("dhcp", s[".name"], "ignore", "1") - end - end) - self:set_route("scan", "bridge", "bridgelan") - else - if cursor:get("wireless", "bridge", "network") then - cursor:delete("wireless", "bridge", "network") - cursor:foreach("dhcp", "dhcp", function(s) - if s.interface == "lan" and s.ignore == "1" then - cursor:set("dhcp", s[".name"], "ignore", "0") - end - end) - self:set_route("lan") - end - end - cursor:save("dhcp") - cursor:save("wireless") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/wireless/brdevice") -d:add("deviceroute", deviceroute) -d:set("scan", "niu/network/wlanwanscan") -d:set("bridge", "niu/network/wlanwan") -d:set("bridgelan", "niu/network/lan1") -d:set("lan", "niu/network/lan1") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("wireless") - cursor:revert("dhcp") -end - -function d.on_done() - if uci.inst_state:get("network", "lan", "ipaddr") ~= cursor:get("network", "lan", "ipaddr") then - local cs = uci.cursor_state() - cs:set("network", "lan", "_ipchanged", "1") - cs:save("network") - end - - if cursor:get("network", "lan", "proto") == "dhcp" then - local emergv4 = cursor:get("network", "lan", "_emergv4") - if emergv4 then - if cursor:get("network", "lan_ea") then - cursor:set("network", "lan_ea", "ipaddr", emergv4) - else - cursor:section("network", "alias", "lan_ea", { - ipaddr = emergv4, - netmask = "255.255.255.0", - network = "lan" - }) - end - else - cursor:delete("network", "lan_ea") - end - end - cursor:commit("network") - cursor:commit("wireless") - cursor:commit("dhcp") -end - -return d
\ No newline at end of file |