1 -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local map, section, net = ...
5 local ifc = net:get_interface()
7 local ipaddr, netmask, gateway, broadcast, dns, accept_ra, send_rs, ip6addr, ip6gw
11 ipaddr = section:taboption("general", Value, "ipaddr", translate("IPv4 address"))
12 ipaddr.datatype = "ip4addr"
15 netmask = section:taboption("general", Value, "netmask",
16 translate("IPv4 netmask"))
18 netmask.datatype = "ip4addr"
19 netmask:value("255.255.255.0")
20 netmask:value("255.255.0.0")
21 netmask:value("255.0.0.0")
24 gateway = section:taboption("general", Value, "gateway", translate("IPv4 gateway"))
25 gateway.datatype = "ip4addr"
28 broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 broadcast"))
29 broadcast.datatype = "ip4addr"
32 dns = section:taboption("general", DynamicList, "dns",
33 translate("Use custom DNS servers"))
35 dns.datatype = "ipaddr"
39 if luci.model.network:has_ipv6() then
41 local ip6assign = section:taboption("general", Value, "ip6assign", translate("IPv6 assignment length"),
42 translate("Assign a part of given length of every public IPv6-prefix to this interface"))
43 ip6assign:value("", translate("disabled"))
45 ip6assign.datatype = "max(64)"
47 local ip6hint = section:taboption("general", Value, "ip6hint", translate("IPv6 assignment hint"),
48 translate("Assign prefix parts using this hexadecimal subprefix ID for this interface."))
49 for i=33,64 do ip6hint:depends("ip6assign", i) end
51 ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address"))
52 ip6addr.datatype = "ip6addr"
53 ip6addr:depends("ip6assign", "")
56 ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway"))
57 ip6gw.datatype = "ip6addr"
58 ip6gw:depends("ip6assign", "")
61 local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"),
62 translate("Public prefix routed to this device for distribution to clients."))
63 ip6prefix.datatype = "ip6addr"
64 ip6prefix:depends("ip6assign", "")
66 local ip6ifaceid = s:taboption("general", Value, "ip6ifaceid", translate("IPv6 suffix"),
67 translate("Optional. Allowed values: 'eui64', 'random', fixed value like '::1' " ..
68 "or '::1:2'. When IPv6 prefix (like 'a:b:c:d::') is received from a " ..
69 "delegating server, use the suffix (like '::1') to form the IPv6 address " ..
70 "('a:b:c:d::1') for the interface."))
71 ip6ifaceid.datatype = "ip6hostid"
72 ip6ifaceid.placeholder = "::1"
73 ip6ifaceid.rmempty = true
78 luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
81 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
82 mtu.placeholder = "1500"
83 mtu.datatype = "max(9200)"
86 metric = section:taboption("advanced", Value, "metric",
87 translate("Use gateway metric"))
89 metric.placeholder = "0"
90 metric.datatype = "uinteger"