diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-radvd/luasrc/model/cbi/radvd | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (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')
5 files changed, 722 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 diff --git a/applications/luci-app-radvd/luasrc/model/cbi/radvd/interface.lua b/applications/luci-app-radvd/luasrc/model/cbi/radvd/interface.lua new file mode 100644 index 0000000000..519664cdc2 --- /dev/null +++ b/applications/luci-app-radvd/luasrc/model/cbi/radvd/interface.lua @@ -0,0 +1,276 @@ +--[[ +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$ +]]-- + +local sid = arg[1] +local utl = require "luci.util" + +m = Map("radvd", translatef("Radvd - Interface %q", "?"), + 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) ~= "interface" then + luci.http.redirect(m.redirect) + return +end + +m.uci:foreach("radvd", "interface", + function(s) + if s['.name'] == sid and s.interface then + m.title = translatef("Radvd - Interface %q", s.interface) + return false + end + end) + + +s = m:section(NamedSection, sid, "interface", translate("Interface Configuration")) +s.addremove = false + +s:tab("general", translate("General")) +s:tab("timing", translate("Timing")) +s:tab("mobile", translate("Mobile IPv6")) + + +-- +-- General +-- + +o = s:taboption("general", 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:taboption("general", 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:taboption("general", DynamicList, "client", translate("Clients"), + translate("Restrict communication to specified clients, leave empty to use multicast")) + +o.rmempty = true +o.datatype = "ip6addr" +o.placeholder = "any" +function o.cfgvalue(...) + local v = Value.cfgvalue(...) + local l = { } + for v in utl.imatch(v) do + l[#l+1] = v + end + return l +end + + +o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"), + translate("Enables router advertisements and solicitations")) + +o.rmempty = false +function o.write(self, section, value) + if value == "1" then + m.uci:set("radvd", section, "ignore", 0) + m.uci:set("radvd", section, "IgnoreIfMissing", 1) + end + + m.uci:set("radvd", section, "AdvSendAdvert", value) +end + + +o = s:taboption("general", Flag, "UnicastOnly", translate("Unicast only"), + translate("Indicates that the underlying link is not broadcast capable, prevents unsolicited advertisements from being sent")) + +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", Flag, "AdvManagedFlag", translate("Managed flag"), + translate("Enables the additional stateful administered autoconfiguration protocol (RFC2462)")) + +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", Flag, "AdvOtherConfigFlag", translate("Configuration flag"), + translate("Enables the autoconfiguration of additional, non address information (RFC2462)")) + +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", Flag, "AdvSourceLLAddress", translate("Source link-layer address"), + translate("Includes the link-layer address of the outgoing interface in the RA")) + +o.rmempty = false +o.default = "1" +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", Value, "AdvLinkMTU", translate("Link MTU"), + translate("Advertises the given link MTU in the RA if specified. 0 disables MTU advertisements")) + +o.datatype = "uinteger" +o.placeholder = 0 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", Value, "AdvCurHopLimit", translate("Current hop limit"), + translate("Advertises the default Hop Count value for outgoing unicast packets in the RA. 0 disables hopcount advertisements")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 64 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("general", ListValue, "AdvDefaultPreference", translate("Default preference"), + translate("Advertises the default router preference")) + +o.optional = false +o.default = "medium" +o:value("low", translate("low")) +o:value("medium", translate("medium")) +o:value("high", translate("high")) +o:depends("AdvSendAdvert", "1") + + +-- +-- Timing +-- + +o = s:taboption("timing", Value, "MinRtrAdvInterval", translate("Minimum advertisement interval"), + translate("The minimum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 198 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("timing", Value, "MaxRtrAdvInterval", translate("Maximum advertisement interval"), + translate("The maximum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 600 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("timing", Value, "MinDelayBetweenRAs", translate("Minimum advertisement delay"), + translate("The minimum time allowed between sending multicast router advertisements from the interface, in seconds")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 3 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("timing", Value, "AdvReachableTime", translate("Reachable time"), + translate("Advertises assumed reachability time in milliseconds of neighbours in the RA if specified. 0 disables reachability advertisements")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 0 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("timing", Value, "AdvRetransTimer", translate("Retransmit timer"), + translate("Advertises wait time in milliseconds between Neighbor Solicitation messages in the RA if specified. 0 disables retransmit advertisements")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 0 +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("timing", Value, "AdvDefaultLifetime", translate("Default lifetime"), + translate("Advertises the lifetime of the default router in seconds. 0 indicates that the node is no default router")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 1800 +o:depends("AdvSendAdvert", "1") + + +-- +-- Mobile +-- + +o = s:taboption("mobile", Flag, "AdvHomeAgentFlag", translate("Advertise Home Agent flag"), + translate("Advertises Mobile IPv6 Home Agent capability (RFC3775)")) + +o:depends("AdvSendAdvert", "1") + + +o = s:taboption("mobile", Flag, "AdvIntervalOpt", translate("Mobile IPv6 interval option"), + translate("Include Mobile IPv6 Advertisement Interval option to RA")) + +o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"}) + + +o = s:taboption("mobile", Flag, "AdvHomeAgentInfo", translate("Home Agent information"), + translate("Include Home Agent Information in the RA")) + +o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"}) + + +o = s:taboption("mobile", Flag, "AdvMobRtrSupportFlag", translate("Mobile IPv6 router registration"), + translate("Advertises Mobile Router registration capability (NEMO Basic)")) + +o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) + + +o = s:taboption("mobile", Value, "HomeAgentLifetime", translate("Home Agent lifetime"), + translate("Advertises the time in seconds the router is offering Mobile IPv6 Home Agent services")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 1800 +o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) + + +o = s:taboption("mobile", Value, "HomeAgentPreference", translate("Home Agent preference"), + translate("The preference for the Home Agent sending this RA")) + +o.datatype = "uinteger" +o.optional = false +o.placeholder = 0 +o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"}) + + +return m diff --git a/applications/luci-app-radvd/luasrc/model/cbi/radvd/prefix.lua b/applications/luci-app-radvd/luasrc/model/cbi/radvd/prefix.lua new file mode 100644 index 0000000000..6032986510 --- /dev/null +++ b/applications/luci-app-radvd/luasrc/model/cbi/radvd/prefix.lua @@ -0,0 +1,139 @@ +--[[ +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$ +]]-- + +local sid = arg[1] +local utl = require "luci.util" + +m = Map("radvd", translatef("Radvd - Prefix"), + 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) ~= "prefix" then + luci.http.redirect(m.redirect) + return +end + + +s = m:section(NamedSection, sid, "interface", translate("Prefix Configuration")) +s.addremove = false + +s:tab("general", translate("General")) +s:tab("advanced", translate("Advanced")) + + +-- +-- General +-- + +o = s:taboption("general", 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:taboption("general", 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:taboption("general", DynamicList, "prefix", translate("Prefixes"), + translate("Advertised IPv6 prefixes. If empty, the current interface prefix is used")) + +o.optional = true +o.datatype = "ip6addr" +o.placeholder = translate("default") +function o.cfgvalue(self, section) + local l = { } + local v = m.uci:get_list("radvd", section, "prefix") + for v in utl.imatch(v) do + l[#l+1] = v + end + return l +end + + +o = s:taboption("general", Flag, "AdvOnLink", translate("On-link determination"), + translate("Indicates that this prefix can be used for on-link determination (RFC4861)")) + +o.rmempty = false +o.default = "1" + + +o = s:taboption("general", Flag, "AdvAutonomous", translate("Autonomous"), + translate("Indicates that this prefix can be used for autonomous address configuration (RFC4862)")) + +o.rmempty = false +o.default = "1" + + +-- +-- Advanced +-- + +o = s:taboption("advanced", Flag, "AdvRouterAddr", translate("Advertise router address"), + translate("Indicates that the address of interface is sent instead of network prefix, as is required by Mobile IPv6")) + + +o = s:taboption("advanced", Value, "AdvValidLifetime", translate("Valid lifetime"), + translate("Advertises the length of time in seconds that the prefix is valid for the purpose of on-link determination.")) + +o.datatype = 'or(uinteger,"infinity")' +o.placeholder = 86400 + + +o = s:taboption("advanced", Value, "AdvPreferredLifetime", translate("Preferred lifetime"), + translate("Advertises the length of time in seconds that addresses generated from the prefix via stateless address autoconfiguration remain preferred.")) + +o.datatype = 'or(uinteger,"infinity")' +o.placeholder = 14400 + + +o = s:taboption("advanced", Value, "Base6to4Interface", translate("6to4 interface"), + translate("Specifies a logical interface name to derive a 6to4 prefix from. The interfaces public IPv4 address is combined with 2002::/3 and the value of the prefix option")) + +o.template = "cbi/network_netlist" +o.nocreate = true +o.unspecified = true + + +return m diff --git a/applications/luci-app-radvd/luasrc/model/cbi/radvd/rdnss.lua b/applications/luci-app-radvd/luasrc/model/cbi/radvd/rdnss.lua new file mode 100644 index 0000000000..ea65263996 --- /dev/null +++ b/applications/luci-app-radvd/luasrc/model/cbi/radvd/rdnss.lua @@ -0,0 +1,100 @@ +--[[ +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$ +]]-- + +local sid = arg[1] +local utl = require "luci.util" + +m = Map("radvd", translatef("Radvd - RDNSS"), + 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) ~= "rdnss" then + luci.http.redirect(m.redirect) + return +end + + +s = m:section(NamedSection, sid, "interface", translate("RDNSS 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, "addr", translate("Addresses"), + translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used")) + +o.optional = false +o.rmempty = true +o.datatype = "ip6addr" +o.placeholder = translate("default") +function o.cfgvalue(self, section) + local l = { } + local v = m.uci:get_list("radvd", section, "addr") + for v in utl.imatch(v) do + l[#l+1] = v + end + return l +end + + +o = s:option(Value, "AdvRDNSSLifetime", translate("Lifetime"), + translate("Specifies the maximum duration how long the RDNSS entries are used for name resolution.")) + +o.datatype = 'or(uinteger,"infinity")' +o.placeholder = 1200 + + +return m diff --git a/applications/luci-app-radvd/luasrc/model/cbi/radvd/route.lua b/applications/luci-app-radvd/luasrc/model/cbi/radvd/route.lua new file mode 100644 index 0000000000..97c72a4ec3 --- /dev/null +++ b/applications/luci-app-radvd/luasrc/model/cbi/radvd/route.lua @@ -0,0 +1,108 @@ +--[[ +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$ +]]-- + +local sid = arg[1] +local utl = require "luci.util" + +m = Map("radvd", translatef("Radvd - Route"), + 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) ~= "route" then + luci.http.redirect(m.redirect) + return +end + + +s = m:section(NamedSection, sid, "interface", translate("Route 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, "prefix", translate("Prefixes"), + translate("Advertised IPv6 prefixes")) + +o.rmempty = false +o.datatype = "ip6addr" +o.placeholder = translate("default") +function o.cfgvalue(self, section) + local l = { } + local v = m.uci:get_list("radvd", section, "prefix") + for v in utl.imatch(v) do + l[#l+1] = v + end + return l +end + + +o = s:option(Value, "AdvRouteLifetime", translate("Lifetime"), + translate("Specifies the lifetime associated with the route in seconds.")) + +o.datatype = 'or(uinteger,"infinity")' +o.placeholder = 1800 + + +o = s:option(ListValue, "AdvRoutePreference", translate("Preference"), + translate("Specifies the preference associated with the default router")) + +o.default = "medium" +o:value("low", translate("low")) +o:value("medium", translate("medium")) +o:value("high", translate("high")) + + +return m |