summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua')
-rw-r--r--applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua99
1 files changed, 99 insertions, 0 deletions
diff --git a/applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua b/applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua
new file mode 100644
index 0000000000..ec67f308ae
--- /dev/null
+++ b/applications/luci-app-radvd/luasrc/model/cbi/radvd/dnssl.lua
@@ -0,0 +1,99 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2010 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: rdnss.lua 6715 2011-01-13 20:03:40Z jow $
+]]--
+
+local sid = arg[1]
+local utl = require "luci.util"
+
+m = Map("radvd", translatef("Radvd - DNSSL"),
+ translate("Radvd is a router advertisement daemon for IPv6. " ..
+ "It listens to router solicitations and sends router advertisements " ..
+ "as described in RFC 4861."))
+
+m.redirect = luci.dispatcher.build_url("admin/network/radvd")
+
+if m.uci:get("radvd", sid) ~= "dnssl" then
+ luci.http.redirect(m.redirect)
+ return
+end
+
+
+s = m:section(NamedSection, sid, "interface", translate("DNSSL Configuration"))
+s.addremove = false
+
+
+--
+-- General
+--
+
+o = s:option(Flag, "ignore", translate("Enable"))
+o.rmempty = false
+
+function o.cfgvalue(...)
+ local v = Flag.cfgvalue(...)
+ return v == "1" and "0" or "1"
+end
+
+function o.write(self, section, value)
+ Flag.write(self, section, value == "1" and "0" or "1")
+end
+
+
+o = s:option(Value, "interface", translate("Interface"),
+ translate("Specifies the logical interface name this section belongs to"))
+
+o.template = "cbi/network_netlist"
+o.nocreate = true
+o.optional = false
+
+function o.formvalue(...)
+ return Value.formvalue(...) or "-"
+end
+
+function o.validate(self, value)
+ if value == "-" then
+ return nil, translate("Interface required")
+ end
+ return value
+end
+
+function o.write(self, section, value)
+ m.uci:set("radvd", section, "ignore", 0)
+ m.uci:set("radvd", section, "interface", value)
+end
+
+
+o = s:option(DynamicList, "suffix", translate("Suffix"),
+ translate("Advertised Domain Suffixes"))
+
+o.optional = false
+o.rmempty = false
+o.datatype = "hostname"
+function o.cfgvalue(self, section)
+ local l = { }
+ local v = m.uci:get_list("radvd", section, "suffix")
+ for v in utl.imatch(v) do
+ l[#l+1] = v
+ end
+ return l
+end
+
+
+o = s:option(Value, "AdvDNSSLLifetime", translate("Lifetime"),
+ translate("Specifies the maximum duration how long the DNSSL entries are used for name resolution."))
+
+o.datatype = 'or(uinteger,"infinity")'
+o.placeholder = 1200
+
+
+return m