2 LuCI - Lua Configuration Interface
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
13 local map, section, net = ...
14 local ifc = net:get_interface()
16 local ipaddr, netmask, gateway, broadcast, accept_ra, send_rs, ip6addr, ip6gw
17 local macaddr, mtu, metric
20 ipaddr = section:taboption("general", Value, "ipaddr", translate("IPv4 address"))
21 ipaddr.datatype = "ip4addr"
24 netmask = section:taboption("general", Value, "netmask",
25 translate("IPv4 netmask"))
27 netmask.datatype = "ip4addr"
28 netmask:value("255.255.255.0")
29 netmask:value("255.255.0.0")
30 netmask:value("255.0.0.0")
33 gateway = section:taboption("general", Value, "gateway", translate("IPv4 gateway"))
34 gateway.datatype = "ip4addr"
37 broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 broadcast"))
38 broadcast.datatype = "ip4addr"
41 if luci.model.network:has_ipv6() then
43 accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements"))
44 accept_ra.default = accept_ra.disabled
47 send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations"))
48 send_rs.default = send_rs.enabled
49 send_rs:depends("accept_ra", "")
52 ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address"))
53 ip6addr.datatype = "ip6addr"
54 ip6addr:depends("accept_ra", "")
57 ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway"))
58 ip6gw.datatype = "ip6addr"
59 ip6gw:depends("accept_ra", "")
64 macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address"))
65 macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00"
66 macaddr.datatype = "macaddr"
69 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
70 mtu.placeholder = "1500"
71 mtu.datatype = "max(1500)"
74 metric = section:taboption("advanced", Value, "metric",
75 translate("Use gateway metric"))
77 metric.placeholder = "0"
78 metric.datatype = "uinteger"