coovachilli_network.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
  3. -- Licensed to the public under the Apache License 2.0.
  4. local sys = require"luci.sys"
  5. local ip = require "luci.ip"
  6. m = Map("coovachilli")
  7. -- tun
  8. s1 = m:section(TypedSection, "tun")
  9. s1.anonymous = true
  10. s1:option( Flag, "usetap" )
  11. s1:option( Value, "tundev" ).optional = true
  12. s1:option( Value, "txqlen" ).optional = true
  13. net = s1:option( Value, "net" )
  14. for _, route in ipairs(ip.routes({ family = 4, type = 1 })) do
  15. if route.dest:prefix() > 0 and route.dest:prefix() < 32 then
  16. net:value( route.dest:string() )
  17. end
  18. end
  19. s1:option( Value, "dynip" ).optional = true
  20. s1:option( Value, "statip" ).optional = true
  21. s1:option( Value, "dns1" ).optional = true
  22. s1:option( Value, "dns2" ).optional = true
  23. s1:option( Value, "domain" ).optional = true
  24. s1:option( Value, "ipup" ).optional = true
  25. s1:option( Value, "ipdown" ).optional = true
  26. s1:option( Value, "conup" ).optional = true
  27. s1:option( Value, "condown" ).optional = true
  28. -- dhcp config
  29. s2 = m:section(TypedSection, "dhcp")
  30. s2.anonymous = true
  31. dif = s2:option( Value, "dhcpif" )
  32. for _, nif in ipairs(sys.net.devices()) do
  33. if nif ~= "lo" then dif:value(nif) end
  34. end
  35. s2:option( Value, "dhcpmac" ).optional = true
  36. s2:option( Value, "lease" ).optional = true
  37. s2:option( Value, "dhcpstart" ).optional = true
  38. s2:option( Value, "dhcpend" ).optional = true
  39. s2:option( Flag, "eapolenable" )
  40. return m