summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
blob: ae8e062cbab6a9c6b0a2027b7946c3a9febf56ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
--[[
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]

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", 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