Merge pull request #278 from nmav/ocserv
[project/luci.git] / applications / luci-olsr / luasrc / model / cbi / olsr / olsrdhna.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 local uci = require "luci.model.uci".cursor()
17 local ipv =  uci:get_first("olsrd", "olsrd", "IpVersion", "4")
18
19 mh = Map("olsrd", translate("OLSR - HNA-Announcements"), translate("Hosts in a OLSR routed network can announce connecitivity " ..
20         "to external networks using HNA messages."))
21
22 if ipv == "6and4" or ipv == "4" then
23         hna4 = mh:section(TypedSection, "Hna4", translate("Hna4"), translate("Both values must use the dotted decimal notation."))
24         hna4.addremove = true
25         hna4.anonymous = true
26         hna4.template  = "cbi/tblsection"
27
28         net4 = hna4:option(Value, "netaddr", translate("Network address"))
29         net4.datatype = "ip4addr"
30         net4.placeholder = "10.11.12.13"
31         net4.default = "10.11.12.13"
32         msk4 = hna4:option(Value, "netmask", translate("Netmask"))
33         msk4.datatype = "ip4addr"
34         msk4.placeholder = "255.255.255.255"
35         msk4.default = "255.255.255.255"
36 end
37
38 if ipv == "6and4" or ipv == "6" then
39         hna6 = mh:section(TypedSection, "Hna6", translate("Hna6"), translate("IPv6 network must be given in full notation, " ..
40                 "prefix must be in CIDR notation."))
41         hna6.addremove = true
42         hna6.anonymous = true
43         hna6.template  = "cbi/tblsection"
44
45         net6 = hna6:option(Value, "netaddr", translate("Network address"))
46         net6.datatype = "ip6addr"
47         net6.placeholder = "fec0:2200:106:0:0:0:0:0"
48         net6.default = "fec0:2200:106:0:0:0:0:0"
49         msk6 = hna6:option(Value, "prefix", translate("Prefix"))
50         msk6.datatype = "range(0,128)"
51         msk6.placeholder = "128"
52         msk6.default = "128"
53 end
54
55 return mh
56