network.lua 796 B

123456789101112131415161718192021222324252627282930313233
  1. m = Map("network", "Network")
  2. s = m:section(TypedSection, "interface")
  3. s.addremove = false
  4. s.anonymous = true
  5. function s:filter(value)
  6. return value =="lan" and value
  7. end
  8. s:depends("proto", "static")
  9. s:depends("proto", "dhcp")
  10. p = s:option(ListValue, "proto", "Protocol")
  11. p:value("static", "static")
  12. p:value("dhcp", "DHCP")
  13. p.default = "static"
  14. ip = s:option(Value, "ipaddr", translate("ip", "IP Address"))
  15. ip:depends("proto", "static")
  16. netmask = s:option(Value, "netmask", "Netmask")
  17. netmask:depends("proto", "static")
  18. gw = s:option(Value, "gateway", "Gateway")
  19. gw:depends("proto", "static")
  20. dns = s:option(Value, "dns", "DNS-Server")
  21. dns:depends("proto", "static")
  22. function dns:validate(value)
  23. return value:match("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
  24. end
  25. return m -- Returns the map