From 1ffe61277e656943128cafc70e35ee05669d1cce Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 11 Oct 2011 02:07:15 +0000 Subject: move protocol support into a new protocols/ subdir --- .../luasrc/model/cbi/admin_network/proto_3g.lua | 152 --------------------- .../luasrc/model/cbi/admin_network/proto_6in4.lua | 96 ------------- .../luasrc/model/cbi/admin_network/proto_6to4.lua | 97 ------------- .../luasrc/model/cbi/admin_network/proto_dhcp.lua | 88 ------------ .../luasrc/model/cbi/admin_network/proto_none.lua | 13 -- .../luasrc/model/cbi/admin_network/proto_ppp.lua | 130 ------------------ .../luasrc/model/cbi/admin_network/proto_pppoa.lua | 136 ------------------ .../luasrc/model/cbi/admin_network/proto_pppoe.lua | 130 ------------------ .../luasrc/model/cbi/admin_network/proto_pptp.lua | 60 -------- .../luasrc/model/cbi/admin_network/proto_relay.lua | 77 ----------- .../model/cbi/admin_network/proto_static.lua | 78 ----------- 11 files changed, 1057 deletions(-) delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_3g.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_6in4.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_6to4.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_dhcp.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_none.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_ppp.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoa.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoe.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_pptp.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_relay.lua delete mode 100644 modules/admin-full/luasrc/model/cbi/admin_network/proto_static.lua (limited to 'modules/admin-full') diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_3g.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_3g.lua deleted file mode 100644 index f14434dd8..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_3g.lua +++ /dev/null @@ -1,152 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local device, apn, service, pincode, username, password -local ipv6, maxwait, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local device_suggestions = nixio.fs.glob("/dev/tty[A-Z]*") - or nixio.fs.glob("/dev/tts/*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end -end - - -service = section:taboption("general", Value, "service", translate("Service Type")) -service:value("", translate("-- Please choose --")) -service:value("umts", "UMTS/GPRS") -service:value("cdma", "CDMA") -service:value("evdo", "EV-DO") - - -apn = section:taboption("general", Value, "apn", translate("APN")) - - -pincode = section:taboption("general", Value, "pincode", translate("PIN")) -pincode.datatype = "range(0,9999)" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", Flag, "ipv6", - translate("Enable IPv6 negotiation on the PPP link")) - - ipv6.default = ipv6.disabled - -end - - -maxwait = section:taboption("advanced", Value, "maxwait", - translate("Modem init timeout"), - translate("Maximum amount of seconds to wait for the modem to become ready")) - -maxwait.placeholder = "20" -maxwait.datatype = "min(1)" - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_6in4.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_6in4.lua deleted file mode 100644 index 29b1039fb..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_6in4.lua +++ /dev/null @@ -1,96 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local ipaddr, peeraddr, ip6addr, tunnelid, username, password -local defaultroute, metric, ttl, mtu - - -ipaddr = s:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Leave empty to use the current WAN address")) - -ipaddr.datatype = "ip4addr" - - -peeraddr = s:taboption("general", Value, "peeraddr", - translate("Remote IPv4 address"), - translate("This is usually the address of the nearest PoP operated by the tunnel broker")) - -peeraddr.rmempty = false -peeraddr.datatype = "ip4addr" - - -ip6addr = s:taboption("general", Value, "ip6addr", - translate("Local IPv6 address"), - translate("This is the local endpoint address assigned by the tunnel broker, it usually ends with :2")) - -ip6addr.rmempty = false -ip6addr.datatype = "ip6addr" - - -local update = section:taboption("general", Flag, "_update", - translate("Dynamic tunnel"), - translate("Enable HE.net dynamic endpoint update")) - -update.enabled = "1" -update.disabled = "0" - -function update.write() end -function update.remove() end -function update.cfgvalue(self, section) - return (tonumber(m:get(section, "tunnelid")) ~= nil) - and self.enabled or self.disabled -end - - -tunnelid = section:taboption("general", Value, "tunnelid", translate("Tunnel ID")) -tunnelid.datatype = "uinteger" -tunnelid:depends("_update", update.enabled) - - -username = section:taboption("general", Value, "username", - translate("HE.net user ID"), - translate("This is the 32 byte hex encoded user ID, not the login name")) - -username:depends("_update", update.enabled) - - -password = section:taboption("general", Value, "password", translate("HE.net password")) -password.password = true -password:depends("_update", update.enabled) - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(1500)" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_6to4.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_6to4.lua deleted file mode 100644 index d10ab089c..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_6to4.lua +++ /dev/null @@ -1,97 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local ipaddr, adv_interface, adv_subnet -local adv_valid_lifetime, adv_preferred_lifetime, defaultroute, metric, ttl, mtu - - -ipaddr = section:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Leave empty to use the current WAN address")) - -ipaddr.datatype = "ip4addr" - - -adv_interface = section:taboption("general", Value, "adv_interface", translate("Advertise IPv6 on network")) -adv_interface.widget = "checkbox" -adv_interface.exclude = arg[1] -adv_interface.default = "lan" -adv_interface.template = "cbi/network_netlist" -adv_interface.nocreate = true -adv_interface.nobridges = true -adv_interface.novirtual = true - - -adv_subnet = section:taboption("general", Value, "adv_subnet", - translate("Advertised network ID"), - translate("Allowed range is 1 to 65535")) - -adv_subnet.placeholder = "1" -adv_subnet.datatype = "range(1,65535)" - -function adv_subnet.cfgvalue(self, section) - local v = Value.cfgvalue(self, section) - return v and tonumber(v, 16) -end - -function adv_subnet .write(self, section, value) - value = tonumber(value) or 1 - - if value > 65535 then value = 65535 - elseif value < 1 then value = 1 end - - Value.write(self, section, "%X" % value) -end - - -adv_valid_lifetime = section:taboption("advanced", Value, "adv_valid_lifetime", - translate("Use valid lifetime"), - translate("Specifies the advertised valid prefix lifetime in seconds")) - -adv_valid_lifetime.placeholder = "300" -adv_valid_lifetime.datatype = "uinteger" - - -adv_preferred_lifetime = section:taboption("advanced", Value, "adv_preferred_lifetime", - translate("Use preferred lifetime"), - translate("Specifies the advertised preferred prefix lifetime in seconds")) - -adv_preferred_lifetime.placeholder = "120" -adv_preferred_lifetime.datatype = "uinteger" - - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(1500)" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_dhcp.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_dhcp.lua deleted file mode 100644 index 566ea2331..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_dhcp.lua +++ /dev/null @@ -1,88 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... -local ifc = net:get_interface() - -local hostname, accept_ra, send_rs -local bcast, no_gw, metric, clientid, vendorclass - - -hostname = section:taboption("general", Value, "hostname", - translate("Hostname to send when requesting DHCP")) - -hostname.placeholder = luci.sys.hostname() -hostname.datatype = "hostname" - - -if luci.model.network:has_ipv6() then - - accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements")) - accept_ra.default = accept_ra.enabled - - - send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations")) - send_rs.default = send_rs.disabled - send_rs:depends("accept_ra", "") - -end - -bcast = section:taboption("advanced", Flag, "broadcast", - translate("Use broadcast flag"), - translate("Required for certain ISPs, e.g. Charter with DOCSIS 3")) - -bcast.default = bcast.disabled - - -no_gw = section:taboption("advanced", Flag, "gateway", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -no_gw.default = no_gw.enabled - -function no_gw.cfgvalue(...) - return Flag.cfgvalue(...) == "0.0.0.0" and "0" or "1" -end - -function no_gw.write(self, section, value) - if value == "1" then - m:set(section, "gateway", nil) - else - m:set(section, "gateway", "0.0.0.0") - end -end - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("gateway", "1") - - -clientid = section:taboption("advanced", Value, "clientid", - translate("Client ID to send when requesting DHCP")) - - -vendorclass = section:taboption("advanced", Value, "vendorclass", - translate("Vendor Class to send when requesting DHCP")) - - -macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address")) -macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00" -macaddr.datatype = "macaddr" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(1500)" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_none.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_none.lua deleted file mode 100644 index 0e34b67de..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_none.lua +++ /dev/null @@ -1,13 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_ppp.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_ppp.lua deleted file mode 100644 index 6cbdd9953..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_ppp.lua +++ /dev/null @@ -1,130 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local device, username, password -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local device_suggestions = nixio.fs.glob("/dev/tty*S*") - or nixio.fs.glob("/dev/tts/*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end -end - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", Flag, "ipv6", - translate("Enable IPv6 negotiation on the PPP link")) - - ipv6.default = ipv6.disabled - -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoa.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoa.lua deleted file mode 100644 index 9bc956a79..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoa.lua +++ /dev/null @@ -1,136 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local encaps, atmdev, vci, vpi, username, password -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - - -encaps = section:taboption("general", ListValue, "encaps", translate("PPPoA Encapsulation")) -encaps:value("vc", "VC-Mux") -encaps:value("llc", "LLC") - - -atmdev = section:taboption("general", Value, "atmdev", translate("ATM device number")) -atmdev.default = "0" -atmdev.datatype = "uinteger" - - -vci = section:taboption("general", Value, "vci", translate("ATM Virtual Channel Identifier (VCI)")) -vci.default = "35" -vci.datatype = "uinteger" - - -vpi = section:taboption("general", Value, "vpi", translate("ATM Virtual Path Identifier (VPI)")) -vpi.default = "8" -vpi.datatype = "uinteger" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", Flag, "ipv6", - translate("Enable IPv6 negotiation on the PPP link")) - - ipv6.default = ipv6.disabled - -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoe.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoe.lua deleted file mode 100644 index 6a5d3c362..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pppoe.lua +++ /dev/null @@ -1,130 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local username, password, ac, service -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -ac = section:taboption("general", Value, "ac", - translate("Access Concentrator"), - translate("Leave empty to autodetect")) - -ac.placeholder = translate("auto") - - -service = section:taboption("general", Value, "service", - translate("Service Name"), - translate("Leave empty to autodetect")) - -service.placeholder = translate("auto") - - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", Flag, "ipv6", - translate("Enable IPv6 negotiation on the PPP link")) - - ipv6.default = ipv6.disabled - -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pptp.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_pptp.lua deleted file mode 100644 index 4124b2efe..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_pptp.lua +++ /dev/null @@ -1,60 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local server, username, password -local buffering, defaultroute, metric, peerdns, dns - - -server = section:taboption("general", Value, "server", translate("VPN Server")) -server.datatype = "host" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -buffering = section:taboption("advanced", Flag, "buffering", translate("Enable buffering")) -buffering.default = buffering.enabled - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_relay.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_relay.lua deleted file mode 100644 index 017bb9bfa..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_relay.lua +++ /dev/null @@ -1,77 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... - -local ipaddr, network -local forward_bcast, forward_dhcp, gateway, expiry, retry, table - - -ipaddr = section:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Address to access local relay bridge")) - -ipaddr.datatype = "ip4addr" - - -network = s:taboption("general", DynamicList, "network", translate("Relay between networks")) -network.widget = "checkbox" -network.exclude = arg[1] -network.template = "cbi/network_netlist" -network.nocreate = true -network.nobridges = true -network.novirtual = true -network:depends("proto", "relay") - - -forward_bcast = section:taboption("advanced", Flag, "forward_bcast", - translate("Forward broadcast traffic")) - -forward_bcast.default = forward_bcast.enabled - - -forward_dhcp = section:taboption("advanced", Flag, "forward_dhcp", - translate("Forward DHCP traffic")) - -forward_dhcp.default = forward_dhcp.enabled - - -gateway = section:taboption("advanced", Value, "gateway", - translate("Use DHCP gateway"), - translate("Override the gateway in DHCP responses")) - -gateway.datatype = "ip4addr" -gateway:depends("forward_dhcp", forward_dhcp.enabled) - - -expiry = section:taboption("advanced", Value, "expiry", - translate("Host expiry timeout"), - translate("Specifies the maximum amount of seconds after which hosts are presumed to be dead")) - -expiry.placeholder = "30" -expiry.datatype = "min(1)" - - -retry = section:taboption("advanced", Value, "retry", - translate("ARP retry threshold"), - translate("Specifies the maximum amount of failed ARP requests until hosts are presumed to be dead")) - -retry.placeholder = "5" -retry.datatype = "min(1)" - - -table = section:taboption("advanced", Value, "table", - translate("Use routing table"), - translate("Override the table used for internal routes")) - -table.placeholder = "16800" -table.datatype = "range(0,65535)" diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/proto_static.lua b/modules/admin-full/luasrc/model/cbi/admin_network/proto_static.lua deleted file mode 100644 index 8ae9b7eab..000000000 --- a/modules/admin-full/luasrc/model/cbi/admin_network/proto_static.lua +++ /dev/null @@ -1,78 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2011 Jo-Philipp Wich - -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 -]]-- - -local map, section, net = ... -local ifc = net:get_interface() - -local ipaddr, netmask, gateway, broadcast, accept_ra, send_rs, ip6addr, ip6gw -local macaddr, mtu, metric - - -ipaddr = section:taboption("general", Value, "ipaddr", translate("IPv4 address")) -ipaddr.datatype = "ip4addr" - - -netmask = section:taboption("general", Value, "netmask", - translate("IPv4 netmask")) - -netmask.datatype = "ip4addr" -netmask:value("255.255.255.0") -netmask:value("255.255.0.0") -netmask:value("255.0.0.0") - - -gateway = section:taboption("general", Value, "gateway", translate("IPv4 gateway")) -gateway.datatype = "ip4addr" - - -broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 broadcast")) -broadcast.datatype = "ip4addr" - - -if luci.model.network:has_ipv6() then - - accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements")) - accept_ra.default = accept_ra.disabled - - - send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations")) - send_rs.default = send_rs.enabled - send_rs:depends("accept_ra", "") - - - ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address")) - ip6addr.datatype = "ip6addr" - ip6addr:depends("accept_ra", "") - - - ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway")) - ip6gw.datatype = "ip6addr" - ip6gw:depends("accept_ra", "") - -end - - -macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address")) -macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00" -macaddr.datatype = "macaddr" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(1500)" - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -- cgit v1.2.3