policyrouting.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334
  1. -- Copyright 2011 Manuel Munz <freifunk at somakoma de>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local uci = require "luci.model.uci".cursor()
  4. m = Map("freifunk-policyrouting", translate("Policy Routing"), translate("These pages can be used to setup policy routing for certain firewall zones. "..
  5. "This is useful if you need to use your own internet connection for yourself but you don't want to share it with others (thats why it can also be "..
  6. "called 'Ego Mode'). Your own traffic is then sent via your internet connection while traffic originating from the mesh will use another gateway in the mesh. "))
  7. m:chain("network")
  8. c = m:section(NamedSection, "pr", "settings", "")
  9. local pr = c:option(Flag, "enable", translate("Enable Policy Routing"))
  10. pr.rmempty = false
  11. local strict = c:option(Flag, "strict", translate("Strict Filtering"), translate("If no default route is received from the mesh network then traffic which belongs to "..
  12. "the selected firewall zones is routed via your internet connection as a fallback. If you do not want this and instead block that traffic then you should "..
  13. "select this option."))
  14. strict.rmempty = false
  15. local fallback = c:option(Flag, "fallback", translate("Fallback to mesh"),
  16. translate("If your own gateway is not available then fallback to the mesh default gateway."))
  17. strict.rmempty = false
  18. local zones = c:option(MultiValue, "zones", translate("Firewall zones"), translate("All traffic from interfaces belonging to these zones will be sent via "..
  19. "a gateway in the mesh network."))
  20. uci:foreach("firewall", "zone", function(section)
  21. local name = section.name
  22. if not (name == "wan") then
  23. zones:value(name)
  24. end
  25. end)
  26. return m