summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-14 19:39:09 +0000
committerSteven Barth <steven@midlink.org>2008-05-14 19:39:09 +0000
commita39bf5f58d880f17b10376b64670f54768354b65 (patch)
tree366b351c9d8accfb55fb97ea81893146dfad6c1a
parentba971df2afce4dbded063b887bd521e702be55e4 (diff)
* modules/freifunk: Updated wizard to be more generic
-rw-r--r--applications/luci-fw/src/model/cbi/admin_network/routing.lua6
-rw-r--r--contrib/package/ffluci/Makefile6
-rw-r--r--modules/admin-core/src/view/admin_index/wizard.htm24
-rw-r--r--modules/freifunk/root/etc/config/freifunk4
-rw-r--r--modules/freifunk/src/controller/admin/index/wizard.lua83
5 files changed, 104 insertions, 19 deletions
diff --git a/applications/luci-fw/src/model/cbi/admin_network/routing.lua b/applications/luci-fw/src/model/cbi/admin_network/routing.lua
index 45016f42b..5805b1d3f 100644
--- a/applications/luci-fw/src/model/cbi/admin_network/routing.lua
+++ b/applications/luci-fw/src/model/cbi/admin_network/routing.lua
@@ -21,8 +21,8 @@ for k, v in pairs(ffluci.model.uci.sections("network")) do
end
end
-s:option(Flag, "fwd", "FWD", "weiterleiten")
-s:option(Flag, "nat", "NAT", "übersetzen")
-s:option(Flag, "bidi", "<->", "beide Richtungen")
+s:option(Flag, "fwd", "FWD", "weiterleiten").rmempty = true
+s:option(Flag, "nat", "NAT", "übersetzen").rmempty = true
+s:option(Flag, "bidi", "<->", "beide Richtungen").rmempty = true
return m
diff --git a/contrib/package/ffluci/Makefile b/contrib/package/ffluci/Makefile
index 998469541..04d8e715f 100644
--- a/contrib/package/ffluci/Makefile
+++ b/contrib/package/ffluci/Makefile
@@ -66,7 +66,7 @@ endef
define Package/ffluci-ff-halle
$(call Package/ffluci/template)
DEPENDS:=ffluci \
- +ffluci-sgi-haserl +ffluci-mod-freifunk +ffluci-app-firewall +ffluci-app-splash \
+ +ffluci-sgi-haserl +ffluci-mod-freifunk +ffluci-app-splash \
+olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
+kmod-tun +ip
TITLE:=Freifunk Halle Community Meta-Package
@@ -79,7 +79,7 @@ endef
define Package/ffluci-ff-leipzig
$(call Package/ffluci/template)
DEPENDS:=ffluci \
- +ffluci-sgi-haserl +ffluci-mod-freifunk +ffluci-app-firewall +ffluci-app-splash \
+ +ffluci-sgi-haserl +ffluci-mod-freifunk +ffluci-app-splash \
+olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
+kmod-tun +ip
TITLE:=Freifunk Leipzig Community Meta-Package
@@ -107,7 +107,7 @@ endef
define Package/ffluci-mod-freifunk
$(call Package/ffluci/template)
- DEPENDS:=ffluci +ffluci-mod-admin-core
+ DEPENDS:=ffluci +ffluci-mod-admin-core +ffluci-app-firewall
TITLE:=Freifunk public and administrative pages
endef
diff --git a/modules/admin-core/src/view/admin_index/wizard.htm b/modules/admin-core/src/view/admin_index/wizard.htm
index 8c1a0952b..b08703ffe 100644
--- a/modules/admin-core/src/view/admin_index/wizard.htm
+++ b/modules/admin-core/src/view/admin_index/wizard.htm
@@ -23,7 +23,29 @@
<div class="cbi-value-field"><input type="checkbox" name="dhcp" value="1" checked="checked" /></div>
</div>
<div class="cbi-value">
- <div class="cbi-value-title"><%:shareinet Internet teilen%></div>
+ <div class="cbi-value-title"><%:cfginternal Erlaube Zugriff von internem Netzwerk%>:</div>
+ <div class="cbi-value-field"><select name="frominternal">
+ <option value=""></option>
+<% for k, v in pairs(ffluci.model.uci.sections("network")) do
+ if v[".type"] == "interface" and k ~= "loopback" then %>
+<option value="<%=k%>"<% if k == "lan" then %> selected="selected"<% end %>><%=k%></option>
+<% end
+end %>
+ </select></div>
+ </div>
+ <div class="cbi-value">
+ <div class="cbi-value-title"><%:cfgexternal Erlaube Zugriff auf externes Netzwerk%>:</div>
+ <div class="cbi-value-field"><select name="toexternal">
+ <option value=""></option>
+<% for k, v in pairs(ffluci.model.uci.sections("network")) do
+ if v[".type"] == "interface" and k ~= "loopback" then %>
+<option value="<%=k%>"<% if k == "wan" then %> selected="selected"<% end %>><%=k%></option>
+<% end
+end %>
+ </select></div>
+ </div>
+ <div class="cbi-value">
+ <div class="cbi-value-title"><%:shareinet Internetzugang ankündigen%></div>
<div class="cbi-value-field"><input type="checkbox" name="shareinet" value="1" checked="checked" /></div>
</div>
</div>
diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk
index 01b83f2c7..889b79787 100644
--- a/modules/freifunk/root/etc/config/freifunk
+++ b/modules/freifunk/root/etc/config/freifunk
@@ -19,7 +19,3 @@ config public community
option dhcp 10.0.0.0
option dhcpmask 255.255.255.0
option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
-
-config settings routing
- option internal 0
- option internet 0
diff --git a/modules/freifunk/src/controller/admin/index/wizard.lua b/modules/freifunk/src/controller/admin/index/wizard.lua
index c7064bb1b..efca38d21 100644
--- a/modules/freifunk/src/controller/admin/index/wizard.lua
+++ b/modules/freifunk/src/controller/admin/index/wizard.lua
@@ -30,6 +30,7 @@ function configure_freifunk()
uci:t_load("luci_splash")
uci:t_load("olsr")
uci:t_load("wireless")
+ uci:t_load("luci_fw")
-- Configure FF-Interface
@@ -43,16 +44,59 @@ function configure_freifunk()
uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask"))
uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns"))
- -- Enable internal routing
- uci:t_set("freifunk", "routing", "internal", "1")
+ -- Reset Routing
+ local routing = uci:t_sections("luci_fw")
+ if routing then
+ for k, v in pairs(routing) do
+ if v[".type"] == "routing" and (v.iface == "ff" or v.oface == "ff") then
+ uci:t_del("luci_fw", k)
+ end
+ end
- -- Enable internet routing
- if ffluci.http.formvalue("shareinet") then
- uci:t_set("freifunk", "routing", "internet", "1")
- else
- uci:t_set("freifunk", "routing", "internet", "0")
+ local int = uci:t_add("luci_fw", "routing")
+ uci:t_set("luci_fw", int, "iface", "ff")
+ uci:t_set("luci_fw", int, "oface", "ff")
+ uci:t_set("luci_fw", int, "fwd", "1")
end
+ -- Routing from Internal
+ local iface = ffluci.http.formvalue("frominternal")
+ if iface and iface ~= "" then
+ local routing = uci:t_sections("luci_fw")
+ if routing then
+ for k, v in pairs(routing) do
+ if v[".type"] == "routing" and (v.iface == iface and v.oface == "ff") then
+ uci:t_del("luci_fw", k)
+ end
+ end
+
+ local int = uci:t_add("luci_fw", "routing")
+ uci:t_set("luci_fw", int, "iface", iface)
+ uci:t_set("luci_fw", int, "oface", "ff")
+ uci:t_set("luci_fw", int, "fwd", "1")
+ uci:t_set("luci_fw", int, "nat", "1")
+ end
+ end
+
+ -- Routing to External
+ local iface = ffluci.http.formvalue("toexternal")
+ if iface and iface ~= "" then
+ local routing = uci:t_sections("luci_fw")
+ if routing then
+ for k, v in pairs(routing) do
+ if v[".type"] == "routing" and (v.oface == iface and v.iface == "ff") then
+ uci:t_del("luci_fw", k)
+ end
+ end
+
+ local int = uci:t_add("luci_fw", "routing")
+ uci:t_set("luci_fw", int, "iface", "ff")
+ uci:t_set("luci_fw", int, "oface", iface)
+ uci:t_set("luci_fw", int, "fwd", "1")
+ uci:t_set("luci_fw", int, "nat", "1")
+ end
+ end
+
-- Configure DHCP
if ffluci.http.formvalue("dhcp") then
local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)")
@@ -91,7 +135,29 @@ function configure_freifunk()
local sk = uci:t_add("luci_splash", "iface")
uci:t_set("luci_splash", sk, "network", "ffdhcp")
- end
+ end
+
+ local routing = uci:t_sections("luci_fw")
+ if routing then
+ for k, v in pairs(routing) do
+ if v[".type"] == "routing" and (v.iface == "ffdhcp" or v.oface == "ffdhcp") then
+ uci:t_del("luci_fw", k)
+ end
+ end
+
+ local int = uci:t_add("luci_fw", "routing")
+ uci:t_set("luci_fw", int, "iface", "ffdhcp")
+ uci:t_set("luci_fw", int, "oface", "ff")
+ uci:t_set("luci_fw", int, "nat", "1")
+
+ local iface = ffluci.http.formvalue("toexternal")
+ if iface and iface ~= "" then
+ local int = uci:t_add("luci_fw", "routing")
+ uci:t_set("luci_fw", int, "iface", "ffdhcp")
+ uci:t_set("luci_fw", int, "oface", iface)
+ uci:t_set("luci_fw", int, "nat", "1")
+ end
+ end
end
-- Configure OLSR
@@ -166,6 +232,7 @@ function configure_freifunk()
uci:t_save("luci_splash")
uci:t_save("olsr")
uci:t_save("wireless")
+ uci:t_save("luci_fw")
ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes"))
end \ No newline at end of file