luci-mod-admin-full: remove useless "bit" requires
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_network / routes.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 require("luci.tools.webadmin")
16 m = Map("network",
17         translate("Routes"),
18         translate("Routes specify over which interface and gateway a certain host or network " ..
19                 "can be reached."))
20
21 local routes6 = luci.sys.net.routes6()
22
23 s = m:section(TypedSection, "route", translate("Static IPv4 Routes"))
24 s.addremove = true
25 s.anonymous = true
26
27 s.template  = "cbi/tblsection"
28
29 iface = s:option(ListValue, "interface", translate("Interface"))
30 luci.tools.webadmin.cbi_add_networks(iface)
31
32 t = s:option(Value, "target", translate("Target"), translate("Host-<abbr title=\"Internet Protocol Address\">IP</abbr> or Network"))
33 t.datatype = "ip4addr"
34 t.rmempty = false
35
36 n = s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"), translate("if target is a network"))
37 n.placeholder = "255.255.255.255"
38 n.datatype = "ip4addr"
39 n.rmempty = true
40
41 g = s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
42 g.datatype = "ip4addr"
43 g.rmempty = true
44
45 metric = s:option(Value, "metric", translate("Metric"))
46 metric.placeholder = 0
47 metric.datatype = "range(0,255)"
48 metric.rmempty = true
49
50 mtu = s:option(Value, "mtu", translate("MTU"))
51 mtu.placeholder = 1500
52 mtu.datatype = "range(64,9000)"
53 mtu.rmempty = true
54
55 if routes6 then
56         s = m:section(TypedSection, "route6", translate("Static IPv6 Routes"))
57         s.addremove = true
58         s.anonymous = true
59
60         s.template  = "cbi/tblsection"
61
62         iface = s:option(ListValue, "interface", translate("Interface"))
63         luci.tools.webadmin.cbi_add_networks(iface)
64
65         t = s:option(Value, "target", translate("Target"), translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address or Network (CIDR)"))
66         t.datatype = "ip6addr"
67         t.rmempty = false
68
69         g = s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway"))
70         g.datatype = "ip6addr"
71         g.rmempty = true
72
73         metric = s:option(Value, "metric", translate("Metric"))
74         metric.placeholder = 0
75         metric.datatype = "range(0,65535)" -- XXX: not sure
76         metric.rmempty = true
77
78         mtu = s:option(Value, "mtu", translate("MTU"))
79         mtu.placeholder = 1500
80         mtu.datatype = "range(64,9000)"
81         mtu.rmempty = true
82 end
83
84
85 return m