e4b093aa1345c30d9b791ff9d7541884572273ac
[project/luci.git] / applications / luci-app-olsr / luasrc / model / cbi / olsr / olsrdhna.lua
1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
3 -- Licensed to the public under the Apache License 2.0.
4
5 local uci = require "luci.model.uci".cursor()
6 local ipv = uci:get_first("olsrd", "olsrd", "IpVersion", "4")
7
8 mh = Map("olsrd", translate("OLSR - HNA-Announcements"), translate("Hosts in a OLSR routed network can announce connecitivity " ..
9 "to external networks using HNA messages."))
10
11 if ipv == "6and4" or ipv == "4" then
12 hna4 = mh:section(TypedSection, "Hna4", translate("Hna4"), translate("Both values must use the dotted decimal notation."))
13 hna4.addremove = true
14 hna4.anonymous = true
15 hna4.template = "cbi/tblsection"
16
17 net4 = hna4:option(Value, "netaddr", translate("Network address"))
18 net4.datatype = "ip4addr"
19 net4.placeholder = "10.11.12.13"
20 net4.default = "10.11.12.13"
21 msk4 = hna4:option(Value, "netmask", translate("Netmask"))
22 msk4.datatype = "ip4addr"
23 msk4.placeholder = "255.255.255.255"
24 msk4.default = "255.255.255.255"
25 end
26
27 if ipv == "6and4" or ipv == "6" then
28 hna6 = mh:section(TypedSection, "Hna6", translate("Hna6"), translate("IPv6 network must be given in full notation, " ..
29 "prefix must be in CIDR notation."))
30 hna6.addremove = true
31 hna6.anonymous = true
32 hna6.template = "cbi/tblsection"
33
34 net6 = hna6:option(Value, "netaddr", translate("Network address"))
35 net6.datatype = "ip6addr"
36 net6.placeholder = "fec0:2200:106:0:0:0:0:0"
37 net6.default = "fec0:2200:106:0:0:0:0:0"
38 msk6 = hna6:option(Value, "prefix", translate("Prefix"))
39 msk6.datatype = "range(0,128)"
40 msk6.placeholder = "128"
41 msk6.default = "128"
42 end
43
44 return mh
45