proto_static.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local map, section, net = ...
  4. local ifc = net:get_interface()
  5. local ipaddr, netmask, gateway, broadcast, dns, accept_ra, send_rs, ip6addr, ip6gw
  6. local mtu, metric
  7. ipaddr = section:taboption("general", Value, "ipaddr", translate("IPv4 address"))
  8. ipaddr.datatype = "ip4addr"
  9. netmask = section:taboption("general", Value, "netmask",
  10. translate("IPv4 netmask"))
  11. netmask.datatype = "ip4addr"
  12. netmask:value("255.255.255.0")
  13. netmask:value("255.255.0.0")
  14. netmask:value("255.0.0.0")
  15. gateway = section:taboption("general", Value, "gateway", translate("IPv4 gateway"))
  16. gateway.datatype = "ip4addr"
  17. broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 broadcast"))
  18. broadcast.datatype = "ip4addr"
  19. dns = section:taboption("general", DynamicList, "dns",
  20. translate("Use custom DNS servers"))
  21. dns.datatype = "ipaddr"
  22. dns.cast = "string"
  23. if luci.model.network:has_ipv6() then
  24. local ip6assign = section:taboption("general", Value, "ip6assign", translate("IPv6 assignment length"),
  25. translate("Assign a part of given length of every public IPv6-prefix to this interface"))
  26. ip6assign:value("", translate("disabled"))
  27. ip6assign:value("64")
  28. ip6assign.datatype = "max(64)"
  29. local ip6hint = section:taboption("general", Value, "ip6hint", translate("IPv6 assignment hint"),
  30. translate("Assign prefix parts using this hexadecimal subprefix ID for this interface."))
  31. for i=33,64 do ip6hint:depends("ip6assign", i) end
  32. ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address"))
  33. ip6addr.datatype = "ip6addr"
  34. ip6addr:depends("ip6assign", "")
  35. ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway"))
  36. ip6gw.datatype = "ip6addr"
  37. ip6gw:depends("ip6assign", "")
  38. local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"),
  39. translate("Public prefix routed to this device for distribution to clients."))
  40. ip6prefix.datatype = "ip6addr"
  41. ip6prefix:depends("ip6assign", "")
  42. end
  43. luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
  44. mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
  45. mtu.placeholder = "1500"
  46. mtu.datatype = "max(9200)"
  47. metric = section:taboption("advanced", Value, "metric",
  48. translate("Use gateway metric"))
  49. metric.placeholder = "0"
  50. metric.datatype = "uinteger"