f7f0467719f5c0d736729966fc889ba7b0d675f6
[project/luci.git] / applications / luci-app-freifunk-policyrouting / luasrc / model / cbi / freifunk / policyrouting.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2011 Manuel Munz <freifunk at somakoma de>
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 uci = require "luci.model.uci".cursor()
14
15 m = Map("freifunk-policyrouting", translate("Policy Routing"), translate("These pages can be used to setup policy routing for certain firewall zones. "..
16         "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 "..
17         "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. "))
18 m:chain("network")
19
20 c = m:section(NamedSection, "pr", "settings", "")
21
22 local pr = c:option(Flag, "enable", translate("Enable Policy Routing"))
23 pr.rmempty = false
24
25 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 "..
26         "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 "..
27         "select this option."))
28 strict.rmempty = false
29
30 local fallback = c:option(Flag, "fallback", translate("Fallback to mesh"),
31         translate("If your own gateway is not available then fallback to the mesh default gateway."))
32 strict.rmempty = false
33
34 local zones = c:option(MultiValue, "zones", translate("Firewall zones"), translate("All traffic from interfaces belonging to these zones will be sent via "..
35         "a gateway in the mesh network."))
36 uci:foreach("firewall", "zone", function(section)
37         local name = section.name
38         if not (name == "wan") then
39                 zones:value(name)
40         end
41 end)
42
43 return m