1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local wa = require "luci.tools.webadmin"
5 local fs = require "nixio.fs"
9 translate("Routes specify over which interface and gateway a certain host or network " ..
12 s = m:section(TypedSection, "route", translate("Static IPv4 Routes"))
16 s.template = "cbi/tblsection"
18 iface = s:option(ListValue, "interface", translate("Interface"))
19 wa.cbi_add_networks(iface)
21 t = s:option(Value, "target", translate("Target"), translate("Host-<abbr title=\"Internet Protocol Address\">IP</abbr> or Network"))
22 t.datatype = "ip4addr"
25 n = s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"), translate("if target is a network"))
26 n.placeholder = "255.255.255.255"
27 n.datatype = "ip4addr"
30 g = s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
31 g.datatype = "ip4addr"
34 metric = s:option(Value, "metric", translate("Metric"))
35 metric.placeholder = 0
36 metric.datatype = "range(0,255)"
39 mtu = s:option(Value, "mtu", translate("MTU"))
40 mtu.placeholder = 1500
41 mtu.datatype = "range(64,9000)"
44 if fs.access("/proc/net/ipv6_route") then
45 s = m:section(TypedSection, "route6", translate("Static IPv6 Routes"))
49 s.template = "cbi/tblsection"
51 iface = s:option(ListValue, "interface", translate("Interface"))
52 wa.cbi_add_networks(iface)
54 t = s:option(Value, "target", translate("Target"), translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address or Network (CIDR)"))
55 t.datatype = "ip6addr"
58 g = s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway"))
59 g.datatype = "ip6addr"
62 metric = s:option(Value, "metric", translate("Metric"))
63 metric.placeholder = 0
64 metric.datatype = "range(0,65535)" -- XXX: not sure
67 mtu = s:option(Value, "mtu", translate("MTU"))
68 mtu.placeholder = 1500
69 mtu.datatype = "range(64,9000)"