luci-theme-material: PR from version 0.2.6
[project/luci.git] / protocols / luci-proto-ipv6 / luasrc / model / cbi / admin_network / proto_map.lua
1 -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
2 -- Copyright 2013 Steven Barth <steven@midlink.org>
3 -- Licensed to the public under the Apache License 2.0.
4
5 local map, section, net = ...
6
7 local peeraddr, ip6addr
8 local tunlink, defaultroute, metric, ttl, mtu
9
10
11 maptype = section:taboption("general", ListValue, "type", translate("Type"))
12 maptype:value("map-e", "MAP-E")
13 maptype:value("map-t", "MAP-T")
14 maptype:value("lw4o6", "LW4over6")
15
16
17 peeraddr = section:taboption("general", Value, "peeraddr",
18         translate("BR / DMR / AFTR"))
19
20 peeraddr.rmempty  = false
21 peeraddr.datatype = "ip6addr"
22
23
24 ipaddr = section:taboption("general", Value, "ipaddr",
25         translate("IPv4 prefix"))
26 ipaddr.datatype = "ip4addr"
27
28
29 ip4prefixlen = s:taboption("general", Value, "ip4prefixlen",
30         translate("IPv4 prefix length"),
31         translate("The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses."))
32
33 ip4prefixlen.placeholder = "32"
34 ip4prefixlen.datatype    = "range(0,32)"
35
36 ip6addr = s:taboption("general", Value, "ip6prefix",
37         translate("IPv6 prefix"),
38         translate("The IPv6 prefix assigned to the provider, usually ends with <code>::</code>"))
39
40 ip6addr.rmempty  = false
41 ip6addr.datatype = "ip6addr"
42
43
44 ip6prefixlen = s:taboption("general", Value, "ip6prefixlen",
45         translate("IPv6 prefix length"),
46         translate("The length of the IPv6 prefix in bits"))
47
48 ip6prefixlen.placeholder = "16"
49 ip6prefixlen.datatype    = "range(0,64)"
50
51
52 s:taboption("general", Value, "ealen",
53         translate("EA-bits length")).datatype = "range(0,16)"
54
55 s:taboption("general", Value, "psidlen",
56         translate("PSID-bits length")).datatype = "range(0,16)"
57
58 s:taboption("general", Value, "offset",
59         translate("PSID offset")).datatype = "range(0,16)"
60
61 tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link"))
62 tunlink.template = "cbi/network_netlist"
63 tunlink.nocreate = true
64
65
66 defaultroute = section:taboption("advanced", Flag, "defaultroute",
67         translate("Default gateway"),
68         translate("If unchecked, no default route is configured"))
69
70 defaultroute.default = defaultroute.enabled
71
72
73 metric = section:taboption("advanced", Value, "metric",
74         translate("Use gateway metric"))
75
76 metric.placeholder = "0"
77 metric.datatype    = "uinteger"
78 metric:depends("defaultroute", defaultroute.enabled)
79
80
81 ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
82 ttl.placeholder = "64"
83 ttl.datatype    = "range(1,255)"
84
85
86 mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
87 mtu.placeholder = "1280"
88 mtu.datatype    = "max(9200)"