| 1 | --[[ |
|---|
| 2 | LuCI - Lua Configuration Interface |
|---|
| 3 | |
|---|
| 4 | Copyright 2011-2012 Jo-Philipp Wich <xm@subsignal.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 | |
|---|
| 13 | local map, section, net = ... |
|---|
| 14 | local ifc = net:get_interface() |
|---|
| 15 | |
|---|
| 16 | local hostname, accept_ra, send_rs |
|---|
| 17 | local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | hostname = section:taboption("general", Value, "hostname", |
|---|
| 21 | translate("Hostname to send when requesting DHCP")) |
|---|
| 22 | |
|---|
| 23 | hostname.placeholder = luci.sys.hostname() |
|---|
| 24 | hostname.datatype = "hostname" |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | if luci.model.network:has_ipv6() then |
|---|
| 28 | |
|---|
| 29 | accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements")) |
|---|
| 30 | accept_ra.default = accept_ra.enabled |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations")) |
|---|
| 34 | send_rs.default = send_rs.disabled |
|---|
| 35 | send_rs:depends("accept_ra", "") |
|---|
| 36 | |
|---|
| 37 | end |
|---|
| 38 | |
|---|
| 39 | bcast = section:taboption("advanced", Flag, "broadcast", |
|---|
| 40 | translate("Use broadcast flag"), |
|---|
| 41 | translate("Required for certain ISPs, e.g. Charter with DOCSIS 3")) |
|---|
| 42 | |
|---|
| 43 | bcast.default = bcast.disabled |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | defaultroute = section:taboption("advanced", Flag, "defaultroute", |
|---|
| 47 | translate("Use default gateway"), |
|---|
| 48 | translate("If unchecked, no default route is configured")) |
|---|
| 49 | |
|---|
| 50 | defaultroute.default = defaultroute.enabled |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | peerdns = section:taboption("advanced", Flag, "peerdns", |
|---|
| 54 | translate("Use DNS servers advertised by peer"), |
|---|
| 55 | translate("If unchecked, the advertised DNS server addresses are ignored")) |
|---|
| 56 | |
|---|
| 57 | peerdns.default = peerdns.enabled |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | dns = section:taboption("advanced", DynamicList, "dns", |
|---|
| 61 | translate("Use custom DNS servers")) |
|---|
| 62 | |
|---|
| 63 | dns:depends("peerdns", "") |
|---|
| 64 | dns.datatype = "ipaddr" |
|---|
| 65 | dns.cast = "string" |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | metric = section:taboption("advanced", Value, "metric", |
|---|
| 69 | translate("Use gateway metric")) |
|---|
| 70 | |
|---|
| 71 | metric.placeholder = "0" |
|---|
| 72 | metric.datatype = "uinteger" |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | clientid = section:taboption("advanced", Value, "clientid", |
|---|
| 76 | translate("Client ID to send when requesting DHCP")) |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | vendorclass = section:taboption("advanced", Value, "vendorid", |
|---|
| 80 | translate("Vendor Class to send when requesting DHCP")) |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address")) |
|---|
| 84 | macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00" |
|---|
| 85 | macaddr.datatype = "macaddr" |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) |
|---|
| 89 | mtu.placeholder = "1500" |
|---|
| 90 | mtu.datatype = "max(1500)" |
|---|