luci-0.8: merge complete trunk

This commit is contained in:
Jo-Philipp Wich 2008-12-23 21:39:38 +00:00
parent 8b1ddef6a4
commit 4081526ba7
81 changed files with 2328 additions and 358 deletions

221
.cproject Normal file
View file

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341">
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="luci" buildProperties="" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341" name="Preference Configuration" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.407447051" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.407447051.1470931541" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.823611263" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1685234798" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.570824141" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.491129717" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
<listOptionValue builtIn="false" value="/usr/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.858094059" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.344617955" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.564526987" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
<listOptionValue builtIn="false" value="/usr/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1426860237" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.869454750" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.838425449" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
<listOptionValue builtIn="false" value="/usr/include"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1755775295" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341" moduleId="org.eclipse.cdt.core.settings" name="Preference Configuration">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="luci.null.949486034" name="luci"/>
</storageModule>
</cproject>

View file

@ -5,8 +5,74 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.dltk.lua.core.nature</nature>
</natures>
</projectDescription>

View file

@ -1,6 +1,6 @@
include build/config.mk
MODULES = applications/* libs/* modules/* themes/* i18n/* contrib/*
MODULES = contrib/* applications/* libs/* modules/* themes/* i18n/*
OS:=$(shell uname)
export OS
@ -39,14 +39,14 @@ hostcopy:
hostenv: host ucidefaults
ucidefaults:
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-community-*"
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-freifunk-*"
runboa: hostenv
libs/sgi-webuci/host/buildconfig.sh $(realpath host) > host/etc/boa/boa.conf
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/boa) -c $(realpath host/etc/boa) -d"
runhttpd: hostenv
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)"
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/lucittpd) $(realpath host)/usr/lib/lucittpd/plugins"
runluci: luahost
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)"
@ -63,11 +63,15 @@ hostclean: clean
apidocs: hostenv
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh host/luci/ docs"
uvldocs: hostenv
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) \
"build/uvldoc $(realpath host) $(UVL_SCHEMEDIR) uvldocs $(DOCS)"
run:
# make run is deprecated #
# Please use: #
# #
# To run LuCI WebUI using LuCI HTTPD #
# To run LuCI WebUI using LuCIttpd #
# make runhttpd #
# #
# To run LuCI WebUI using Boa/Webuci #

View file

@ -17,5 +17,5 @@ $Id$
module "luci.controller.ffwizard"
function index()
entry({"admin", "index", "ffwizard"}, form("ffwizard"), "Freifunkassistent", 50)
entry({"admin", "freifunk", "ffwizard"}, form("ffwizard"), "Freifunkassistent", 50)
end

View file

@ -17,6 +17,7 @@ $Id$
local uci = require "luci.model.uci".cursor()
local tools = require "luci.tools.ffwizard"
local util = require "luci.util"
-------------------- View --------------------
@ -33,11 +34,13 @@ uci:foreach("wireless", "wifi-device",
main = f:field(Flag, "wifi", "Freifunkzugang einrichten")
net = f:field(Value, "net", "Freifunknetz")
net = f:field(Value, "net", "Freifunknetz", "1. Teil der IP-Adresse")
net.rmempty = true
net:depends("wifi", "1")
net:value("104.61", "Leipzig (104.61)")
net:value("104.62", "Halle (104.62)")
uci:foreach("freifunk", "community", function(s)
net:value(s[".name"], "%s (%s)" % {s.name, s.prefix})
end)
function net.cfgvalue(self, section)
return uci:get("freifunk", "wizard", "net")
end
@ -47,12 +50,9 @@ function net.write(self, section, value)
end
subnet = f:field(ListValue, "subnet", "Subnetz (Projekt)")
subnet = f:field(Value, "subnet", "Subnetz (Projekt)", "2. Teil der IP-Adresse")
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
@ -61,7 +61,7 @@ function subnet.write(self, section, value)
uci:save("freifunk")
end
node = f:field(Value, "node", "Knoten")
node = f:field(Value, "node", "Knoten", "3. Teil der IP-Adresse")
node.rmempty = true
node:depends("wifi", "1")
for i=1, 51 do
@ -77,14 +77,14 @@ end
client = f:field(Flag, "client", "WLAN-DHCP anbieten")
client:depends("wifi", "1")
client.rmempty = true
olsr = f:field(Flag, "olsr", "OLSR einrichten")
olsr.rmempty = true
share = f:field(ListValue, "sharenet", "Eigenen Internetzugang freigeben")
share:value("maybe", "-- keine Aktion --")
share:value("yes", "einschalten")
share:value("no", "ausschalten")
share = f:field(Flag, "sharenet", "Eigenen Internetzugang freigeben")
share.rmempty = true
@ -116,6 +116,7 @@ function main.write(self, section, value)
end
local device = dev:formvalue(section)
local community, external
-- Collect IP-Address
local inet = net:formvalue(section)
@ -125,6 +126,10 @@ function main.write(self, section, value)
-- Invalidate fields
if not inet then
net.tag_missing[section] = true
else
community = inet
external = uci:get("freifunk", community, "external") or ""
inet = uci:get("freifunk", community, "prefix") or inet
end
if not isubnet then
subnet.tag_missing[section] = true
@ -141,21 +146,26 @@ function main.write(self, section, value)
-- Cleanup
luci.util.perror("1")
tools.wifi_delete_ifaces(device)
luci.util.perror("2")
tools.network_remove_interface(device)
luci.util.perror("3")
tools.firewall_zone_remove_interface("freifunk", device)
-- Tune community settings
if community and uci:get("freifunk", 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"))
local devconfig = uci:get_all("freifunk", "wifi_device")
util.update(devconfig, uci:get_all(external, "wifi_device") or {})
uci:tset("wireless", device, devconfig)
-- Create wifi iface
local ifconfig = _strip_internals(uci:get_all("freifunk", "wifi_iface"))
local ifconfig = uci:get_all("freifunk", "wifi_iface")
util.update(ifconfig, uci:get_all(external, "wifi_iface") or {})
ifconfig.device = device
ifconfig.network = device
ifconfig.ssid = uci:get("freifunk", community, "ssid")
uci:section("wireless", "wifi-iface", nil, ifconfig)
-- Save wifi
@ -165,11 +175,17 @@ function main.write(self, section, value)
local newzone = tools.firewall_create_zone("freifunk", "DROP", "ACCEPT", "DROP", true)
if newzone then
uci:foreach("freifunk", "fw_forwarding", function(section)
uci:section("firewall", "forwarding", nil, _strip_internals(section))
uci:section("firewall", "forwarding", nil, section)
end)
uci:foreach(external, "fw_forwarding", function(section)
uci:section("firewall", "forwarding", nil, section)
end)
uci:foreach("freifunk", "fw_rule", function(section)
uci:section("firewall", "rule", nil, _strip_internals(section))
uci:section("firewall", "rule", nil, section)
end)
uci:foreach(external, "fw_rule", function(section)
uci:section("firewall", "rule", nil, section)
end)
uci:save("firewall")
@ -177,7 +193,9 @@ function main.write(self, section, value)
-- Crate network interface
local netconfig = _strip_internals(uci:get_all("freifunk", "interface"))
local netconfig = uci:get_all("freifunk", "interface")
util.update(netconfig, uci:get_all(external, "interface") or {})
netconfig.proto = "static"
netconfig.ipaddr = ip
uci:section("network", "interface", device, netconfig)
@ -192,27 +210,29 @@ function olsr.write(self, section, value)
return
end
local device = dev:formvalue(section)
local community = net:formvalue(section)
local external = community and uci:get("freifunk", community, "external") or ""
-- Delete old interface
uci:delete_all("freifunk", "Interface", {Interface=device})
uci:delete_all("olsrd", "Interface", {interface=device})
-- Write new interface
local olsrbase = _strip_internals(uci:get_all("freifunk", "olsr_interface"))
olsrbase.Interface = device
uci:section("olsr", "Interface", nil, olsrbase)
uci:save("olsr")
local olsrbase = uci:get_all("freifunk", "olsr_interface")
util.update(olsrbase, uci:get_all(external, "olsr_interface") or {})
olsrbase.interface = device
olsrbase.ignore = "0"
uci:section("olsrd", "Interface", nil, olsrbase)
uci:save("olsrd")
end
function share.write(self, section, value)
if value == "maybe" then
return
end
uci:delete_all("firewall", "forwarding", {src="freifunk", dest="wan"})
if value == "yes" then
if value == "1" then
uci:section("firewall", "forwarding", nil, {src="freifunk", dest="wan"})
end
uci:save("firewall")
@ -234,6 +254,9 @@ function client.write(self, section, value)
if not inet or not isubnet or not inode then
return
end
local community = inet
local external = community and uci:get("freifunk", community, "external") or ""
inet = uci:get("freifunk", community, "prefix") or inet
local dhcpbeg = 48 + tonumber(inode) * 4
local dclient = "%s.%s.%s" % {inet:gsub("^[0-9]+", "10"), isubnet, dhcpbeg}
@ -243,7 +266,8 @@ function client.write(self, section, value)
uci:delete("network", device .. "dhcp")
-- Create alias
local aliasbase = _strip_internals(uci:get_all("freifunk", "alias"))
local aliasbase = uci:get_all("freifunk", "alias")
util.update(aliasbase, uci:get_all(external, "alias") or {})
aliasbase.interface = device
aliasbase.ipaddr = dclient
aliasbase.proto = "static"
@ -252,7 +276,8 @@ function client.write(self, section, value)
-- Create dhcp
local dhcpbase = _strip_internals(uci:get_all("freifunk", "dhcp"))
local dhcpbase = uci:get_all("freifunk", "dhcp")
util.update(dhcpbase, uci:get_all(external, "dhcp") or {})
dhcpbase.interface = device .. "dhcp"
dhcpbase.start = dhcpbeg
dhcpbase.limit = limit
@ -260,6 +285,32 @@ function client.write(self, section, value)
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"
})
uci:delete_all("firewall", "rule", {
src="freifunk",
proto="tcp",
dest_port="8082",
})
uci:section("firewall", "rule", nil, {
src="freifunk",
proto="tcp",
dest_port="8082",
target="ACCEPT"
})
-- Delete old splash
uci:delete_all("luci_splash", "iface", {net=device, zone="freifunk"})

View file

@ -56,7 +56,7 @@ function network_remove_interface(iface)
end)
-- Remove OLSR sections
cursor:delete_all("olsr", "Interface", {Interface=iface})
cursor:delete_all("olsrd", "Interface", {Interface=iface})
-- Remove Splash sections
cursor:delete_all("luci-splash", "iface", {network=iface})
@ -88,7 +88,8 @@ function firewall_zone_add_interface(name, interface)
local cursor = uci.cursor()
local zone = firewall_find_zone(name)
local net = cursor:get("firewall", zone, "network")
cursor:set("firewall", zone, "network", (net or name .. " ") .. interface)
local old = net or (cursor:get("network", name) and name)
cursor:set("firewall", zone, "network", (old and old .. " " or "") .. interface)
cursor:save("firewall")
end

View file

@ -181,9 +181,16 @@ function fetch_txtinfo(otable)
otable = otable or ""
local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
if #rawdata == 0 then
if luci.fs.access("/proc/net/ipv6_route", "r") then
rawdata = luci.sys.httpget("http://[::1]:2006/"..otable)
if #rawdata == 0 then
return nil
end
else
return nil
end
end
local data = {}

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
<i18n:msg xml:id="polipo">Polipo</i18n:msg>
<i18n:msg xml:id="polipo_cache">On-Disk Cache</i18n:msg>
<i18n:msg xml:id="polipo_cache_cacheisshared">Shared cache</i18n:msg>
<i18n:msg xml:id="polipo_cache_cacheisshared_desc">Enable if cache (proxy) is shared by multiple users.</i18n:msg>
<i18n:msg xml:id="polipo_cache_desc">To enable polipo on-disk cache cleaning (highly recommended), you should add a cron job in Scheduled Tasks services that will execute /usr/sbin/polipo_purge script. For example to perform disk cache cleanup every day at 6:00 in the morning you should add the following line in Scheduled Tasks "0 6 * * * /usr/sbin/polipo_purge" (without quotes).</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcacheroot">Disk cache location</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcacheroot_desc">Location where polipo will cache files permanently. Use of external storage devices is recommended, because the cache can grow considerably. Leave it empty to disable on-disk cache.</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcachetruncatesize">Truncate cache files size (in bytes)</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcachetruncatesize_desc">Size to which cached files should be truncated. (default value: 1048576)</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcachetruncatetime">Truncate cache files time</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcachetruncatetime_desc">Time after which cached files will be truncated. (default value: 4d12h)</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcacheunlinktime">Delete cache files time</i18n:msg>
<i18n:msg xml:id="polipo_cache_diskcacheunlinktime_desc">Time after which cached files will be deleted. (default value: 32d)</i18n:msg>
<i18n:msg xml:id="polipo_desc">Polipo is a small and fast caching web proxy.</i18n:msg>
<i18n:msg xml:id="polipo_general">General</i18n:msg>
<i18n:msg xml:id="polipo_general_allowedclients">Allowed clients</i18n:msg>
<i18n:msg xml:id="polipo_general_allowedclients_desc">When listen address is set to 0.0.0.0 or :: (IPv6), you must list clients that are allowed to connect. The format is IP address or network address (192.168.1.123, 192.168.1.0/24, 2001:660:116::/48 (IPv6)).</i18n:msg>
<i18n:msg xml:id="polipo_general_chunkhighmark">In RAM cache size (in bytes)</i18n:msg>
<i18n:msg xml:id="polipo_general_chunkhighmark_desc">How much RAM should Polipo use for its cache.</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsnameserver">DNS server address</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsnameserver_desc">Set the DNS server address to use, if you want Polipo to use different DNS server than the host system.</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsqueryipv6">Query DNS for IPv6</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsqueryipv6_desc">false = Do not query IPv6; reluctantly = Query both, prefer IPv4; happily = Query both, prefer IPv6; true = Query only IPv6</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsusegethostbyname">Query DNS by hostname</i18n:msg>
<i18n:msg xml:id="polipo_general_dnsusegethostbyname_desc">false = Never use system DNS resolver; reluctantly = Query DNS directly, if DNS server is unavailable fail to system DNS resolver; happily = Query DNS directly, if host could not be found fallback to system DNS resolver; true = Always use system DNS resolver</i18n:msg>
<i18n:msg xml:id="polipo_general_logfacility">Syslog facility</i18n:msg>
<i18n:msg xml:id="polipo_general_logfile">Log file location</i18n:msg>
<i18n:msg xml:id="polipo_general_logfile_desc">Use of external storage device is recommended, because the log file is written frequently and can grow considerably.</i18n:msg>
<i18n:msg xml:id="polipo_general_logsyslog">Log to syslog</i18n:msg>
<i18n:msg xml:id="polipo_general_parentauthcredentials">Parent proxy authentication</i18n:msg>
<i18n:msg xml:id="polipo_general_parentauthcredentials_desc">Basic HTTP authentication supported. Provide username and password in username:password format.</i18n:msg>
<i18n:msg xml:id="polipo_general_parentproxy">Parent proxy address</i18n:msg>
<i18n:msg xml:id="polipo_general_parentproxy_desc">Parent proxy address (in host:port format), to which Polipo will forward the requests.</i18n:msg>
<i18n:msg xml:id="polipo_general_proxyaddress">Listen address</i18n:msg>
<i18n:msg xml:id="polipo_general_proxyaddress_desc">The interface on which Polipo will listen. To listen on all interfaces use 0.0.0.0 or :: (IPv6).</i18n:msg>
<i18n:msg xml:id="polipo_general_proxyport">Listen port</i18n:msg>
<i18n:msg xml:id="polipo_general_proxyport_desc">Port on which Polipo will listen. (default value: 8123)</i18n:msg>
<i18n:msg xml:id="polipo_pmm">Poor Man's Multiplexing</i18n:msg>
<i18n:msg xml:id="polipo_pmm_desc">Poor Man's Multiplexing (PMM) is a technique that simulates multiplexing by requesting an instance in multiple segments. It tries to lower the latency caused by the weakness of HTTP protocol. NOTE: some sites may not work with PMM enabled.</i18n:msg>
<i18n:msg xml:id="polipo_pmm_pmmfirstsize">First PMM segment size (in bytes)</i18n:msg>
<i18n:msg xml:id="polipo_pmm_pmmfirstsize_desc">Size of the first PMM segment. If not defined, it defaults to twice the PMM segment size.</i18n:msg>
<i18n:msg xml:id="polipo_pmm_pmmsize">PMM segments size (in bytes)</i18n:msg>
<i18n:msg xml:id="polipo_pmm_pmmsize_desc">To enable PMM, PMM segment size must be set to some positive value.</i18n:msg>
</i18n:msgs>

View file

@ -0,0 +1,17 @@
qos = 'Qualité de service'
qos_bulk = 'lent'
qos_classify = 'Priorité'
qos_classify_dsthost = 'Adresse de destination'
qos_classify_dsthost_dest = 'Réseau de destination / Hôte de destination'
qos_classify_portrange = 'ports'
qos_classify_srchost = 'Adresse source'
qos_classify_srchost_dest = 'Réseau source / Hôte source'
qos_classify_target = 'Priorité'
qos_desc = 'Avec la QOS, vous pouvez donner des priorités au trafic de votre réseau en fonction des adresses, des ports ou des services présents.'
qos_express = 'express'
qos_interface_classgroup = 'Classification'
qos_interface_download = 'Liaison descendante'
qos_interface_overhead = 'calcul de la surcharge'
qos_interface_upload = 'Liaison montante'
qos_normal = 'normal'
qos_priority = 'prioritaire'

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
<i18n:msg xml:id="qos">Qualité de service</i18n:msg>
<i18n:msg xml:id="qos_bulk">lent</i18n:msg>
<i18n:msg xml:id="qos_classify">Priorité</i18n:msg>
<i18n:msg xml:id="qos_classify_dsthost">Adresse de destination</i18n:msg>
<i18n:msg xml:id="qos_classify_dsthost_dest">Réseau de destination / Hôte de destination</i18n:msg>
<i18n:msg xml:id="qos_classify_portrange">ports</i18n:msg>
<i18n:msg xml:id="qos_classify_srchost">Adresse source</i18n:msg>
<i18n:msg xml:id="qos_classify_srchost_dest">Réseau source / Hôte source</i18n:msg>
<i18n:msg xml:id="qos_classify_target">Priorité</i18n:msg>
<i18n:msg xml:id="qos_desc">Avec la QOS, vous pouvez donner des priorités au trafic de votre réseau en fonction des adresses, des ports ou des services présents.</i18n:msg>
<i18n:msg xml:id="qos_express">express</i18n:msg>
<i18n:msg xml:id="qos_interface_classgroup">Classification</i18n:msg>
<i18n:msg xml:id="qos_interface_download">Liaison descendante</i18n:msg>
<i18n:msg xml:id="qos_interface_overhead">calcul de la surcharge</i18n:msg>
<i18n:msg xml:id="qos_interface_upload">Liaison montante</i18n:msg>
<i18n:msg xml:id="qos_normal">normal</i18n:msg>
<i18n:msg xml:id="qos_priority">prioritaire</i18n:msg>
</i18n:msgs>

View file

@ -0,0 +1,34 @@
tinyproxy = 'Tinyproxy'
tinyproxy_desc = 'Tinyproxy is a small and fast non-caching HTTP(S)-Proxy'
tinyproxy_tinyproxy_allow = 'Allow access from'
tinyproxy_tinyproxy_anonymous = 'Allowed headers for anonymous proxy'
tinyproxy_tinyproxy_bind = 'Lier le trafic sortant à l&#39;adresse ip'
tinyproxy_tinyproxy_connectport = 'Ports allowed for CONNECT method'
tinyproxy_tinyproxy_connectport_desc = '0 = disabled, empty = all'
tinyproxy_tinyproxy_defaulterrorfile = 'Fichier d&#39;erreur'
tinyproxy_tinyproxy_filter = 'Liste de filtres'
tinyproxy_tinyproxy_filtercasesensitive = 'Case sensitive filters'
tinyproxy_tinyproxy_filterdefaultdeny = 'Filter list is a whitelist'
tinyproxy_tinyproxy_filterextended = 'Extended regular expression filters'
tinyproxy_tinyproxy_filterurls = 'Filter URLs instead of domains'
tinyproxy_tinyproxy_group = 'Groupe'
tinyproxy_tinyproxy_listen = 'Listen on address'
tinyproxy_tinyproxy_logfile = 'Chemin du fichier de log'
tinyproxy_tinyproxy_loglevel = 'Niveau de log'
tinyproxy_tinyproxy_maxclients = 'Nombre maximum de clients'
tinyproxy_tinyproxy_maxrequestsperchild = 'Maximum de connexion par processus'
tinyproxy_tinyproxy_maxspareservers = 'Nombre Maximum de processus serveur'
tinyproxy_tinyproxy_minspareservers = 'Nombre Minimum de processus serveur'
tinyproxy_tinyproxy_startservers = 'Nombre de processus serveur lancés au demarrage'
tinyproxy_tinyproxy_statfile = 'Fichier de statistiques'
tinyproxy_tinyproxy_syslog = 'Écrire dans le journal système (Syslog)'
tinyproxy_tinyproxy_timeout = 'Délai de connexion'
tinyproxy_tinyproxy_user = 'Utilisateur'
tinyproxy_tinyproxy_viaproxyname = 'Valeur de l&#39;entête &quot;VIA&quot; utilisée comme nom d&#39;hôte'
tinyproxy_tinyproxy_xtinyproxy = 'Inclure l&#39;ip du client'
tinyproxy_type_proxy = 'Via proxy'
tinyproxy_type_reject = 'Refuser l&#39;accès'
tinyproxy_upstream = 'Upstream Control'
tinyproxy_upstream_target = 'Hôte de destination'
tinyproxy_upstream_type = 'Type'
tinyproxy_upstream_via = 'Proxy'

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
<i18n:msg xml:id="tinyproxy">Tinyproxy</i18n:msg>
<i18n:msg xml:id="tinyproxy_desc">Tinyproxy is a small and fast non-caching HTTP(S)-Proxy</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_allow">Allow access from</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_anonymous">Allowed headers for anonymous proxy</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_bind">Lier le trafic sortant à l'adresse ip</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_connectport">Ports allowed for CONNECT method</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_connectport_desc">0 = disabled, empty = all</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_defaulterrorfile">Fichier d'erreur</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_filter">Liste de filtres</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_filtercasesensitive">Case sensitive filters</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_filterdefaultdeny">Filter list is a whitelist</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_filterextended">Extended regular expression filters</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_filterurls">Filter URLs instead of domains</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_group">Groupe</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_listen">Listen on address</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_logfile">Chemin du fichier de log</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_loglevel">Niveau de log</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_maxclients">Nombre maximum de clients</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_maxrequestsperchild">Maximum de connexion par processus</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_maxspareservers">Nombre Maximum de processus serveur</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_minspareservers">Nombre Minimum de processus serveur</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_startservers">Nombre de processus serveur lancés au demarrage</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_statfile">Fichier de statistiques</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_syslog">Écrire dans le journal système (Syslog)</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_timeout">Délai de connexion</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_user">Utilisateur</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_viaproxyname">Valeur de l'entête "VIA" utilisée comme nom d'hôte</i18n:msg>
<i18n:msg xml:id="tinyproxy_tinyproxy_xtinyproxy">Inclure l'ip du client</i18n:msg>
<i18n:msg xml:id="tinyproxy_type_proxy">Via proxy</i18n:msg>
<i18n:msg xml:id="tinyproxy_type_reject">Refuser l'accès</i18n:msg>
<i18n:msg xml:id="tinyproxy_upstream">Upstream Control</i18n:msg>
<i18n:msg xml:id="tinyproxy_upstream_target">Hôte de destination</i18n:msg>
<i18n:msg xml:id="tinyproxy_upstream_type">Type</i18n:msg>
<i18n:msg xml:id="tinyproxy_upstream_via">Proxy</i18n:msg>
</i18n:msgs>

View file

@ -0,0 +1,5 @@
framespersecond = 'Images par seconde'
resolution = 'Résolution'
settings = 'Paramètres'
uvc_streamer = 'Webcam streaming'
uvc_streamer_desc = 'Configurez le pilote linux UVC-webcam pour votre webcam. Pointez votre navigateur par exemple sur<a href="http://%s:%i/">http://%s:%i/</a>'

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
<i18n:msg xml:id="framespersecond">Images par seconde</i18n:msg>
<i18n:msg xml:id="resolution">Résolution</i18n:msg>
<i18n:msg xml:id="settings">Paramètres</i18n:msg>
<i18n:msg xml:id="uvc_streamer">Webcam streaming</i18n:msg>
<i18n:msg xml:id="uvc_streamer_desc">Configurez le pilote linux UVC-webcam pour votre webcam. Pointez votre navigateur par exemple sur<a href="http://%s:%i/">http://%s:%i/</a></i18n:msg>
</i18n:msgs>

View file

@ -11,7 +11,7 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: index.lua 3548 2008-10-09 20:28:07Z Cyrus $
$Id$
]]--
local cbi = require "luci.cbi"
@ -31,6 +31,15 @@ if arg[2] then
i18n.load(arg[2], "en")
end
if arg[3] then
pcall(function()
require "uci"
require "luci.model.uci".cursor = function(config, save)
return uci.cursor(config or arg[3] .. "/etc/config", save or arg[3] .. "/tmp/.uci")
end
end)
end
local map = cbi.load(arg[1])[1]
assert(map)
@ -45,7 +54,7 @@ if #map.description > 0 then
print (" option description '%s'" % util.striptags(map.description))
end
for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.TypedSection) then
for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.AbstractSection) then
print ("\nconfig section")
print (" option name '%s'" % sec.sectiontype)
print (" option package '%s'" % map.config)

View file

@ -3,4 +3,5 @@ export LD_LIBRARY_PATH="$1/usr/lib:$LD_LIBRARY_PATH"
export PATH="$1/bin:$1/usr/bin:$PATH"
export LUA_PATH="$1/$2/?.lua;$1/$2/?/init.lua;;"
export LUA_CPATH="$1/$3/?.so;;"
export LUCI_SYSROOT="$1"
$4

88
build/uvl2cbi.lua Normal file
View file

@ -0,0 +1,88 @@
#!/usr/bin/lua
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local uvl = require "luci.uvl"
local util = require "luci.util"
if not arg[1] then
util.perror("Usage %s scheme_name" % arg[0])
os.exit(1)
end
local scheme, error = uvl.UVL():get_scheme(arg[1])
if not scheme then
print( error:string() )
os.exit(1)
end
print('cbimap = Map(%q, %q, %q)\n'
% { scheme.name, scheme.title or scheme.name, scheme.description or "" } )
for sn, sv in util.kspairs(scheme.sections) do
print('%s = cbimap:section(TypedSection, %q, %q, %q)'
% { sn, sn, sv.title or "", sv.description or "" } )
if not sv.named then print('%s.anonymous = true' % sn) end
if not sv.unique then print('%s.addremove = true' % sn) end
if sv.dynamic then print('%s.dynamic = true' % sn) end
if sv.depends then
for _, dep in ipairs(sv.depends) do
print('%s:depends(%s)' % { sn, util.serialize_data(dep) } )
end
end
print('')
for vn, vv in util.kspairs(scheme.variables[sn]) do
if not vv.type or vv.type == "variable" then
print('%s = %s:option(%s, %q, %q, %q)'
% { vn, sn, vv.datatype == "boolean" and "Flag" or "Value",
vn, vv.title or "", vv.description or "" } )
elseif vv.type == "enum" then
print('%s = %s:option(%s, %q, %q, %q)'
% { vn, sn, vv.multival and "MultiValue" or "ListValue",
vn, vv.title or "", vv.description or "" } )
for _, val in ipairs(vv.valuelist or {}) do
print('%s:value(%q, %q)'
% { vn, val.value, val.title or val.value } )
end
elseif vv.type == "list" or vv.type == "lazylist" then
print('%s = %s:option(DynamicList, %q, %q, %q)'
% { vn, sn, vn, vv.title or "", vv.description or "" } )
else
print('-- option: type(%s) ?' % { vv.type or "" } )
end
if vv.default then print('%s.default = %q' % { vn, vv.default } ) end
if vv.required then print('%s.optional = false' % vn ) end
if not vv.required then print('%s.rmempty = true' % vn ) end
for _, dep in ipairs(vv.depends or {}) do
print('%s:depends(%s)' % { vn, util.serialize_data(dep) } )
end
print('')
end
print('\nreturn cbimap')
end

33
build/uvl2i18n.lua Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/lua
-- uvl2i18n.lua - Convert uvl schemes to i18n files
-- $Id$
require("luci.util")
require("luci.uvl")
local shm = luci.uvl.UVL():get_scheme(arg[1])
for s, o in luci.util.kspairs(shm.sections) do
print( string.format( '%s_%s = %q', shm.name, s:gsub("_",""), o.title or s ) )
if o.description and #o.description > 0 then
print( string.format(
'%s_%s_desc = %q', shm.name, s:gsub("_",""), o.description
) )
end
for v, o in luci.util.kspairs(shm.variables[s]) do
print( string.format(
'%s_%s_%s = %q', shm.name, s:gsub("_",""), v:gsub("_",""), o.title or v
) )
if o.description and #o.description > 0 then
print( string.format(
'%s_%s_%s_desc = %q', shm.name, s:gsub("_",""),
v:gsub("_",""), o.description
) )
end
end
print()
end

24
build/uvldoc Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env lua
local fs = require "luci.fs"
local util = require "luci.util"
local uvldoc = require "luci.uvldoc.renderer"
pcall(function()
require "uci"
require "luci.model.uci".cursor = function(config, save)
return uci.cursor(config or arg[1] .. "/etc/config", save or arg[1] .. "/tmp/.uci")
end
end)
local schemes = {}
if not arg[4] or #arg[4] == 0 then
for i, name in ipairs(fs.dir(arg[2].."/default/")) do
if name ~= "." and name ~= ".." then
schemes[#schemes+1] = name
end
end
else
schemes = util.split(arg[4], "[,;%s]+", nil, true)
end
uvldoc.Generator(schemes, arg[3], arg[2]):make()

View file

@ -65,4 +65,74 @@ foreach my $zone ( sort keys %TZ ) {
printf "\t{ '%s', '%s' },\n", $zone, $TZ{$zone}
}
print <<HEAD;
}
OFFSET = {
HEAD
my %seen;
foreach my $tz ( sort keys %TZ ) {
my $zone = $TZ{$tz};
if( $zone =~ /^
([A-Z]+)
(?:
( -? \d+ (?: : \d+ )? )
(?:
([A-Z]+)
( -? \d+ (?: : \d+ )? )?
)?
)?
\b /xo ) {
my ( $offset, $s, $h, $m ) = ( 0, 1, 0, 0 );
my ( $std, $soffset, $dst, $doffset ) = ( $1, $2, $3, $4 );
next if $seen{$std}; # and ( !$dst or $seen{$dst} );
if ( $soffset ) {
( $s, $h, $m ) = $soffset =~ /^(-)?(\d+)(?::(\d+))?$/;
$s = $s ? 1 : -1;
$h ||= 0;
$m ||= 0;
$offset = $s * $h * 60 * 60;
$offset += $s * $m * 60;
printf("\t%-5s = %6d,\t-- %s\n",
lc($std), $offset, $std);
$seen{$std} = 1;
if( $dst ) {
if( $doffset ) {
( $s, $h, $m ) = $doffset =~ /^(-)?(\d+)(?::(\d+))?$/;
$s = $s ? 1 : -1;
$h ||= 0;
$m ||= 0;
$offset = $s * $h * 60 * 60;
$offset += $s * $m * 60;
} else {
$offset += 60 * 60;
}
printf("\t%-5s = %6d,\t-- %s\n",
lc($dst), $offset, $dst);
$seen{$dst} = 1;
}
}
else {
printf("\t%-5s = %6d,\t-- %s\n",
lc($std), $offset, $std);
$seen{$std} = 1;
}
}
}
print "}\n";

View file

@ -20,7 +20,9 @@ $(BITLIB_DIR)/.prepared: $(BITLIB_FILE)
test -f $(BITLIB_DIR)/config.h || cp $(BITLIB_DIR)/config.h.in $(BITLIB_DIR)/config.h
touch $@
compile: $(BITLIB_DIR)/.prepared
compile: $(BITLIB_DIR)/.prepared dist$(LUA_LIBRARYDIR)/bit.so
dist$(LUA_LIBRARYDIR)/bit.so:
mkdir -p dist$(LUA_LIBRARYDIR)
$(COMPILE) -DHAVE_CONFIG_H -I$(BITLIB_DIR) -O2 -c $(BITLIB_DIR)/lbitlib.c $(FPIC) $(LUA_CFLAGS) -o $(BITLIB_DIR)/lbitlib.o
$(LINK) $(SHLIB_FLAGS) $(LDFLAGS) $(BITLIB_DIR)/lbitlib.o $(LUA_SHLIBS) -lm -ldl -o dist$(LUA_LIBRARYDIR)/bit.so

View file

@ -2,7 +2,9 @@ include ../../build/module.mk
include ../../build/config.mk
include ../../build/gccconfig.mk
compile:
compile: dist$(LUA_LIBRARYDIR)/curses.so
dist$(LUA_LIBRARYDIR)/curses.so:
mkdir -p dist$(LUA_LIBRARYDIR)
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHLIB_FLAGS) -pedantic \
-Wall $(FPIC) $(LUA_CFLAGS) -o dist$(LUA_LIBRARYDIR)/curses.so src/curses.c src/luacurses.c

View file

@ -2,7 +2,7 @@
-- LuaDoc configuration file. This file contains the default options for
-- luadoc operation. These options can be overriden by the command line tool
-- @see luadoc.print_help
-- @release $Id: config.lua,v 1.6 2007/04/18 14:28:39 tomas Exp $
-- @release $Id$
-------------------------------------------------------------------------------
module "luadoc.config"

View file

@ -1,6 +1,6 @@
-----------------------------------------------------------------
-- LuaDoc debugging facilities.
-- @release $Id: debug.lua,v 1.3 2007/04/18 14:28:39 tomas Exp $
-- @release $Id$
-----------------------------------------------------------------
module "luadoc.doclet.debug"

View file

@ -3,7 +3,7 @@
-- (re)write .lua files adding missing standard tags. Texts are formatted to
-- 80 columns and function parameters are added based on code analysis.
--
-- @release $Id: formatter.lua,v 1.5 2007/04/18 14:28:39 tomas Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local util = require "luadoc.util"

View file

@ -9,7 +9,7 @@
-- sub-template used by the others.</li>
-- </ul>
--
-- @release $Id: html.lua,v 1.29 2007/12/21 17:50:48 tomas Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type = assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------
-- @release $Id: raw.lua,v 1.5 2007/04/18 14:28:39 tomas Exp $
-- @release $Id$
-----------------------------------------------------------------
module "luadoc.doclet.raw"

View file

@ -1,6 +1,6 @@
-------------------------------------------------------------------------------
-- LuaDoc main function.
-- @release $Id: init.lua,v 1.4 2008/02/17 06:42:51 jasonsantos Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local require = require

View file

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- Lua Pages Template Preprocessor.
--
-- @release $Id: lp.lua,v 1.7 2007/04/18 14:28:39 tomas Exp $
-- @release $Id$
----------------------------------------------------------------------------
local assert, error, getfenv, loadstring, setfenv = assert, error, getfenv, loadstring, setfenv

View file

@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
-- @release $Id: standard.lua,v 1.39 2007/12/21 17:50:48 tomas Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local assert, pairs, tostring, type = assert, pairs, tostring, type

View file

@ -1,6 +1,6 @@
-------------------------------------------------------------------------------
-- Handlers for several tags
-- @release $Id: tags.lua,v 1.8 2007/09/05 12:39:09 tomas Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local luadoc = require "luadoc"

View file

@ -1,6 +1,6 @@
-------------------------------------------------------------------------------
-- General utilities.
-- @release $Id: util.lua,v 1.16 2008/02/17 06:42:51 jasonsantos Exp $
-- @release $Id$
-------------------------------------------------------------------------------
local posix = require "posix"

View file

@ -1,6 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_BRANCH:=branches/luci-0.8
PKG_BRANCH:=trunk
ifeq ($(DUMP),)
USELOCAL:=$(shell grep luci ../../../.project 2>/dev/null >/dev/null && echo 1)
@ -10,12 +10,12 @@ PKG_NAME:=luci
PKG_RELEASE:=1
ifeq ($(USELOCAL),1)
PKG_VERSION:=0.8+svn
PKG_VERSION:=0.9+svn
else
PKG_SOURCE_URL:=http://svn.luci.subsignal.org/luci/$(PKG_BRANCH)
ifeq ($(DUMP),)
PKG_REV:=HEAD
PKG_VERSION:=0.8.2
PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p')
PKG_VERSION:=0.9+svn$(PKG_REV)
endif
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
@ -59,6 +59,18 @@ define Package/luci/libtemplate
DEPENDS:=+luci-core
endef
define Package/luci/fftemplate
$(call Package/luci/libtemplate)
SUBMENU:=LuCI Freifunk Support
DEPENDS:=+luci-mod-freifunk
endef
define Package/luci/httpdtemplate
$(call Package/luci/libtemplate)
SUBMENU:=LuCIttpd
DEPENDS:=+luci-httpd
endef
define Package/luci/i18ntemplate
$(call Package/luci/libtemplate)
SUBMENU:=LuCI Translations
@ -221,6 +233,39 @@ define Package/luci-uvl/install
endef
### HTTPD ###
define Package/luci-httpd
$(call Package/luci/httpdtemplate)
DEPENDS:=+luci-http +libuci
TITLE:=Server Core
endef
define Package/luci-httpd/install
$(call Package/luci/install/template,$(1),libs/lucittpd)
endef
### Community Packages ###
define Package/luci-freifunk-community
$(call Package/luci/fftemplate)
DEPENDS+= \
+luci-sgi-cgi +luci-app-splash +luci-app-olsr \
+luci-app-ffwizard-leipzig \
+luci-theme-fledermaus \
+luci-i18n-german \
+olsrd-luci +olsrd-luci-mod-dyn-gw +olsrd-luci-mod-txtinfo +olsrd-luci-mod-nameservice \
+kmod-tun +ip
TITLE:=Freifunk Community Meta-Package
endef
define Package/luci-freifunk-community/install
$(call Package/luci/install/template,$(1),applications/freifunk-community)
endef
### Modules ###
define Package/luci-admin-core
@ -272,8 +317,45 @@ define Package/luci-admin-rpc/install
endef
define Package/luci-mod-freifunk
$(call Package/luci/fftemplate)
DEPENDS:=+luci-admin-full
TITLE:=LuCI Freifunk module
endef
define Package/luci-mod-freifunk/conffiles
/etc/config/freifunk
endef
define Package/luci-mod-freifunk/install
$(call Package/luci/install/template,$(1),modules/freifunk)
endef
### Applications ###
define Package/luci-app-ffwizard-leipzig
$(call Package/luci/fftemplate)
TITLE:=Freifunk Leipzig configuration wizard
endef
define Package/luci-app-ffwizard-leipzig/install
$(call Package/luci/install/template,$(1),applications/luci-ffwizard-leipzig)
endef
define Package/luci-app-siitwizard
$(call Package/luci/fftemplate)
TITLE:=SIIT IPv4-over-IPv6 configuration wizard
DEPENDS:=+luci-admin-core +kmod-siit
endef
define Package/luci-app-siitwizard/install
$(call Package/luci/install/template,$(1),applications/luci-siitwizard)
endef
define Package/luci-app-firewall
$(call Package/luci/webtemplate)
DEPENDS+=+luci-admin-core
@ -307,6 +389,21 @@ define Package/luci-app-qos/install
endef
define Package/luci-app-splash
$(call Package/luci/fftemplate)
DEPENDS+=+luasocket
TITLE:=Freifunk DHCP-Splash application
endef
define Package/luci-app-splash/conffiles
/etc/config/luci_splash
endef
define Package/luci-app-splash/install
$(call Package/luci/install/template,$(1),applications/luci-splash)
endef
define Package/luci-app-statistics
$(call Package/luci/webtemplate)
DEPENDS+=+luci-admin-full +collectd +collectd-mod-rrdtool1 +rrdtool1
@ -377,6 +474,17 @@ define Package/luci-app-uvc_streamer/install
endef
define Package/luci-app-mmc_over_gpio
$(call Package/luci/webtemplate)
DEPENDS+=+luci-admin-full +kmod-mmc-over-gpio
TITLE:=mmc_over_gpio
endef
define Package/luci-app-mmc_over_gpio/install
$(call Package/luci/install/template,$(1),applications/luci-mmc_over_gpio)
endef
define Package/luci-app-p910nd
$(call Package/luci/webtemplate)
DEPENDS+=+luci-admin-full +p910nd
@ -438,6 +546,16 @@ define Package/luci-app-livestats/install
$(call Package/luci/install/template,$(1),applications/luci-livestats)
endef
define Package/luci-app-asterisk
$(call Package/luci/webtemplate)
TITLE:=LuCI Support for Asterisk PBX
DEPENDS+=@BROKEN +luci-admin-core +asterisk14
endef
define Package/luci-app-asterisk/install
$(call Package/luci/install/template,$(1),applications/luci-asterisk)
endef
define Package/luci-app-polipo
$(call Package/luci/webtemplate)
TITLE:=LuCI Support for the Polipo Proxy
@ -448,6 +566,16 @@ define Package/luci-app-polipo/install
$(call Package/luci/install/template,$(1),applications/luci-polipo)
endef
define Package/luci-app-openvpn
$(call Package/luci/webtemplate)
TITLE:=LuCI Support for OpenVPN
DEPENDS+=@BROKEN +luci-admin-core +openvpn
endef
define Package/luci-app-openvpn/install
$(call Package/luci/install/template,$(1),applications/luci-openvpn)
endef
### Server Gateway Interfaces ###
@ -460,6 +588,24 @@ define Package/luci-sgi-cgi/install
$(call Package/luci/install/template,$(1),libs/sgi-cgi)
endef
define Package/luci-sgi-luci
$(call Package/luci/libtemplate)
DEPENDS+=+luci-httpd
TITLE:=SGI for LuCIttpd
endef
define Package/luci-sgi-luci/install
$(call Package/luci/install/template,$(1),libs/sgi-luci)
endef
define Package/luci-sgi-webuci
$(call Package/luci/libtemplate)
TITLE:=SGI for Webuci
endef
define Package/luci-sgi-webuci/install
$(call Package/luci/install/template,$(1),libs/sgi-webuci)
endef
### Themes ###
define Package/luci-theme-base
@ -472,6 +618,38 @@ define Package/luci-theme-base/install
$(call Package/luci/install/template,$(1),themes/base)
endef
define Package/luci-theme-fledermaus
$(call Package/luci/fftemplate)
DEPENDS:=+luci-web
TITLE:=Fledermaus Theme
endef
define Package/luci-theme-fledermaus/install
$(call Package/luci/install/template,$(1),themes/fledermaus)
endef
define Package/luci-theme-freifunk
$(call Package/luci/thtemplate)
DEPENDS:=+luci-web
MAINTAINER:=Stefan Pirwitz <stefan-at-freifunk-bno-dot-de>
TITLE:=alternative Freifunk Theme
endef
define Package/luci-theme-freifunk/install
$(call Package/luci/install/template,$(1),themes/freifunk)
endef
define Package/luci-theme-freifunk-bno
$(call Package/luci/thtemplate)
DEPENDS:=+luci-web
MAINTAINER:=Stefan Pirwitz <stefan-at-freifunk-bno-dot-de>
TITLE:=Freifunk Berlin Nordost Theme
endef
define Package/luci-theme-freifunk-bno/install
$(call Package/luci/install/template,$(1),themes/freifunk-bno)
endef
define Package/luci-theme-openwrt
$(call Package/luci/thtemplate)
TITLE:=OpenWrt.org (default)
@ -554,7 +732,6 @@ define Package/luci-i18n-portuguese_brazilian/install
endef
### Compile ###
ifneq ($(CONFIG_PACKAGE_luci-core),)
PKG_SELECTED_MODULES+=libs/core
@ -587,6 +764,10 @@ ifneq ($(CONFIG_PACKAGE_luci-uvl),)
PKG_SELECTED_MODULES+=libs/uvl
endif
ifneq ($(CONFIG_PACKAGE_luci-httpd),)
PKG_SELECTED_MODULES+=libs/lucittpd
endif
ifneq ($(CONFIG_PACKAGE_luci-admin-core),)
PKG_SELECTED_MODULES+=modules/admin-core
endif
@ -599,7 +780,20 @@ endif
ifneq ($(CONFIG_PACKAGE_luci-admin-rpc),)
PKG_SELECTED_MODULES+=modules/rpc
endif
ifneq ($(CONFIG_PACKAGE_luci-mod-freifunk),)
PKG_SELECTED_MODULES+=modules/freifunk
endif
ifneq ($(CONFIG_PACKAGE_luci-freifunk-community),)
PKG_SELECTED_MODULES+=applications/freifunk-community
endif
ifneq ($(CONFIG_PACKAGE_luci-app-ffwizard-leipzig),)
PKG_SELECTED_MODULES+=applications/luci-ffwizard-leipzig
endif
ifneq ($(CONFIG_PACKAGE_luci-app-siitwizard),)
PKG_SELECTED_MODULES+=applications/luci-siitwizard
endif
ifneq ($(CONFIG_PACKAGE_luci-app-firewall),)
PKG_SELECTED_MODULES+=applications/luci-fw
endif
@ -609,6 +803,9 @@ endif
ifneq ($(CONFIG_PACKAGE_luci-app-qos),)
PKG_SELECTED_MODULES+=applications/luci-qos
endif
ifneq ($(CONFIG_PACKAGE_luci-app-splash),)
PKG_SELECTED_MODULES+=applications/luci-splash
endif
ifneq ($(CONFIG_PACKAGE_luci-app-statistics),)
PKG_SELECTED_MODULES+=applications/luci-statistics
endif
@ -627,6 +824,9 @@ endif
ifneq ($(CONFIG_PACKAGE_luci-app-uvc_streamer),)
PKG_SELECTED_MODULES+=applications/luci-uvc_streamer
endif
ifneq ($(CONFIG_PACKAGE_luci-app-mmc_over_gpio),)
PKG_SELECTED_MODULES+=applications/luci-mmc_over_gpio
endif
ifneq ($(CONFIG_PACKAGE_luci-app-p910nd),)
PKG_SELECTED_MODULES+=applications/luci-p910nd
endif
@ -645,19 +845,39 @@ endif
ifneq ($(CONFIG_PACKAGE_luci-app-livestats),)
PKG_SELECTED_MODULES+=applications/luci-livestats
endif
ifneq ($(CONFIG_PACKAGE_luci-app-asterisk),)
PKG_SELECTED_MODULES+=applications/luci-asterisk
endif
ifneq ($(CONFIG_PACKAGE_luci-app-polipo),)
PKG_SELECTED_MODULES+=applications/luci-polipo
endif
ifneq ($(CONFIG_PACKAGE_luci-app-openvpn),)
PKG_SELECTED_MODULES+=applications/luci-openvpn
endif
ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),)
PKG_SELECTED_MODULES+=libs/sgi-cgi
endif
ifneq ($(CONFIG_PACKAGE_luci-sgi-luci),)
PKG_SELECTED_MODULES+=libs/sgi-luci
endif
ifneq ($(CONFIG_PACKAGE_luci-sgi-webuci),)
PKG_SELECTED_MODULES+=libs/sgi-webuci
endif
ifneq ($(CONFIG_PACKAGE_luci-theme-base),)
PKG_SELECTED_MODULES+=themes/base
endif
ifneq ($(CONFIG_PACKAGE_luci-theme-fledermaus),)
PKG_SELECTED_MODULES+=themes/fledermaus
endif
ifneq ($(CONFIG_PACKAGE_luci-theme-freifunk-bno),)
PKG_SELECTED_MODULES+=themes/freifunk-bno
endif
ifneq ($(CONFIG_PACKAGE_luci-theme-freifunk),)
PKG_SELECTED_MODULES+=themes/freifunk
endif
ifneq ($(CONFIG_PACKAGE_luci-theme-openwrt),)
PKG_SELECTED_MODULES+=themes/openwrt.org
endif
@ -688,7 +908,7 @@ endif
MAKE_FLAGS += \
MODULES="$(PKG_SELECTED_MODULES)" \
LUA_TARGET="$(LUA_TARGET)" \
LUA_SHLIBS="-llua -lm" \
LUA_SHLIBS="-llua -lm -ldl -lcrypt" \
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
OS="Linux"
@ -705,31 +925,47 @@ $(eval $(call BuildPackage,luci-sys))
$(eval $(call BuildPackage,luci-web))
$(eval $(call BuildPackage,luci-uvl))
$(eval $(call BuildPackage,luci-httpd))
$(eval $(call BuildPackage,luci-admin-core))
$(eval $(call BuildPackage,luci-admin-mini))
$(eval $(call BuildPackage,luci-admin-full))
$(eval $(call BuildPackage,luci-admin-rpc))
$(eval $(call BuildPackage,luci-mod-freifunk))
$(eval $(call BuildPackage,luci-freifunk-community))
$(eval $(call BuildPackage,luci-app-ffwizard-leipzig))
$(eval $(call BuildPackage,luci-app-siitwizard))
$(eval $(call BuildPackage,luci-app-firewall))
$(eval $(call BuildPackage,luci-app-olsr))
$(eval $(call BuildPackage,luci-app-qos))
$(eval $(call BuildPackage,luci-app-splash))
$(eval $(call BuildPackage,luci-app-statistics))
$(eval $(call BuildPackage,luci-app-upnp))
$(eval $(call BuildPackage,luci-app-ntpc))
$(eval $(call BuildPackage,luci-app-ddns))
$(eval $(call BuildPackage,luci-app-samba))
$(eval $(call BuildPackage,luci-app-uvc_streamer))
$(eval $(call BuildPackage,luci-app-mmc_over_gpio))
$(eval $(call BuildPackage,luci-app-p910nd))
$(eval $(call BuildPackage,luci-app-ushare))
$(eval $(call BuildPackage,luci-app-hd_idle))
$(eval $(call BuildPackage,luci-app-tinyproxy))
$(eval $(call BuildPackage,luci-app-initmgr))
$(eval $(call BuildPackage,luci-app-livestats))
$(eval $(call BuildPackage,luci-app-asterisk))
$(eval $(call BuildPackage,luci-app-polipo))
$(eval $(call BuildPackage,luci-app-openvpn))
$(eval $(call BuildPackage,luci-sgi-cgi))
$(eval $(call BuildPackage,luci-sgi-luci))
$(eval $(call BuildPackage,luci-sgi-webuci))
$(eval $(call BuildPackage,luci-theme-base))
$(eval $(call BuildPackage,luci-theme-fledermaus))
$(eval $(call BuildPackage,luci-theme-freifunk))
$(eval $(call BuildPackage,luci-theme-freifunk-bno))
$(eval $(call BuildPackage,luci-theme-openwrt))
$(eval $(call BuildPackage,luci-theme-openwrtlight))

View file

@ -1,12 +1,12 @@
include ../../build/config.mk
include ../../build/gccconfig.mk
UCI_VERSION = 0.6.4
UCI_VERSION = 0.7.0
UCI_SITE = http://mirror2.openwrt.org/sources
UCI_DIR = uci-$(UCI_VERSION)
UCI_FILE = $(UCI_DIR).tar.gz
UCI_URL = $(UCI_SITE)/$(UCI_FILE)
#UCI_GITREV = 43124956bc9c1083e476f6cadaedf27b7788d004
#UCI_GITREV = c79cc497e7b0caa0f9f6a2c978fa9a5f0f097463
#UCI_SITE = http://nbd.name
#UCI_DIR = uci.git
#UCI_FILE = uci-$(UCI_VERSION)$(UCI_APPEND).tar.gz

View file

@ -45,7 +45,7 @@ a_s_packages_do = 'Perform Actions'
a_s_packages_install = 'Install'
a_s_packages_installurl = 'Download and install package'
a_s_packages_ipkg = 'Edit package lists and installation targets'
a_s_packages_name = 'Paketname'
a_s_packages_name = 'Package name'
a_s_packages_remove = 'Remove'
a_s_packages_search = 'Find package'
a_s_packages_update = 'Package lists updated'
@ -96,6 +96,10 @@ a_srv_http_authrealm = 'Authentication Realm'
a_srv_http_authrealm1 = 'The realm which will be displayed at the authentication prompt for protected pages.'
a_srv_http_config1 = 'defaults to <code>/etc/httpd.conf</code>'
a_srv_http_root = 'Document root'
a_srv_http_keepalive = 'Enable Keep-Alive'
a_srv_http_timeout = 'Connection timeout'
a_srv_http_path = 'Plugin path'
a_srv_lucittpd = 'A lightweight HTTP/1.1 webserver written in C and Lua designed to serve LuCI'
a_srv_dropbear1 = 'Dropbear offers <abbr title="Secure Shell">SSH</abbr> network shell access and an integrated <abbr title="Secure Copy">SCP</abbr> server'
a_srv_d_pwauth = 'Password authentication'
a_srv_d_pwauth1 = 'Allow <abbr title="Secure Shell">SSH</abbr> password authentication'

View file

@ -49,7 +49,7 @@
<i18n:msg xml:id="a_s_packages_install">Install</i18n:msg>
<i18n:msg xml:id="a_s_packages_installurl">Download and install package</i18n:msg>
<i18n:msg xml:id="a_s_packages_ipkg">Edit package lists and installation targets</i18n:msg>
<i18n:msg xml:id="a_s_packages_name">Paketname</i18n:msg>
<i18n:msg xml:id="a_s_packages_name">Package name</i18n:msg>
<i18n:msg xml:id="a_s_packages_remove">Remove</i18n:msg>
<i18n:msg xml:id="a_s_packages_search">Find package</i18n:msg>
<i18n:msg xml:id="a_s_packages_update">Package lists updated</i18n:msg>
@ -104,7 +104,7 @@
<i18n:msg xml:id="a_srv_d_pwauth">Password authentication</i18n:msg>
<i18n:msg xml:id="a_srv_d_pwauth1">Allow <abbr title="Secure Shell">SSH</abbr> password authentication</i18n:msg>
<i18n:msg xml:id="a_w_channel">Channel</i18n:msg>
<i18n:msg xml:id="a_w_wifi1">On this pages you find confiugration options for <abbr title="Wireless Local Area Network">WLAN</abbr> based wireless networks.</i18n:msg>
<i18n:msg xml:id="a_w_wifi1">On this pages you can find configuration options for <abbr title="Wireless Local Area Network">WLAN</abbr> based wireless networks.</i18n:msg>
<i18n:msg xml:id="a_w_wifi2">You can easily integrate your 802.11a/b/g/n-devices into your physical network and use the virtual adapter support to build wireless repeaters or offer several networks with one device.</i18n:msg>
<i18n:msg xml:id="a_w_wifi3">There is support for Managed, Client, Ad-Hoc and <abbr title="Wireless Distribution System">WDS</abbr> operating modes as well as <abbr title="Wi-Fi Protected Access">WPA</abbr> and <abbr title="Wi-Fi Protected Access 2">WPA2</abbr> encryption for secure communnication.</i18n:msg>
<i18n:msg xml:id="a_w_devices1">Here you can configure installed wifi devices.</i18n:msg>

View file

@ -94,6 +94,10 @@ a_srv_http_authrealm = 'Anmeldeaufforderung'
a_srv_http_authrealm1 = 'Aufforderungstext zum Anmelden im Administrationsbereich'
a_srv_http_config1 = '/etc/httpd.conf wenn leer'
a_srv_http_root = 'Wurzelverzeichnis'
a_srv_http_keepalive = 'Keep-Alive aktivieren'
a_srv_http_timeout = 'Verbindungszeitlimit'
a_srv_http_path = 'Pluginpfad'
a_srv_lucittpd = 'Ein schlanker HTTP/1.1 webserver in C und Lua geschrieben um LuCI zu betreiben.'
a_srv_services1 = 'Dienste und Dämonen stellen bestimmte Funktionalitäten auf dem Router zur Verfügung.'
a_srv_services2 = 'Es handelt sich hierbei meist um Netzwerkserver, die verschiedene Aufgaben auf dem Router erfüllen, beispielsweise Shell-Zugang ermöglichen oder diese Weboberfläche per HTTP anbieten.'
a_st_i_status1 = 'Hier finden sich Informationen über den aktuellen Status des Systems, beispielsweise Prozessortakt, Speicherauslastung und Netzwerkschnittstellen.'

View file

@ -1,3 +1,18 @@
/*
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
*/
var cbi_d = [];
function cbi_d_add(field, dep, next) {
@ -177,3 +192,24 @@ function cbi_filebrowser(id, url, defpath) {
browser.focus();
}
//Hijacks the CBI form to send via XHR (requires Prototype)
function cbi_hijack_forms(layer, win, fail, load) {
var forms = layer.getElementsByTagName('form');
for (var i=0; i<forms.length; i++) {
$(forms[i]).observe('submit', function(event) {
// Prevent the form from also submitting the regular way
event.stop();
// Submit via XHR
event.element().request({
onSuccess: win,
onFailure: fail
});
if (load) {
load();
}
});
}
}

View file

@ -1095,7 +1095,7 @@ function AbstractValue.__init__(self, map, section, option, ...)
--self.cast = "string"
self.track_missing = false
--self.rmempty = false
self.rmempty = true
self.default = nil
self.size = nil
self.optional = false
@ -1106,9 +1106,6 @@ function AbstractValue.prepare(self)
if not self.override_scheme
and self.map:get_scheme(self.section.sectiontype, self.option) then
local vs = self.map:get_scheme(self.section.sectiontype, self.option)
if self.rmempty == nil then
self.rmempty = not vs.required
end
if self.cast == nil then
self.cast = (vs.type == "list") and "list" or "string"
end

View file

@ -0,0 +1,23 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: browser.htm 3555 2008-10-10 21:52:22Z jow $
-%>
<%
local t = require("luci.tools.webadmin")
local v = self:cfgvalue(section)
-%>
<%+cbi/valueheader%>
<input class="cbi-input-text" type="text"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
<input class="cbi-input-image" type="image" value="<%:cbi_browser%>" onclick="cbi_filebrowser('<%=cbid%>','<%=luci.dispatcher.build_url("admin", "filebrowser")%>'<%=self.default_path and ", '"..self.default_path.."'"%>);return false" alt="<%:cbi_browser%>" title="<%:cbi_browser%>" src="<%=resource%>/cbi/folder.png" style="vertical-align:bottom" />
<%+cbi/valuefooter%>

View file

@ -0,0 +1,122 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: filebrowser.htm 3555 2008-10-10 21:52:22Z jow $
-%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Filebrowser - LuCI</title>
<style type="text/css">
#path, #listing {
font-size: 85%;
}
ul {
padding-left: 0;
list-style-type: none;
}
li img {
vertical-align: bottom;
margin-right: 0.2em;
}
</style>
<script type="text/javascript">
function callback(path) {
if( window.opener ) {
var input = window.opener.document.getElementById('<%=luci.http.formvalue('field')%>');
if( input ) {
input.value = path;
window.close();
}
}
}
</script>
</head>
<body>
<%
require("luci.fs")
require("luci.http")
require("luci.dispatcher")
local field = luci.http.formvalue('field')
local request = luci.dispatcher.context.path
local path = { '' }
for i = 3, #request do
if request[i] ~= '..' and #request[i] > 0 then
path[#path+1] = request[i]
end
end
local filepath = table.concat( path, '/' )
local filestat = luci.fs.stat( filepath )
local baseurl = luci.dispatcher.build_url('admin', 'filebrowser')
if filestat and filestat.type == "regular" then
table.remove( path, #path )
filepath = table.concat( path, '/' ) .. '/'
elseif not ( filestat and filestat.type == "directory" ) then
path = { '' }
filepath = '/'
else
filepath = filepath .. '/'
end
local entries = luci.fs.dir(filepath)
-%>
<div id="path">
Location:
<% for i, dir in ipairs(path) do %>
<% if i == 1 then %>
<a href="<%=baseurl%>?field=<%=field%>">(root)</a>
<% elseif next(path, i) then %>
<% baseurl = baseurl .. '/' .. dir %>
/ <a href="<%=baseurl%>?field=<%=field%>"><%=dir%></a>
<% else %>
<% baseurl = baseurl .. '/' .. dir %>
/ <%=dir%>
<% end %>
<% end %>
</div>
<hr />
<div id="listing">
<ul>
<% for _, e in luci.util.vspairs(entries) do
local stat = luci.fs.stat(filepath..e)
if e ~= '.' and e ~= '..' and stat and stat.type == 'directory' then
-%>
<li class="dir">
<img src="/luci-static/resources/cbi/folder.png" alt="Directory" />
<a href="<%=baseurl%>/<%=e%>?field=<%=field%>"><%=e%>/</a>
</li>
<% end end -%>
<% for _, e in luci.util.vspairs(entries) do
local stat = luci.fs.stat(filepath..e)
if stat and stat.type ~= 'directory' then
-%>
<li class="file">
<img src="/luci-static/resources/cbi/file.png" alt="File" />
<a href="#" onclick="callback('<%=filepath..e%>')"><%=e%></a>
</li>
<% end end -%>
</ul>
</div>
</body>
</html>

View file

@ -12,7 +12,7 @@ You may obtain a copy of the License at
$Id$
-%>
<%- if pageaction then -%>
<div class="cbi-page-actions">
<% if not autoapply then%>
<input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:saveapply%>" />
@ -21,5 +21,6 @@ $Id$
<input class="cbi-button cbi-button-reset" type="reset" value="<%:reset%>" />
<script type="text/javascript">cbi_d_update();</script>
</div>
<%- end -%>
</form>
<%+footer%>

View file

@ -14,7 +14,7 @@ $Id$
-%>
<%+header%>
<form method="post" action="<%=luci.http.getenv("REQUEST_URI")%>" enctype="multipart/form-data">
<form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
<div>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />

View file

@ -13,7 +13,7 @@ $Id$
-%>
<form method="post" action="<%=luci.http.getenv("REQUEST_URI")%>">
<form method="post" action="<%=REQUEST_URI%>">
<div>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />

View file

@ -54,12 +54,19 @@ access = posix.access
glob = posix.glob
--- Checks wheather the given path exists and points to a regular file.
-- @param filename String containing the path of the file to read
-- @param filename String containing the path of the file to test
-- @return Boolean indicating wheather given path points to regular file
function isfile(filename)
return posix.stat(filename, "type") == "regular"
end
--- Checks wheather the given path exists and points to a directory.
-- @param dirname String containing the path of the directory to test
-- @return Boolean indicating wheather given path points to directory
function isdirectory(dirname)
return posix.stat(dirname, "type") == "directory"
end
--- Read the whole content of the given file into memory.
-- @param filename String containing the path of the file to read
-- @return String containing the file contents or nil on error

View file

@ -25,5 +25,5 @@ limitations under the License.
]]--
module "luci"
__version__ = "0.8"
__version__ = "0.9"
__appname__ = "LuCI"

View file

@ -193,14 +193,16 @@ end
--- Create valid XML PCDATA from given string.
-- @param value String value containing the data to escape
-- @return String value containing the escaped data
function pcdata(value)
return value and tostring(value):gsub("[&\"'<>]", {
local _pcdata_repl = {
["&"] = "&#38;",
['"'] = "&#34;",
["'"] = "&#39;",
["<"] = "&#60;",
[">"] = "&#62;"
})
}
function pcdata(value)
return value and tostring(value):gsub("[&\"'<>]", _pcdata_repl)
end
--- Strip HTML tags from given string.

View file

@ -673,6 +673,7 @@ end
-- @class table
statusmsg = {
[200] = "OK",
[206] = "Partial Content",
[301] = "Moved Permanently",
[302] = "Found",
[304] = "Not Modified",
@ -680,8 +681,10 @@ statusmsg = {
[403] = "Forbidden",
[404] = "Not Found",
[405] = "Method Not Allowed",
[408] = "Request Time-out",
[411] = "Length Required",
[412] = "Precondition Failed",
[416] = "Requested range not satisfiable",
[500] = "Internal Server Error",
[503] = "Server Unavailable",
}

View file

@ -17,116 +17,14 @@ $Id$
-- This class contains functions to parse, compare and format http dates.
module("luci.http.protocol.date", package.seeall)
require("luci.sys.zoneinfo")
MONTHS = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
}
--- The "TZ" table contains lowercased timezone names associated with their
-- corresponding time offsets sepcified in seconds.
-- @class table
TZ = {
-- DST zones
["brst"] = -2*3600; -- Brazil Summer Time (East Daylight)
["adt"] = -3*3600; -- Atlantic Daylight
["edt"] = -4*3600; -- Eastern Daylight
["cdt"] = -5*3600; -- Central Daylight
["mdt"] = -6*3600; -- Mountain Daylight
["pdt"] = -7*3600; -- Pacific Daylight
["ydt"] = -8*3600; -- Yukon Daylight
["hdt"] = -9*3600; -- Hawaii Daylight
["bst"] = 1*3600; -- British Summer
["mest"] = 2*3600; -- Middle European Summer
["sst"] = 2*3600; -- Swedish Summer
["fst"] = 2*3600; -- French Summer
["eest"] = 3*3600; -- Eastern European Summer
["cest"] = 2*3600; -- Central European Daylight
["wadt"] = 8*3600; -- West Australian Daylight
["kdt"] = 10*3600; -- Korean Daylight
["eadt"] = 11*3600; -- Eastern Australian Daylight
["nzdt"] = 13*3600; -- New Zealand Daylight
-- zones
["gmt"] = 0; -- Greenwich Mean
["ut"] = 0; -- Universal (Coordinated)
["utc"] = 0;
["wet"] = 0; -- Western European
["wat"] = -1*3600; -- West Africa
["azost"] = -1*3600; -- Azores Standard Time
["cvt"] = -1*3600; -- Cape Verde Time
["at"] = -2*3600; -- Azores
["fnt"] = -2*3600; -- Brazil Time (Extreme East - Fernando Noronha)
["ndt"] = -2*3600+1800;-- Newfoundland Daylight
["art"] = -3*3600; -- Argentina Time
["nft"] = -3*3600+1800;-- Newfoundland
["mnt"] = -4*3600; -- Brazil Time (West Standard - Manaus)
["ewt"] = -4*3600; -- U.S. Eastern War Time
["ast"] = -4*3600; -- Atlantic Standard
["bot"] = -4*3600; -- Bolivia Time
["vet"] = -4*3600; -- Venezuela Time
["est"] = -5*3600; -- Eastern Standard
["cot"] = -5*3600; -- Colombia Time
["act"] = -5*3600; -- Brazil Time (Extreme West - Acre)
["pet"] = -5*3600; -- Peru Time
["cst"] = -6*3600; -- Central Standard
["cest"] = 2*3600; -- Central European Summer
["mst"] = -7*3600; -- Mountain Standard
["pst"] = -8*3600; -- Pacific Standard
["yst"] = -9*3600; -- Yukon Standard
["hst"] = -10*3600; -- Hawaii Standard
["cat"] = -10*3600; -- Central Alaska
["ahst"] = -10*3600; -- Alaska-Hawaii Standard
["taht"] = -10*3600; -- Tahiti Time
["nt"] = -11*3600; -- Nome
["idlw"] = -12*3600; -- International Date Line West
["cet"] = 1*3600; -- Central European
["mez"] = 1*3600; -- Central European (German)
["met"] = 1*3600; -- Middle European
["mewt"] = 1*3600; -- Middle European Winter
["swt"] = 1*3600; -- Swedish Winter
["set"] = 1*3600; -- Seychelles
["fwt"] = 1*3600; -- French Winter
["west"] = 1*3600; -- Western Europe Summer Time
["eet"] = 2*3600; -- Eastern Europe; USSR Zone 1
["ukr"] = 2*3600; -- Ukraine
["sast"] = 2*3600; -- South Africa Standard Time
["bt"] = 3*3600; -- Baghdad; USSR Zone 2
["eat"] = 3*3600; -- East Africa Time
["irst"] = 3*3600+1800;-- Iran Standard Time
["zp4"] = 4*3600; -- USSR Zone 3
["msd"] = 4*3600; -- Moscow Daylight Time
["sct"] = 4*3600; -- Seychelles Time
["zp5"] = 5*3600; -- USSR Zone 4
["azst"] = 5*3600; -- Azerbaijan Summer Time
["mvt"] = 5*3600; -- Maldives Time
["uzt"] = 5*3600; -- Uzbekistan Time
["ist"] = 5*3600+1800;-- Indian Standard
["zp6"] = 6*3600; -- USSR Zone 5
["lkt"] = 6*3600; -- Sri Lanka Time
["pkst"] = 6*3600; -- Pakistan Summer Time
["yekst"] = 6*3600; -- Yekaterinburg Summer Time
["wast"] = 7*3600; -- West Australian Standard
["ict"] = 7*3600; -- Indochina Time
["wit"] = 7*3600; -- Western Indonesia Time
["cct"] = 8*3600; -- China Coast; USSR Zone 7
["wst"] = 8*3600; -- West Australian Standard
["hkt"] = 8*3600; -- Hong Kong
["bnt"] = 8*3600; -- Brunei Darussalam Time
["cit"] = 8*3600; -- Central Indonesia Time
["myt"] = 8*3600; -- Malaysia Time
["pht"] = 8*3600; -- Philippines Time
["sgt"] = 8*3600; -- Singapore Time
["jst"] = 9*3600; -- Japan Standard; USSR Zone 8
["kst"] = 9*3600; -- Korean Standard
["east"] = 10*3600; -- Eastern Australian Standard
["gst"] = 10*3600; -- Guam Standard; USSR Zone 9
["nct"] = 11*3600; -- New Caledonia Time
["nzt"] = 12*3600; -- New Zealand
["nzst"] = 12*3600; -- New Zealand Standard
["fjt"] = 12*3600; -- Fiji Time
["idle"] = 12*3600; -- International Date Line East
}
--- Return the time offset in seconds between the UTC and given time zone.
-- @param tz Symbolic or numeric timezone specifier
-- @return Time offset to UTC in seconds
@ -143,8 +41,8 @@ function tz_offset(tz)
return s * 60 * ( math.floor( v / 100 ) * 60 + ( v % 100 ) )
-- lookup symbolic tz
elseif TZ[tz:lower()] then
return TZ[tz:lower()]
elseif luci.sys.zoneinfo.OFFSET[tz:lower()] then
return luci.sys.zoneinfo.OFFSET[tz:lower()]
end
end

View file

@ -22,6 +22,11 @@ pcall(function()
require "luci.model.uci".cursor = function(config, save)
return uci.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci")
end
local x = require "luci.uvl".UVL.__init__
require "luci.uvl".UVL.__init__ = function(self, schemedir)
x(self, schemedir or SYSROOT .. "/lib/uci/schema")
end
end)
require("luci.sys")

View file

@ -169,6 +169,8 @@ function Server.process( self, client )
break;
end
-- FIXME: Close for POST requests
close = true
else
self:error( thread, 405, luci.http.protocol.statusmsg[405] )
break;

View file

@ -0,0 +1,257 @@
diff -urN boa-0.94.13.orig/src/boa.c boa-0.94.13/src/boa.c
--- boa-0.94.13.orig/src/boa.c 2008-10-28 16:15:45.000000000 +0100
+++ boa-0.94.13/src/boa.c 2008-10-28 15:56:27.000000000 +0100
@@ -27,6 +27,12 @@
#include <sys/resource.h>
/* globals */
+
+#ifdef INET6
+int server_addr_family;
+socklen_t server_addr_len;
+#endif
+
int backlog = SO_MAXCONN;
time_t start_time;
@@ -164,14 +170,36 @@
return 0;
}
+#ifdef INET6
+sa_family_t *get_addr_family(struct sockaddr *address)
+{
+ if(server_addr_family == AF_INET6) {
+ return &(((struct sockaddr_in6 *) address)->sin6_family);
+ }
+
+ return &(((struct sockaddr_in *) address)->sin_family);
+}
+#endif
+
static int create_server_socket(void)
{
int server_s;
- server_s = socket(SERVER_AF, SOCK_STREAM, IPPROTO_TCP);
+#ifdef INET6
+ server_addr_family = AF_INET6;
+ server_addr_len = sizeof(struct sockaddr_in6);
+ server_s = socket(server_addr_family, SOCK_STREAM, IPPROTO_TCP);
if (server_s == -1) {
- DIE("unable to create socket");
+ server_addr_family = AF_INET;
+ server_addr_len = sizeof(struct sockaddr_in);
+#endif
+ server_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (server_s == -1) {
+ DIE("unable to create socket");
+ }
+#ifdef INET6
}
+#endif
/* server socket is nonblocking */
if (set_nonblock_fd(server_s) == -1) {
diff -urN boa-0.94.13.orig/src/boa.h boa-0.94.13/src/boa.h
--- boa-0.94.13.orig/src/boa.h 2008-10-28 16:15:58.000000000 +0100
+++ boa-0.94.13/src/boa.h 2008-10-28 14:45:52.000000000 +0100
@@ -199,4 +199,12 @@
int plugin_handle(request * req);
struct httpd_plugin *plugin_lookup(request *req);
+/* IPv6 */
+
+#ifdef INET6
+extern int server_addr_family;
+extern socklen_t server_addr_len;
+sa_family_t *get_addr_family(struct sockaddr *address);
+#endif
+
#endif
diff -urN boa-0.94.13.orig/src/compat.h boa-0.94.13/src/compat.h
--- boa-0.94.13.orig/src/compat.h 2002-06-06 07:02:28.000000000 +0200
+++ boa-0.94.13/src/compat.h 2008-10-28 15:31:16.000000000 +0100
@@ -71,11 +71,13 @@
#ifdef INET6
#define SOCKADDR sockaddr_storage
-#define S_FAMILY __s_family
-#define SERVER_AF AF_INET6
+#define SOCKADDR_LEN server_addr_len
+#define S_FAMILY(address) (*get_addr_family((struct sockaddr *) (address)))
+#define SERVER_AF server_addr_family
#else
#define SOCKADDR sockaddr_in
-#define S_FAMILY sin_family
+#define SOCKADDR_LEN sizeof(struct sockaddr_in)
+#define S_FAMILY(address) ((*address).sin_family)
#define SERVER_AF AF_INET
#endif
diff -urN boa-0.94.13.orig/src/ip.c boa-0.94.13/src/ip.c
--- boa-0.94.13.orig/src/ip.c 2002-01-21 03:19:16.000000000 +0100
+++ boa-0.94.13/src/ip.c 2008-10-28 15:52:05.000000000 +0100
@@ -44,52 +44,64 @@
#include "boa.h"
#include <arpa/inet.h> /* inet_ntoa */
+#include <netinet/in.h>
/* Binds to the existing server_s, based on the configuration string
in server_ip. IPv6 version doesn't pay attention to server_ip yet. */
int bind_server(int server_s, char *server_ip)
{
+ struct sockaddr *server_sockaddr;
+ struct sockaddr_in server_sockaddr4;
+
#ifdef INET6
- struct sockaddr_in6 server_sockaddr;
- server_sockaddr.sin6_family = AF_INET6;
- memcpy(&server_sockaddr.sin6_addr, &in6addr_any, sizeof (in6addr_any));
- server_sockaddr.sin6_port = htons(server_port);
-#else
- struct sockaddr_in server_sockaddr;
- memset(&server_sockaddr, 0, sizeof server_sockaddr);
+ struct sockaddr_in6 server_sockaddr6;
+ if(SERVER_AF == AF_INET6) {
+ server_sockaddr6.sin6_family = AF_INET6;
+ memcpy(&server_sockaddr6.sin6_addr, &in6addr_any, sizeof (in6addr_any));
+ server_sockaddr6.sin6_port = htons(server_port);
+ server_sockaddr = (struct sockaddr *) &server_sockaddr6;
+ } else {
+#endif
+ memset(&server_sockaddr4, 0, SOCKADDR_LEN);
#ifdef HAVE_SIN_LEN /* uncomment for BSDs */
- server_sockaddr.sin_len = sizeof server_sockaddr;
+ server_sockaddr4.sin_len = SOCKADDR_LEN;
#endif
- server_sockaddr.sin_family = AF_INET;
- if (server_ip != NULL) {
- inet_aton(server_ip, &server_sockaddr.sin_addr);
- } else {
- server_sockaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ server_sockaddr4.sin_family = AF_INET;
+ if (server_ip != NULL) {
+ inet_aton(server_ip, &server_sockaddr4.sin_addr);
+ } else {
+ server_sockaddr4.sin_addr.s_addr = htonl(INADDR_ANY);
+ }
+ server_sockaddr4.sin_port = htons(server_port);
+ server_sockaddr = (struct sockaddr *) &server_sockaddr4;
+#ifdef INET6
}
- server_sockaddr.sin_port = htons(server_port);
#endif
- return bind(server_s, (struct sockaddr *) &server_sockaddr,
- sizeof (server_sockaddr));
+ return bind(server_s, server_sockaddr, SOCKADDR_LEN);
}
char *ascii_sockaddr(struct SOCKADDR *s, char *dest, int len)
{
#ifdef INET6
- if (getnameinfo((struct sockaddr *) s,
- sizeof(struct SOCKADDR),
- dest, len, NULL, 0, NI_NUMERICHOST)) {
- fprintf(stderr, "[IPv6] getnameinfo failed\n");
- *dest = '\0';
- }
+ if(SERVER_AF == AF_INET6) {
+ if (getnameinfo((struct sockaddr *) s,
+ SOCKADDR_LEN,
+ dest, len, NULL, 0, NI_NUMERICHOST)) {
+ fprintf(stderr, "[IPv6] getnameinfo failed\n");
+ *dest = '\0';
+ }
#ifdef WHEN_DOES_THIS_APPLY
- if ((s->__ss_family == AF_INET6) &&
- IN6_IS_ADDR_V4MAPPED(&(((struct sockaddr_in6 *) s)->sin6_addr))) {
- memmove(dest, dest+7, NI_MAXHOST);
- }
+ if (((((struct sockaddr_in6 *) s)->sin6_family) == AF_INET6) &&
+ IN6_IS_ADDR_V4MAPPED(&(((struct sockaddr_in6 *) s)->sin6_addr))) {
+ memmove(dest, dest+7, NI_MAXHOST);
+ }
#endif
-#else
- memmove(dest, inet_ntoa(s->sin_addr), len);
+ } else {
+#endif
+ memmove(dest, inet_ntoa(((struct sockaddr_in *) s)->sin_addr), len);
+#ifdef INET6
+ }
#endif
return dest;
}
@@ -98,17 +110,21 @@
{
int p = -1;
#ifdef INET6
- char serv[NI_MAXSERV];
+ if(SERVER_AF == AF_INET6) {
+ char serv[NI_MAXSERV];
- if (getnameinfo((struct sockaddr *) s,
- sizeof(struct SOCKADDR),
- NULL, 0, serv, sizeof(serv), NI_NUMERICSERV)) {
- fprintf(stderr, "[IPv6] getnameinfo failed\n");
+ if (getnameinfo((struct sockaddr *) s,
+ SOCKADDR_LEN,
+ NULL, 0, serv, sizeof(serv), NI_NUMERICSERV)) {
+ fprintf(stderr, "[IPv6] getnameinfo failed\n");
+ } else {
+ p = atoi(serv);
+ }
} else {
- p = atoi(serv);
+#endif
+ p = ntohs(((struct sockaddr_in *) s)->sin_port);
+#ifdef INET6
}
-#else
- p = ntohs(s->sin_port);
#endif
return p;
}
diff -urN boa-0.94.13.orig/src/mmap_cache.c boa-0.94.13/src/mmap_cache.c
--- boa-0.94.13.orig/src/mmap_cache.c 2002-03-24 23:35:34.000000000 +0100
+++ boa-0.94.13/src/mmap_cache.c 2008-10-28 14:55:16.000000000 +0100
@@ -67,7 +67,7 @@
m = mmap(0, s->st_size, PROT_READ, MAP_OPTIONS, data_fd, 0);
- if ((int) m == -1) {
+ if ((ssize_t) m == -1) {
/* boa_perror(req,"mmap"); */
return NULL;
}
diff -urN boa-0.94.13.orig/src/request.c boa-0.94.13/src/request.c
--- boa-0.94.13.orig/src/request.c 2008-10-28 16:16:03.000000000 +0100
+++ boa-0.94.13/src/request.c 2008-10-28 15:17:20.000000000 +0100
@@ -75,12 +75,12 @@
int fd; /* socket */
struct SOCKADDR remote_addr; /* address */
struct SOCKADDR salocal;
- int remote_addrlen = sizeof (struct SOCKADDR);
+ int remote_addrlen = SOCKADDR_LEN;
request *conn; /* connection */
- size_t len;
+ socklen_t len;
static int system_bufsize = 0; /* Default size of SNDBUF given by system */
- remote_addr.S_FAMILY = 0xdead;
+ S_FAMILY(&remote_addr) = 0xdead;
fd = accept(server_s, (struct sockaddr *) &remote_addr,
&remote_addrlen);
@@ -133,7 +133,7 @@
}
#endif
- len = sizeof(salocal);
+ len = SOCKADDR_LEN;
if (getsockname(fd, (struct sockaddr *) &salocal, &len) != 0) {
WARN("getsockname");

View file

@ -67,17 +67,18 @@ TZ = {
{ 'America/Anguilla', 'AST4' },
{ 'America/Antigua', 'AST4' },
{ 'America/Araguaina', 'BRT3' },
{ 'America/Argentina/Buenos Aires', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Catamarca', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Cordoba', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Jujuy', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/La Rioja', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Mendoza', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Rio Gallegos', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/San Juan', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Buenos Aires', 'ART3ARST,M10.3.0/0,M3.3.0/0' },
{ 'America/Argentina/Catamarca', 'ART3' },
{ 'America/Argentina/Cordoba', 'ART3ARST,M10.3.0/0,M3.3.0/0' },
{ 'America/Argentina/Jujuy', 'ART3' },
{ 'America/Argentina/La Rioja', 'ART3' },
{ 'America/Argentina/Mendoza', 'ART3' },
{ 'America/Argentina/Rio Gallegos', 'ART3' },
{ 'America/Argentina/Salta', 'ART3' },
{ 'America/Argentina/San Juan', 'ART3' },
{ 'America/Argentina/San Luis', 'ART3' },
{ 'America/Argentina/Tucuman', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Ushuaia', 'ART3ARST,M10.1.0/0,M3.3.0/0' },
{ 'America/Argentina/Tucuman', 'ART3ARST,M10.3.0/0,M3.3.0/0' },
{ 'America/Argentina/Ushuaia', 'ART3' },
{ 'America/Aruba', 'AST4' },
{ 'America/Asuncion', 'PYT4PYST,M10.3.0/0,M3.2.0/0' },
{ 'America/Atikokan', 'EST5' },
@ -90,7 +91,7 @@ TZ = {
{ 'America/Bogota', 'COT5' },
{ 'America/Boise', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/Campo Grande', 'AMT4AMST,M10.2.0/0,M2.3.0/0' },
{ 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' },
{ 'America/Cancun', 'CST6CDT,M4.1.0,M10.5.0' },
{ 'America/Caracas', 'VET4:30' },
{ 'America/Cayenne', 'GFT3' },
@ -98,7 +99,7 @@ TZ = {
{ 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' },
{ 'America/Chihuahua', 'MST7MDT,M4.1.0,M10.5.0' },
{ 'America/Costa Rica', 'CST6' },
{ 'America/Cuiaba', 'AMT4AMST,M10.2.0/0,M2.3.0/0' },
{ 'America/Cuiaba', 'AMT4AMST,M10.3.0/0,M2.3.0/0' },
{ 'America/Curacao', 'AST4' },
{ 'America/Danmarkshavn', 'GMT0' },
{ 'America/Dawson', 'PST8PDT,M3.2.0,M11.1.0' },
@ -176,7 +177,7 @@ TZ = {
{ 'America/Rio Branco', 'AMT4' },
{ 'America/Santarem', 'BRT3' },
{ 'America/Santo Domingo', 'AST4' },
{ 'America/Sao Paulo', 'BRT3BRST,M10.2.0/0,M2.3.0/0' },
{ 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' },
{ 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' },
{ 'America/Shiprock', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/St Barthelemy', 'AST4' },
@ -224,12 +225,12 @@ TZ = {
{ 'Asia/Choibalsan', 'CHOT-8' },
{ 'Asia/Chongqing', 'CST-8' },
{ 'Asia/Colombo', 'IST-5:30' },
{ 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J274/0' },
{ 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J305/0' },
{ 'Asia/Dhaka', 'BDT-6' },
{ 'Asia/Dili', 'TLT-9' },
{ 'Asia/Dubai', 'GST-4' },
{ 'Asia/Dushanbe', 'TJT-5' },
{ 'Asia/Gaza', 'EET-2EEST,J91/0,M9.2.4' },
{ 'Asia/Gaza', 'EET-2EEST,J91/0,M8.5.4' },
{ 'Asia/Harbin', 'CST-8' },
{ 'Asia/Ho Chi Minh', 'ICT-7' },
{ 'Asia/Hong Kong', 'HKT-8' },
@ -365,7 +366,7 @@ TZ = {
{ 'Indian/Kerguelen', 'TFT-5' },
{ 'Indian/Mahe', 'SCT-4' },
{ 'Indian/Maldives', 'MVT-5' },
{ 'Indian/Mauritius', 'MUT-4' },
{ 'Indian/Mauritius', 'MUT-4MUST,M10.5.0,M3.5.0/3' },
{ 'Indian/Mayotte', 'EAT-3' },
{ 'Indian/Reunion', 'RET-4' },
{ 'Pacific/Apia', 'WST11' },
@ -406,3 +407,166 @@ TZ = {
{ 'Pacific/Wake', 'WAKT-12' },
{ 'Pacific/Wallis', 'WFT-12' },
}
OFFSET = {
gmt = 0, -- GMT
eat = 10800, -- EAT
cet = 3600, -- CET
wat = 3600, -- WAT
cat = 7200, -- CAT
wet = 0, -- WET
sast = 7200, -- SAST
eet = 7200, -- EET
hast = -36000, -- HAST
hadt = -32400, -- HADT
akst = -32400, -- AKST
akdt = -28800, -- AKDT
ast = -14400, -- AST
brt = -10800, -- BRT
art = -10800, -- ART
arst = -7200, -- ARST
pyt = -14400, -- PYT
pyst = -10800, -- PYST
est = -18000, -- EST
cst = -21600, -- CST
amt = -14400, -- AMT
cot = -18000, -- COT
mst = -25200, -- MST
mdt = -21600, -- MDT
vet = -16200, -- VET
gft = -10800, -- GFT
pst = -28800, -- PST
pdt = -25200, -- PDT
ect = -18000, -- ECT
gyt = -14400, -- GYT
bot = -14400, -- BOT
pet = -18000, -- PET
pmst = -10800, -- PMST
pmdt = -7200, -- PMDT
uyt = -10800, -- UYT
uyst = -7200, -- UYST
fnt = -7200, -- FNT
srt = -10800, -- SRT
egt = -3600, -- EGT
egst = 0, -- EGST
nst = -12600, -- NST
ndt = -9000, -- NDT
wst = 28800, -- WST
davt = 25200, -- DAVT
ddut = 36000, -- DDUT
mawt = 21600, -- MAWT
nzst = 43200, -- NZST
nzdt = 46800, -- NZDT
rott = -10800, -- ROTT
syot = 10800, -- SYOT
vost = 21600, -- VOST
almt = 21600, -- ALMT
anat = 43200, -- ANAT
anast = 46800, -- ANAST
aqtt = 18000, -- AQTT
tmt = 18000, -- TMT
azt = 14400, -- AZT
azst = 18000, -- AZST
ict = 25200, -- ICT
kgt = 21600, -- KGT
bnt = 28800, -- BNT
chot = 28800, -- CHOT
ist = 19800, -- IST
bdt = 21600, -- BDT
tlt = 32400, -- TLT
gst = 14400, -- GST
tjt = 18000, -- TJT
hkt = 28800, -- HKT
hovt = 25200, -- HOVT
irkt = 28800, -- IRKT
irkst = 32400, -- IRKST
wit = 25200, -- WIT
eit = 32400, -- EIT
aft = 16200, -- AFT
pett = 43200, -- PETT
petst = 46800, -- PETST
pkt = 18000, -- PKT
npt = 20700, -- NPT
krat = 25200, -- KRAT
krast = 28800, -- KRAST
myt = 28800, -- MYT
magt = 39600, -- MAGT
magst = 43200, -- MAGST
cit = 28800, -- CIT
pht = 28800, -- PHT
novt = 21600, -- NOVT
novst = 25200, -- NOVST
omst = 21600, -- OMST
omsst = 25200, -- OMSST
orat = 18000, -- ORAT
kst = 32400, -- KST
qyzt = 21600, -- QYZT
mmt = 23400, -- MMT
sakt = 36000, -- SAKT
sakst = 39600, -- SAKST
uzt = 18000, -- UZT
sgt = 28800, -- SGT
get = 14400, -- GET
btt = 21600, -- BTT
jst = 32400, -- JST
ulat = 28800, -- ULAT
vlat = 36000, -- VLAT
vlast = 39600, -- VLAST
yakt = 32400, -- YAKT
yakst = 36000, -- YAKST
yekt = 18000, -- YEKT
yekst = 21600, -- YEKST
azot = -3600, -- AZOT
azost = 0, -- AZOST
cvt = -3600, -- CVT
fkt = -14400, -- FKT
fkst = -10800, -- FKST
cwst = 31500, -- CWST
lhst = 37800, -- LHST
lhst = 39600, -- LHST
msk = 10800, -- MSK
msd = 14400, -- MSD
samt = 14400, -- SAMT
samst = 18000, -- SAMST
volt = 10800, -- VOLT
volst = 14400, -- VOLST
iot = 21600, -- IOT
cxt = 25200, -- CXT
cct = 23400, -- CCT
tft = 18000, -- TFT
sct = 14400, -- SCT
mvt = 18000, -- MVT
mut = 14400, -- MUT
must = 18000, -- MUST
ret = 14400, -- RET
chast = 45900, -- CHAST
chadt = 49500, -- CHADT
vut = 39600, -- VUT
phot = 46800, -- PHOT
tkt = -36000, -- TKT
fjt = 43200, -- FJT
tvt = 43200, -- TVT
galt = -21600, -- GALT
gamt = -32400, -- GAMT
sbt = 39600, -- SBT
hst = -36000, -- HST
lint = 50400, -- LINT
kost = 39600, -- KOST
mht = 43200, -- MHT
mart = -34200, -- MART
sst = -39600, -- SST
nrt = 43200, -- NRT
nut = -39600, -- NUT
nft = 41400, -- NFT
nct = 39600, -- NCT
pwt = 32400, -- PWT
pont = 39600, -- PONT
pgt = 36000, -- PGT
ckt = -36000, -- CKT
taht = -36000, -- TAHT
gilt = 43200, -- GILT
tot = 46800, -- TOT
trut = 36000, -- TRUT
wakt = 43200, -- WAKT
wft = 43200, -- WFT
}

View file

@ -47,7 +47,12 @@ local fi
-- @param ... Virtual path
-- @return Relative URL
function build_url(...)
return luci.http.getenv("SCRIPT_NAME") .. "/" .. table.concat(arg, "/")
local path = {...}
local sn = http.getenv("SCRIPT_NAME") or ""
for k, v in pairs(context.urltoken) do
sn = sn .. "/;" .. k .. "=" .. http.urlencode(v)
end
return sn .. ((#path > 0) and "/" .. table.concat(path, "/") or "")
end
--- Send a 404 error code and render the "error404" template if available.
@ -123,6 +128,7 @@ function dispatch(request)
--context._disable_memtrace = require "luci.debug".trap_memtrace()
local ctx = context
ctx.path = request
ctx.urltoken = ctx.urltoken or {}
require "luci.i18n".setlanguage(require "luci.config".main.lang)
@ -137,8 +143,21 @@ function dispatch(request)
ctx.args = args
ctx.requestargs = ctx.requestargs or args
local n
local t = true
local token = ctx.urltoken
local preq = {}
for i, s in ipairs(request) do
local tkey, tval
if t then
tkey, tval = s:match(";(%w+)=(.*)")
end
if tkey then
token[tkey] = tval
else
t = false
preq[#preq+1] = s
c = c.nodes[s]
n = i
if not c then
@ -151,6 +170,7 @@ function dispatch(request)
break
end
end
end
if c and c.leaf then
for j=n+1, #request do
@ -158,6 +178,8 @@ function dispatch(request)
end
end
ctx.path = preq
if track.i18n then
require("luci.i18n").loadc(track.i18n)
end
@ -177,17 +199,23 @@ function dispatch(request)
assert(media, "No valid theme found")
end
local viewns = setmetatable({}, {__index=_G})
local viewns = setmetatable({}, {__index=function(table, key)
if key == "controller" then
return build_url()
elseif key == "REQUEST_URI" then
return build_url(unpack(ctx.requested.path))
else
return rawget(table, key) or _G[key]
end
end})
tpl.context.viewns = viewns
viewns.write = luci.http.write
viewns.include = function(name) tpl.Template(name):render(getfenv(2)) end
viewns.translate = function(...) return require("luci.i18n").translate(...) end
viewns.striptags = util.striptags
viewns.controller = luci.http.getenv("SCRIPT_NAME")
viewns.media = media
viewns.theme = fs.basename(media)
viewns.resource = luci.config.main.resourcebase
viewns.REQUEST_URI = (luci.http.getenv("SCRIPT_NAME") or "") .. (luci.http.getenv("PATH_INFO") or "")
end
track.dependent = (track.dependent ~= false)
@ -202,27 +230,50 @@ function dispatch(request)
local def = (type(track.sysauth) == "string") and track.sysauth
local accs = def and {track.sysauth} or track.sysauth
local sess = ctx.authsession or luci.http.getcookie("sysauth")
local sess = ctx.authsession
local verifytoken = false
if not sess then
sess = luci.http.getcookie("sysauth")
sess = sess and sess:match("^[A-F0-9]+$")
local user = sauth.read(sess)
verifytoken = true
end
local sdat = sauth.read(sess)
local user
if sdat then
sdat = loadstring(sdat)()
if not verifytoken or ctx.urltoken.stok == sdat.token then
user = sdat.user
end
end
if not util.contains(accs, user) then
if authen then
ctx.urltoken.stok = nil
local user, sess = authen(luci.sys.user.checkpasswd, accs, def)
if not user or not util.contains(accs, user) then
return
else
local sid = sess or luci.sys.uniqueid(16)
luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path=/")
if not sess then
sauth.write(sid, user)
local token = luci.sys.uniqueid(16)
sauth.write(sid, util.get_bytecode({
user=user,
token=token,
secret=luci.sys.uniqueid(16)
}))
ctx.urltoken.stok = token
end
luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path="..build_url())
ctx.authsession = sid
end
else
luci.http.status(403, "Forbidden")
return
end
else
ctx.authsession = sess
end
end
@ -354,9 +405,11 @@ function createtree()
local ctx = context
local tree = {nodes={}}
local modi = {}
ctx.treecache = setmetatable({}, {__mode="v"})
ctx.tree = tree
ctx.modifiers = modi
-- Load default translation
require "luci.i18n".loadc("default")
@ -369,9 +422,31 @@ function createtree()
v()
end
local function modisort(a,b)
return modi[a].order < modi[b].order
end
for _, v in util.spairs(modi, modisort) do
scope._NAME = v.module
setfenv(v.func, scope)
v.func()
end
return tree
end
--- Register a tree modifier.
-- @param func Modifier function
-- @param order Modifier order value (optional)
function modifier(func, order)
context.modifiers[#context.modifiers+1] = {
func = func,
order = order or 0,
module
= getfenv(2)._NAME
}
end
--- Clone a node of the dispatching tree to another position.
-- @param path Virtual path destination
-- @param clone Virtual path source
@ -415,7 +490,6 @@ function node(...)
local c = _create_node({...})
c.module = getfenv(2)._NAME
c.path = arg
c.auto = nil
return c
@ -431,10 +505,11 @@ function _create_node(path, cache)
local c = cache[name]
if not c then
local new = {nodes={}, auto=true, path=util.clone(path)}
local last = table.remove(path)
c = _create_node(path, cache)
local new = {nodes={}, auto=true}
c.nodes[last] = new
cache[name] = new

View file

@ -60,6 +60,9 @@ function read(id)
if not id then
return
end
if not id:match("^%w+$") then
error("Session ID is not sane!")
end
clean()
if not sane(sessionpath .. "/" .. id) then
return
@ -85,6 +88,19 @@ function write(id, data)
if not sane() then
prepare()
end
if not id:match("^%w+$") then
error("Session ID is not sane!")
end
luci.fs.writefile(sessionpath .. "/" .. id, data)
luci.fs.chmod(sessionpath .. "/" .. id, "a-rwx,u+rw")
end
--- Kills a session
-- @param id Session identifier
function kill(id)
if not id:match("^%w+$") then
error("Session ID is not sane!")
end
luci.fs.unlink(sessionpath .. "/" .. id)
end

View file

@ -7,7 +7,7 @@ config core brand
option title "OpenWrt Kamikaze"
option subtitle "Lua Configuration Interface"
option firmware "OpenWrt Kamikaze"
option distro ""
option distro "Development Snapshot"
config extern flash_keep
option uci "/etc/config/"

View file

@ -0,0 +1,15 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: indexer.htm 3552 2008-10-10 14:37:53Z Cyrus $
-%>
<% include("themes/" .. theme .. "/indexer") %>

View file

@ -41,7 +41,7 @@ $Id$
</fieldset></fieldset>
</div>
<div id="auth_buttons">
<div>
<input type="submit" value="<%:login%>" class="cbi-button cbi-button-apply" />
<input type="reset" value="<%:reset%>" class="cbi-button cbi-button-reset" />
</div>

View file

@ -1,3 +1 @@
config 'host'
option 'ipaddr' '10.11.12.13'
option 'hostname' 'sample-host'

View file

@ -384,7 +384,6 @@ config variable
option title 'IPv4 gateway'
option section 'network.route'
option datatype 'ip4addr'
option required 'true'
config variable
option name 'metric'

View file

@ -0,0 +1,20 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
module("luci.controller.admin.filebrowser", package.seeall)
function index()
entry( {"admin", "filebrowser"}, template("cbi/filebrowser") ).leaf = true
end

View file

@ -49,6 +49,13 @@ function index()
end
function action_logout()
luci.http.header("Set-Cookie", "sysauth=; path=/")
local dsp = require "luci.dispatcher"
local sauth = require "luci.sauth"
if dsp.context.authsession then
sauth.kill(dsp.context.authsession)
dsp.context.urltoken.stok = nil
end
luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
luci.http.redirect(luci.dispatcher.build_url())
end

View file

@ -28,10 +28,19 @@ function index()
page.order = 40
page.index = true
if luci.fs.access("/etc/config/lucittpd") then
local page = node("admin", "services", "lucittpd")
page.target = cbi("admin_services/lucittpd")
page.title = "LuCIttpd"
page.order = 10
end
if luci.fs.access("/etc/config/httpd") then
local page = node("admin", "services", "httpd")
page.target = cbi("admin_services/httpd")
page.title = "Busybox HTTPd"
page.order = 10
page.order = 11
end
local page = node("admin", "services", "dropbear")
page.target = cbi("admin_services/dropbear")

View file

@ -25,7 +25,11 @@ function index()
entry({"admin", "system", "sshkeys"}, form("admin_system/sshkeys"), i18n("a_s_sshkeys"), 30)
entry({"admin", "system", "processes"}, form("admin_system/processes"), i18n("process_head"), 45)
entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab"), 50)
if luci.fs.isdirectory("/sys/class/leds") then
entry({"admin", "system", "leds"}, cbi("admin_system/leds"), i18n("leds", "LEDs"), 60)
end
entry({"admin", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 70)
entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 80)
entry({"admin", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 90)

View file

@ -41,6 +41,7 @@ if has_pppoe then p:value("pppoe", "PPPoE") end
if has_pppoa then p:value("pppoa", "PPPoA") end
if has_3g then p:value("3g", "UMTS/3G") end
if has_pptp then p:value("pptp", "PPTP") end
p:value("none", translate("none"))
if not ( has_pppd and has_pppoe and has_pppoa and has_3g and has_pptp ) then
p.description = translate("network_interface_prereq")

View file

@ -161,6 +161,7 @@ bssid = s:option(Value, "bssid", translate("wifi_bssid"))
-------------------- MAC80211 Interface ----------------------
if hwtype == "mac80211" then
mode:value("ahdemo", translate("a_w_ahdemo"))
mode:value("monitor", translate("a_w_monitor"))
bssid:depends({mode="adhoc"})

View file

@ -32,7 +32,7 @@ s = m:section(Table, ifaces, translate("networks"))
function s.extedit(self, section)
local device = self.map:get(section, "device") or ""
return luci.http.getenv("REQUEST_URI") .. "/" .. device
return luci.dispatcher.build_url(unpack(luci.dispatcher.context.requested.path)) .. "/" .. device
end
link = s:option(DummyValue, "_link", translate("link"))
@ -124,7 +124,7 @@ function create.write(self, section, value)
uci:load("wireless")
uci:section("wireless", "wifi-iface", nil, {device=value})
uci:save("wireless")
luci.http.redirect(luci.http.getenv("REQUEST_URI") .. "/" .. value)
luci.http.redirect(luci.dispatcher.build_url(unpack(luci.dispatcher.context.requested.path)) .. "/" .. value)
end
function create.cbid(self, section)

View file

@ -0,0 +1,25 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
m = Map("lucittpd", "LuCIttpd", translate("a_srv_lucittpd"))
s = m:section(NamedSection, "lucittpd", "lucittpd", "")
s:option(Value, "port", translate("port"))
s:option(Value, "root", translate("a_srv_http_root"))
s:option(Value, "path", translate("a_srv_http_path"))
s:option(Flag, "keepalive", translate("a_srv_http_keepalive"))
s:option(Value, "timeout", translate("a_srv_http_timeout"))
return m

View file

@ -40,6 +40,13 @@ function index()
end
function action_logout()
luci.http.header("Set-Cookie", "sysauth=; path=/")
local dsp = require "luci.dispatcher"
local sauth = require "luci.sauth"
if dsp.context.authsession then
sauth.kill(dsp.context.authsession)
dsp.context.urltoken.stok = nil
end
luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
luci.http.redirect(luci.dispatcher.build_url())
end

View file

@ -19,6 +19,8 @@ function index()
local page = node()
page.lock = true
page.target = alias("freifunk")
page.subindex = true
page.index = false
local page = node("freifunk")
page.title = "Freifunk"
@ -27,11 +29,13 @@ function index()
page.setuser = "nobody"
page.setgroup = "nogroup"
page.i18n = "freifunk"
page.index = true
local page = node("freifunk", "index")
page.target = template("freifunk/index")
page.title = "Übersicht"
page.order = 10
page.indexignore = true
local page = node("freifunk", "index", "contact")
page.target = template("freifunk/contact")
@ -39,26 +43,27 @@ function index()
local page = node("freifunk", "status")
page.target = call("action_status")
page.target = form("freifunk/public_status")
page.title = "Status"
page.order = 20
page.i18n = "admin-core"
page.setuser = false
page.setgroup = false
assign({"freifunk", "status", "iwscan"}, {"admin", "status", "iwscan"}, "WLAN-Scan", 20)
assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30)
if luci.fs.isfile("/etc/config/luci_statistics") then
assign({"freifunk", "statistics"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40)
assign({"freifunk", "graph"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40)
end
local page = node("admin", "index", "freifunk")
assign({"mini", "freifunk"}, {"admin", "freifunk"}, "Freifunk", 15)
entry({"admin", "freifunk"}, alias("admin", "freifunk", "index"), "Freifunk", 15)
local page = node("admin", "freifunk", "index")
page.target = cbi("freifunk/freifunk")
page.title = "Freifunk"
page.order = 30
local page = node("admin", "index", "contact")
local page = node("admin", "freifunk", "contact")
page.target = cbi("freifunk/contact")
page.title = "Kontakt"
page.order = 40

View file

@ -11,16 +11,24 @@ You may obtain a copy of the License at
$Id$
]]--
luci.i18n.loadc("freifunk")
m = Map("freifunk", translate("contact"), translate("contact1"))
c = m:section(NamedSection, "contact", "public", "")
c:option(Value, "nickname", translate("nickname"))
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, "geo", translate("coord"), translate("coord1"))
c:option(Value, "note", translate("note"))
c:option(Value, "nickname", translate("ff_nickname"))
c:option(Value, "name", translate("ff_name"))
c:option(Value, "mail", translate("ff_mail"), translate("ff_mail1"))
c:option(Value, "phone", translate("ff_phone"))
c:option(Value, "location", translate("ff_location"))
c:option(Value, "note", translate("ff_note"))
return m
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

View file

@ -18,14 +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")
c:option(Value, "essid", "ESSID")
c:option(Value, "bssid", "BSSID")
c:option(Value, "channel", "Funkkanal")
c:option(Value, "realm", "Realm")
c:option(Value, "net", "Adressbereich")
c:option(Value, "mask", "Netzmaske")
c:option(Value, "dns", "DNS-Server")
c:option(Value, "dhcp", "DHCP-Bereich")
c:option(Value, "dhcpmask", "DHCP-Maske")
c:option(Value, "ssid", "ESSID")
c:option(Value, "prefix", "Netzprefix")
return m

View file

@ -0,0 +1,213 @@
require "luci.sys"
require "luci.tools.webadmin"
local bit = require "bit"
local uci = luci.model.uci.cursor_state()
local ffzone = luci.tools.webadmin.firewall_find_zone("freifunk")
local ffznet = ffzone and uci:get("firewall", ffzone, "network")
local ffwifs = ffznet and luci.util.split(ffznet, " ") or {}
-- System --
f = SimpleForm("system", "System")
f.submit = false
f.reset = false
local system, model, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo()
local uptime = luci.sys.uptime()
f:field(DummyValue, "_system", translate("system")).value = system
f:field(DummyValue, "_cpu", translate("m_i_processor")).value = model
local load1, load5, load15 = luci.sys.loadavg()
f:field(DummyValue, "_la", translate("load")).value =
string.format("%.2f, %.2f, %.2f", load1, load5, load15)
f:field(DummyValue, "_memtotal", translate("m_i_memory")).value =
string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)",
tonumber(memtotal) / 1024,
100 * memcached / memtotal,
translate("mem_cached") or "",
100 * membuffers / memtotal,
translate("mem_buffered") or "",
100 * memfree / memtotal,
translate("mem_free") or "")
f:field(DummyValue, "_systime", translate("m_i_systemtime")).value =
os.date("%c")
f:field(DummyValue, "_uptime", translate("m_i_uptime")).value =
luci.tools.webadmin.date_format(tonumber(uptime))
-- Wireless --
local wireless = uci:get_all("wireless")
local wifidata = luci.sys.wifi.getiwconfig()
local ifaces = {}
for k, v in pairs(wireless) do
if v[".type"] == "wifi-iface" and luci.util.contains(ffwifs, v.device) then
table.insert(ifaces, v)
end
end
m = SimpleForm("wireless", "Freifunk WLAN")
m.submit = false
m.reset = false
s = m:section(Table, ifaces, translate("networks"))
link = s:option(DummyValue, "_link", translate("link"))
function link.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
return wifidata[ifname] and wifidata[ifname]["Link Quality"] or "-"
end
essid = s:option(DummyValue, "ssid", "ESSID")
bssid = s:option(DummyValue, "_bsiid", "BSSID")
function bssid.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
return (wifidata[ifname] and (wifidata[ifname].Cell
or wifidata[ifname]["Access Point"])) or "-"
end
channel = s:option(DummyValue, "channel", translate("channel"))
function channel.cfgvalue(self, section)
return wireless[self.map:get(section, "device")].channel
end
protocol = s:option(DummyValue, "_mode", translate("protocol"))
function protocol.cfgvalue(self, section)
local mode = wireless[self.map:get(section, "device")].mode
return mode and "802." .. mode
end
mode = s:option(DummyValue, "mode", translate("mode"))
encryption = s:option(DummyValue, "encryption", translate("iwscan_encr"))
power = s:option(DummyValue, "_power", translate("power"))
function power.cfgvalue(self, section)
local ifname = self.map:get(section, "ifname")
return wifidata[ifname] and wifidata[ifname]["Tx-Power"] or "-"
end
scan = s:option(Button, "_scan", translate("scan"))
scan.inputstyle = "find"
function scan.cfgvalue(self, section)
return self.map:get(section, "ifname") or false
end
t2 = m:section(Table, {}, translate("iwscan"), translate("iwscan1"))
function scan.write(self, section)
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname))
end
t2._render = t2.render
t2.render = function() end
t2:option(DummyValue, "Quality", translate("iwscan_link"))
essid = t2:option(DummyValue, "ESSID", "ESSID")
function essid.cfgvalue(self, section)
return luci.util.pcdata(self.map:get(section, "ESSID"))
end
t2:option(DummyValue, "Address", "BSSID")
t2:option(DummyValue, "Mode", translate("mode"))
chan = t2:option(DummyValue, "channel", translate("channel"))
function chan.cfgvalue(self, section)
return self.map:get(section, "Channel")
or self.map:get(section, "Frequency")
or "-"
end
t2:option(DummyValue, "Encryption key", translate("iwscan_encr"))
t2:option(DummyValue, "Signal level", translate("iwscan_signal"))
t2:option(DummyValue, "Noise level", translate("iwscan_noise"))
-- Routes --
r = SimpleForm("routes", "Standardrouten")
r.submit = false
r.reset = false
local routes = {}
for i, route in ipairs(luci.sys.net.routes()) do
if route.dest:prefix() == 0 then
routes[#routes+1] = route
end
end
v = r:section(Table, routes)
net = v:option(DummyValue, "iface", translate("network"))
function net.cfgvalue(self, section)
return luci.tools.webadmin.iface_get_network(routes[section].device)
or routes[section].device
end
target = v:option(DummyValue, "target", translate("target"))
function target.cfgvalue(self, section)
return routes[section].dest:network():string()
end
netmask = v:option(DummyValue, "netmask", translate("netmask"))
function netmask.cfgvalue(self, section)
return routes[section].dest:mask():string()
end
gateway = v:option(DummyValue, "gateway", translate("gateway"))
function gateway.cfgvalue(self, section)
return routes[section].gateway:string()
end
metric = v:option(DummyValue, "metric", translate("metric"))
function metric.cfgvalue(self, section)
return routes[section].metric
end
local routes6 = {}
for i, route in ipairs(luci.sys.net.routes6() or {}) do
if route.dest:prefix() == 0 then
routes6[#routes6+1] = route
end
end
if #routes6 > 0 then
v6 = r:section(Table, routes6)
net = v6:option(DummyValue, "iface", translate("network"))
function net.cfgvalue(self, section)
return luci.tools.webadmin.iface_get_network(routes[section].device)
or routes6[section].device
end
target = v6:option(DummyValue, "target", translate("target"))
function target.cfgvalue(self, section)
return routes6[section].dest:string()
end
gateway = v6:option(DummyValue, "gateway6", translate("gateway6"))
function gateway.cfgvalue(self, section)
return routes6[section].source:string()
end
metric = v6:option(DummyValue, "metric", translate("metric"))
function metric.cfgvalue(self, section)
local metr = routes6[section].metric
local lower = bit.band(metr, 0xffff)
local higher = bit.rshift(bit.band(metr, 0xffff0000), 16)
return "%04X%04X" % {higher, lower}
end
end
return f, m, r

View file

@ -17,7 +17,7 @@ $Id$
<h2><a id="content" name="content"><%:ff_hellonet%> <%=ff.community.name or 'Freifunk Deutschland'%>!</a></h2>
<p><%:ff_public1%><br />
<%:ff_public2%> <%=luci.sys.hostname()%>. <%:ff_public3%>
<a href="<%=controller%>/public/index/contact"> <%=ff.contact.nickname%></a>.</p>
<a href="<%=luci.dispatcher.build_url("freifunk", "index", "contact")%>"> <%=ff.contact.nickname%></a>.</p>
<p><%:ff_public4%> <a href="http://freifunk.net">Freifunk.net</a>.<br />
<%:ff_public5%> <a href="<%=ff.community.homepage or 'http//freifunk.net'%>"><%=ff.community.name or 'Freifunk'%></a>.</p>
<p><strong><%:ff_note%></strong>: <%:ff_public6%></p>

View file

@ -1,19 +1,15 @@
config settings wizard
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
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
@ -43,24 +39,26 @@ config fw_forwarding lan
option src lan
option dest freifunk
config fw_forwarding fffwd
option src freifunk
option dest freifunk
config defaults wifi_device
option channel 1
option txantenna 1
option rxantenna 1
option txant 1
option rxant 1
option diversity 0
option disabled 0
config defaults wifi_iface
option type adhoc
option essid halle.freifunk.net
option mode adhoc
option bssid 02:CA:FF:EE:BA:BE
option txpower 10
option rts 0
option frag 0
option rts 2346
option frag 512
option sw_merge 1
config defaults interface
@ -85,3 +83,43 @@ config defaults olsr_interface
option MidValidityTime 324.0
option HnaInterval 18.0
option HnaValidityTime 108.0
config community leipzig
option name "Freifunk Leipzig"
option homepage http://leipzig.freifunk.net
option ssid "leipzig.freifunk.net"
option prefix "104.61"
config community halle
option name "Freifunk Halle"
option homepage http://halle.freifunk.net
option ssid "halle.freifunk.net"
option prefix "104.62"
config community l59
option name "Freifunk L59"
option homepage http://freifunk.net
option ssid "start.freifunk.net"
option prefix "104.59"
config community berlin
option name "Freifunk Berlin"
option homepage http://berlin.freifunk.net
option ssid "olsr.freifunk.net"
option prefix "104"
option external freifunk_berlin
config community hannover
option name "Freifunk Hannover"
option homepage http://hannover.freifunk.net
option ssid "hannover.freifunk.net"
option prefix "10.2"
option external freifunk_hannover
config community augsburg
option name "Freifunk Augsburg"
option homepage http://augsburg.freifunk.net
option ssid "augsburg.freifunk.net"
option prefix "191.161"
option external freifunk_augsburg

View file

@ -0,0 +1,2 @@
config defaults interface
option netmask 255.255.0.0

View file

@ -0,0 +1,2 @@
config defaults wifi_device
option channel 10

View file

@ -0,0 +1,5 @@
config defaults wifi_iface
option bssid CA:FF:EE:CA:FF:EE
config defaults interface
option netmask 255.255.0.0

View file

@ -25,7 +25,8 @@ function index()
local function authenticator(validator, accs)
local auth = luci.http.formvalue("auth", true)
if auth then
local user = luci.sauth.read(auth)
local sdat = luci.sauth.read(auth)
user = loadstring(sdat)().user
if user and luci.util.contains(accs, user) then
return user, auth
end
@ -52,20 +53,33 @@ function rpc_auth()
local http = require "luci.http"
local sys = require "luci.sys"
local ltn12 = require "luci.ltn12"
local util = require "luci.util"
local loginstat
local server = {}
server.login = function(user, pass)
local sid
server.challenge = function(user, pass)
local sid, token, secret
if sys.user.checkpasswd(user, pass) then
sid = sys.uniqueid(16)
token = sys.uniqueid(16)
secret = sys.uniqueid(16)
http.header("Set-Cookie", "sysauth=" .. sid.."; path=/")
sauth.write(sid, user)
sauth.write(sid, util.get_bytecode({
user=user,
token=token,
secret=secret
}))
end
return sid
return sid and {sid=sid, token=token, secret=secret}
end
server.login = function(...)
local challenge = server.challenge(...)
return challenge and challenge.sid
end
http.prepare_content("application/json")

View file

@ -371,19 +371,12 @@ textarea#syslog {
font-style: italic;
font-family: Trebuchet MS, Verdana, sans-serif;
color: #27408B;
background: url('../resources/cbi/arrow.gif') left no-repeat;
padding-left: 17px;
}
#maincontent p {
margin-bottom: 1em;
}
#auth_buttons {
float: right;
padding-top: 0.5em;
}
.cbi-section {
margin-bottom: 0.5em;
padding: 0.5em 1em;