Overall Freifunk improvements
authorSteven Barth <steven@midlink.org>
Sun, 14 Sep 2008 21:59:14 +0000 (21:59 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 14 Sep 2008 21:59:14 +0000 (21:59 +0000)
applications/community-halle/root/etc/uci-defaults/luci-community-halle
applications/community-leipzig/root/etc/uci-defaults/luci-community-leipzig
applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua
contrib/package/olsrd-luci/files/etc/config/olsrd
modules/freifunk/luasrc/model/cbi/freifunk/contact.lua
modules/freifunk/luasrc/model/cbi/freifunk/freifunk.lua
modules/freifunk/root/etc/config/freifunk

index 9242f3f..d6d40f0 100644 (file)
@@ -1,12 +1,7 @@
 #!/bin/sh
 uci batch <<-EOF
 #!/bin/sh
 uci batch <<-EOF
-        set freifunk.community.name='Freifunk Halle'
-        set freifunk.community.homepage=http://halle.freifunk.net
-        set freifunk.community.realm=pool.freifunk-halle.net
-        set freifunk.wifi_iface.ssid=halle.freifunk.net
         set luci.main.mediaurlbase=/luci-static/fledermaus
         set luci.main.lang=de
         set luci.main.mediaurlbase=/luci-static/fledermaus
         set luci.main.lang=de
-        commit freifunk
         commit luci
 EOF
        
         commit luci
 EOF
        
index 29d549b..ca07f18 100644 (file)
@@ -1,12 +1,7 @@
 #!/bin/sh
 uci batch <<-EOF
 #!/bin/sh
 uci batch <<-EOF
-        set freifunk.community.name='Freifunk Leipzig'
-        set freifunk.community.homepage=http://leipzig.freifunk.net
-        set freifunk.community.realm=db.leipzig.freifunk.net
-        set freifunk.wifi_iface.ssid=leipzig.freifunk.net
         set luci.main.mediaurlbase=/luci-static/fledermaus
         set luci.main.lang=de
         set luci.main.mediaurlbase=/luci-static/fledermaus
         set luci.main.lang=de
-        commit freifunk
         commit luci
 EOF
        
\ No newline at end of file
         commit luci
 EOF
        
\ No newline at end of file
index 74a66e8..afde3fd 100644 (file)
@@ -36,11 +36,9 @@ main = f:field(Flag, "wifi", "Freifunkzugang einrichten")
 net = f:field(Value, "net", "Freifunknetz")
 net.rmempty = true
 net:depends("wifi", "1")
 net = f:field(Value, "net", "Freifunknetz")
 net.rmempty = true
 net:depends("wifi", "1")
-net:value("104.0", "Berlin (104.0)")
-net:value("104.59", "Leisnig/Gadow/div. (104.59)")
-net:value("104.61", "Leipzig (104.61)")
-net:value("104.62", "Halle (104.62)")
-net:value("191.161", "Augsburg (191.161)")
+uci:foreach("freifunk", "community", function(s)
+       net:value(s[".name"], s.name)
+end)
 
 function net.cfgvalue(self, section)
        return uci:get("freifunk", "wizard", "net")
 
 function net.cfgvalue(self, section)
        return uci:get("freifunk", "wizard", "net")
@@ -51,12 +49,9 @@ function net.write(self, section, value)
 end
 
 
 end
 
 
-subnet = f:field(ListValue, "subnet", "Subnetz (Projekt)")
+subnet = f:field(Value, "subnet", "Subnetz (Projekt)")
 subnet.rmempty = true
 subnet:depends("wifi", "1")
 subnet.rmempty = true
 subnet:depends("wifi", "1")
-for i=0, 255 do
-       subnet:value(i)
-end
 function subnet.cfgvalue(self, section)
        return uci:get("freifunk", "wizard", "subnet")
 end
 function subnet.cfgvalue(self, section)
        return uci:get("freifunk", "wizard", "subnet")
 end
@@ -120,6 +115,7 @@ function main.write(self, section, value)
        end
 
        local device = dev:formvalue(section)
        end
 
        local device = dev:formvalue(section)
+       local community
 
        -- Collect IP-Address
        local inet = net:formvalue(section)
 
        -- Collect IP-Address
        local inet = net:formvalue(section)
@@ -129,6 +125,9 @@ function main.write(self, section, value)
        -- Invalidate fields
        if not inet then
                net.tag_missing[section] = true
        -- Invalidate fields
        if not inet then
                net.tag_missing[section] = true
+       else
+               community = inet
+               inet = uci:get("freifunk", community, "prefix") or inet
        end
        if not isubnet then
                subnet.tag_missing[section] = true
        end
        if not isubnet then
                subnet.tag_missing[section] = true
@@ -145,13 +144,14 @@ function main.write(self, section, value)
 
 
        -- Cleanup
 
 
        -- Cleanup
-       luci.util.perror("1")
        tools.wifi_delete_ifaces(device)
        tools.wifi_delete_ifaces(device)
-       luci.util.perror("2")
        tools.network_remove_interface(device)
        tools.network_remove_interface(device)
-       luci.util.perror("3")
        tools.firewall_zone_remove_interface("freifunk", device)
        tools.firewall_zone_remove_interface("freifunk", device)
-
+       
+       -- Tune community settings
+       if community then
+               uci:tset("freifunk", "community", uci:get_all("freifunk", community))
+       end
 
        -- Tune wifi device
        local devconfig = _strip_internals(uci:get_all("freifunk", "wifi_device"))
 
        -- Tune wifi device
        local devconfig = _strip_internals(uci:get_all("freifunk", "wifi_device"))
@@ -161,6 +161,7 @@ function main.write(self, section, value)
        local ifconfig = _strip_internals(uci:get_all("freifunk", "wifi_iface"))
        ifconfig.device = device
        ifconfig.network = device
        local ifconfig = _strip_internals(uci:get_all("freifunk", "wifi_iface"))
        ifconfig.device = device
        ifconfig.network = device
+       ifconfig.ssid = uci:get("freifunk", community, "ssid")
        uci:section("wireless", "wifi-iface", nil, ifconfig)
 
        -- Save wifi
        uci:section("wireless", "wifi-iface", nil, ifconfig)
 
        -- Save wifi
@@ -241,6 +242,8 @@ function client.write(self, section, value)
        if not inet or not isubnet or not inode then
                return
        end
        if not inet or not isubnet or not inode then
                return
        end
+       
+       inet = uci:get("freifunk", inet, "prefix") or inet
 
        local dhcpbeg = 48 + tonumber(inode) * 4
        local dclient = "%s.%s.%s" % {inet:gsub("^[0-9]+", "10"), isubnet, dhcpbeg}
 
        local dhcpbeg = 48 + tonumber(inode) * 4
        local dclient = "%s.%s.%s" % {inet:gsub("^[0-9]+", "10"), isubnet, dhcpbeg}
@@ -266,6 +269,21 @@ function client.write(self, section, value)
 
        uci:section("dhcp", "dhcp", device .. "dhcp", dhcpbase)
        uci:save("dhcp")
 
        uci:section("dhcp", "dhcp", device .. "dhcp", dhcpbase)
        uci:save("dhcp")
+       
+       uci:delete_all("firewall", "rule", {
+               src="freifunk",
+               proto="udp",
+               src_port="68",
+               dest_port="67"
+       })
+       uci:section("firewall", "rule", nil, {
+               src="freifunk",
+               proto="udp",
+               src_port="68",
+               dest_port="67",
+               target="ACCEPT"
+       })
+       
 
 
        -- Delete old splash
 
 
        -- Delete old splash
index 2e0e4e6..3cbfa62 100644 (file)
@@ -16,6 +16,7 @@ config 'LoadPlugin'
 config 'LoadPlugin'
        option 'library' 'olsrd_nameservice.so.0.3'
        option 'name' 'luci-node.olsr'
 config 'LoadPlugin'
        option 'library' 'olsrd_nameservice.so.0.3'
        option 'name' 'luci-node.olsr'
+       option 'latlon_file' '/dev/null'
 
 config 'LoadPlugin'
        option 'library' 'olsrd_txtinfo.so.0.1'
 
 config 'LoadPlugin'
        option 'library' 'olsrd_txtinfo.so.0.1'
index 203b1ce..fd3bcf7 100644 (file)
@@ -20,7 +20,12 @@ c:option(Value, "name", translate("name"))
 c:option(Value, "mail", translate("mail"), translate("mail1"))
 c:option(Value, "phone", translate("phone"))
 c:option(Value, "location", translate("location"))
 c:option(Value, "mail", translate("mail"), translate("mail1"))
 c:option(Value, "phone", translate("phone"))
 c:option(Value, "location", translate("location"))
-c:option(Value, "geo", translate("coord"), translate("coord1"))
 c:option(Value, "note", translate("note"))
 
 c:option(Value, "note", translate("note"))
 
-return m
\ No newline at end of file
+m2 = Map("system", translate("geo"))
+
+s = m2:section(TypedSection, "system", "")
+s:option(Value, "latitude", translate("latitude", "Breite")).rmempty = true
+s:option(Value, "longitude", translate("longitude", "Länge")).rmempty = true
+
+return m, m2
\ No newline at end of file
index f1bf641..1a14746 100644 (file)
@@ -18,6 +18,7 @@ für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konf
 des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]])
 c:option(Value, "name", "Gemeinschaft")
 c:option(Value, "homepage", "Webseite")
 des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]])
 c:option(Value, "name", "Gemeinschaft")
 c:option(Value, "homepage", "Webseite")
-c:option(Value, "realm", "Realm")
+c:option(Value, "ssid", "ESSID")
+c:option(Value, "prefix", "Netzprefix")
 
 return m
\ No newline at end of file
 
 return m
\ No newline at end of file
index 832f69d..7678fc7 100644 (file)
@@ -1,32 +1,28 @@
+config settings wizard
 config public contact
 config public contact
-       option nickname
-       option name
-       option mail
-       option phone
-       option location
-       option geo
-       option note
+       option nickname ''
+       option name ''
+       option mail ''
+       option phone ''
+       option location ''
+       option note ''
 
 config public community
 
 config public community
-    option name     "Freifunk Halle"
-    option homepage http://halle.freifunk.net
-    option realm    netz.freifunk-halle.net
-    
-config settings wizard
-           
+       option name 'Freifunk'
+       option homepage 'http://freifunk.net'
 
 config fw_rule http
        option src freifunk
        option target ACCEPT
        option proto  tcp
        option dest_port 80
 
 config fw_rule http
        option src freifunk
        option target ACCEPT
        option proto  tcp
        option dest_port 80
-       
+
 config fw_rule https
        option src freifunk
        option target ACCEPT
        option proto  tcp
        option dest_port 443
 config fw_rule https
        option src freifunk
        option target ACCEPT
        option proto  tcp
        option dest_port 443
-        
+
 config fw_rule ssh
        option src freifunk
        option target ACCEPT
 config fw_rule ssh
        option src freifunk
        option target ACCEPT
@@ -38,12 +34,11 @@ config fw_rule olsr
        option target ACCEPT
        option proto  udp
        option dest_port 698
        option target ACCEPT
        option proto  udp
        option dest_port 698
-       
+
 config fw_forwarding lan
        option src lan
        option dest freifunk
 
 config fw_forwarding lan
        option src lan
        option dest freifunk
 
-    
 
 config defaults wifi_device
     option channel   1
 
 config defaults wifi_device
     option channel   1
@@ -53,17 +48,16 @@ config defaults wifi_device
     option rxant 1
     option diversity 0
     option disabled 0
     option rxant 1
     option diversity 0
     option disabled 0
-    
+
 
 config defaults wifi_iface
     option mode                adhoc
 
 config defaults wifi_iface
     option mode                adhoc
-    option ssid     halle.freifunk.net
     option bssid    02:CA:FF:EE:BA:BE
     option txpower  10
     option rts         2347
     option frag                512
     option bssid    02:CA:FF:EE:BA:BE
     option txpower  10
     option rts         2347
     option frag                512
-    
-    
+
+
 config defaults interface
     option netmask  255.0.0.0
     option dns      "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
 config defaults interface
     option netmask  255.0.0.0
     option dns      "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
@@ -71,12 +65,12 @@ config defaults interface
 
 config defaults alias
        option netmask  255.255.255.0 
 
 config defaults alias
        option netmask  255.255.255.0 
-       
-       
+
+
 config defaults dhcp
        option leasetime 30m
 config defaults dhcp
        option leasetime 30m
-       
-       
+
+
 config defaults olsr_interface
        option  HelloInterval 6.0
        option  HelloValidityTime 108.0
 config defaults olsr_interface
        option  HelloInterval 6.0
        option  HelloValidityTime 108.0
@@ -85,4 +79,35 @@ config defaults olsr_interface
        option  MidInterval 18.0
        option  MidValidityTime 324.0
        option  HnaInterval 18.0
        option  MidInterval 18.0
        option  MidValidityTime 324.0
        option  HnaInterval 18.0
-       option  HnaValidityTime 108.0
\ No newline at end of file
+       option  HnaValidityTime 108.0
+
+
+config community leipzig
+       option name "Freifunk Leipzig (104.61)"
+       option homepage http://leipzig.freifunk.net
+       option ssid "leipzig.freifunk.net"
+       option prefix "104.61"
+
+config community halle
+       option name "Freifunk Halle (104.62)"
+       option homepage http://halle.freifunk.net
+       option ssid "halle.freifunk.net"
+       option prefix "104.62"
+
+config community l59
+       option name "Leisnig, Gadow, ... (104.59)"
+       option homepage http://freifunk.net
+       option ssid "start.freifunk.net"
+       option prefix "104.59"
+
+config community berlin
+       option name "Freifunk Berlin (104)"
+       option homepage http://berlin.freifunk.net
+       option ssid "olsr.freifunk.net"
+       option prefix "104"
+
+config community augsburg
+       option name "Freifunk Augsburg (191.161)"
+       option homepage http://augsburg.freifunk.net
+       option ssid "augsburg.freifunk.net"
+       option prefix "191.161"
\ No newline at end of file