From: Steven Barth Date: Thu, 8 May 2008 16:04:18 +0000 (+0000) Subject: * Fixed #2030 X-Git-Tag: 0.8.0~1059 X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=214bfdc19887c3df373d1323afd9738eee4f64ca * Fixed #2030 --- diff --git a/modules/freifunk/Makefile b/modules/freifunk/Makefile new file mode 100644 index 0000000000..81a96f6a83 --- /dev/null +++ b/modules/freifunk/Makefile @@ -0,0 +1,2 @@ +include ../../build/config.mk +include ../../build/module.mk \ No newline at end of file diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk new file mode 100644 index 0000000000..01b83f2c7b --- /dev/null +++ b/modules/freifunk/root/etc/config/freifunk @@ -0,0 +1,25 @@ +config public contact + option nickname + option name + option mail + option phone + option location + option geo + option note + +config public community + option name "Freifunk Halle" + option homepage http://halle.freifunk.net + option essid halle.freifunk.net + option bssid 02:CA:FF:EE:BA:BE + option realm netz.freifunk-halle.net + option channel 1 + option net 104.0.0.0 + option mask 255.0.0.0 + option dhcp 10.0.0.0 + option dhcpmask 255.255.255.0 + option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222" + +config settings routing + option internal 0 + option internet 0 diff --git a/modules/freifunk/root/etc/init.d/luci_freifunk b/modules/freifunk/root/etc/init.d/luci_freifunk new file mode 100644 index 0000000000..38779cb8ba --- /dev/null +++ b/modules/freifunk/root/etc/init.d/luci_freifunk @@ -0,0 +1,91 @@ +#!/bin/sh /etc/rc.common +START=70 + +start() { + include /lib/network + scan_interfaces + + + ### Read interface names + config_get wanif wan ifname + config_get lanif lan ifname + config_get ffif ff ifname + config_get ffdif ffdhcp ifname + + config_get lanip lan ipaddr + config_get lanmask lan netmask + + config_get ffip ff ipaddr + config_get ffmask ff netmask + + config_get ffdip ffdhcp ipaddr + config_get ffdmask ffdhcp netmask + + [ -n "$ffif" ] || return 0 + + + ### Creating chains + iptables -N luci_freifunk_forwarding + iptables -t nat -N luci_freifunk_postrouting + + + ### Read from config + config_load freifunk + + config_get_bool internal routing internal + [ -n "$wanif" ] && config_get_bool internet routing internet + + + ### Freifunk to Freifunk + [ "$internal" -gt 0 ] && { + iptables -A luci_freifunk_forwarding -i "$ffif" -o "$ffif" -j ACCEPT + } + + ### Freifunk DHCP to Freifunk + [ "$internal" -gt 0 -a -n "$ffdif" ] && { + eval "$(ipcalc.sh $ffdip $ffdmask)" + + iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$ffif" -j MASQUERADE + } + + ### Lan to Freifunk + [ -n "$lanif" ] && { + eval "$(ipcalc.sh $lanip $lanmask)" + + iptables -A luci_freifunk_forwarding -i "$lanif" -o "$ffif" -j ACCEPT + iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$ffif" -j MASQUERADE + } + + ### Freifunk to Wan + [ "$internet" -gt 0 ] && { + eval "$(ipcalc.sh $ffip $ffmask)" + + iptables -A luci_freifunk_forwarding -i "$ffif" -o "$wanif" -j ACCEPT + iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$wanif" -j MASQUERADE + } + + ### Freifunk DHCP to Wan + [ "$internet" -gt 0 -a -n "$ffdif" ] && { + eval "$(ipcalc.sh $ffdip $ffdmask)" + + iptables -t nat -A luci_freifunk_postrouting -s "$NETWORK/$PREFIX" -o "$wanif" -j MASQUERADE + } + + ### Hook in the chains + iptables -A forwarding_rule -j luci_freifunk_forwarding + iptables -t nat -A postrouting_rule -j luci_freifunk_postrouting +} + +stop() { + ### Hook out the chains + iptables -D forwarding_rule -j luci_freifunk_forwarding + iptables -t nat -D postrouting_rule -j luci_freifunk_postrouting + + ### Clear the chains + iptables -F luci_freifunk_forwarding + iptables -t nat -F luci_freifunk_postrouting + + ### Delete chains + iptables -X luci_freifunk_forwarding + iptables -t nat -X luci_freifunk_postrouting +} diff --git a/modules/freifunk/src/controller/admin/index/wizard.lua b/modules/freifunk/src/controller/admin/index/wizard.lua new file mode 100644 index 0000000000..c7064bb1b7 --- /dev/null +++ b/modules/freifunk/src/controller/admin/index/wizard.lua @@ -0,0 +1,171 @@ +module("ffluci.controller.admin.index.wizard", package.seeall) + +function action() + if ffluci.http.formvalue("ip") then + return configure_freifunk() + end + + local ifaces = {} + local wldevs = ffluci.model.uci.sections("wireless") + + if wldevs then + for k, v in pairs(wldevs) do + if v[".type"] == "wifi-device" then + table.insert(ifaces, k) + end + end + end + + ffluci.template.render("admin_index/wizard", {ifaces=ifaces}) +end + +function configure_freifunk() + local ip = ffluci.http.formvalue("ip") + local uci = ffluci.model.uci.Session() + + -- Load UCI + uci:t_load("network") + uci:t_load("dhcp") + uci:t_load("freifunk") + uci:t_load("luci_splash") + uci:t_load("olsr") + uci:t_load("wireless") + + + -- Configure FF-Interface + uci:t_del("network", "ff") + uci:t_del("network", "ffdhcp") + + uci:t_set("network", "ff", nil, "interface") + uci:t_set("network", "ff", "type", "bridge") + uci:t_set("network", "ff", "proto", "static") + uci:t_set("network", "ff", "ipaddr", ip) + uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask")) + uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns")) + + -- Enable internal routing + uci:t_set("freifunk", "routing", "internal", "1") + + -- Enable internet routing + if ffluci.http.formvalue("shareinet") then + uci:t_set("freifunk", "routing", "internet", "1") + else + uci:t_set("freifunk", "routing", "internet", "0") + end + + -- Configure DHCP + if ffluci.http.formvalue("dhcp") then + local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)") + local dhcpip = ip:gsub("^[0-9]+", dhcpnet) + + uci:t_set("network", "ffdhcp", nil, "interface") + uci:t_set("network", "ffdhcp", "proto", "static") + uci:t_set("network", "ffdhcp", "ifname", "br-ff:dhcp") + uci:t_set("network", "ffdhcp", "ipaddr", dhcpip) + uci:t_set("network", "ffdhcp", "netmask", uci:t_get("freifunk", "community", "dhcpmask")) + + local dhcp = uci:t_sections("dhcp") + if dhcp then + for k, v in pairs(dhcp) do + if v[".type"] == "dhcp" and v.interface == "ffdhcp" then + uci:t_del("dhcp", k) + end + end + + local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4 + + local sk = uci:t_add("dhcp", "dhcp") + uci:t_set("dhcp", sk, "interface", "ffdhcp") + uci:t_set("dhcp", sk, "start", dhcpbeg) + uci:t_set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2) + uci:t_set("dhcp", sk, "leasetime", "30m") + end + + local splash = uci:t_sections("luci_splash") + if splash then + for k, v in pairs(splash) do + if v[".type"] == "iface" then + uci:t_del("luci_splash", k) + end + end + + local sk = uci:t_add("luci_splash", "iface") + uci:t_set("luci_splash", sk, "network", "ffdhcp") + end + end + + -- Configure OLSR + if ffluci.http.formvalue("olsr") and uci:t_sections("olsr") then + for k, v in pairs(uci:t_sections("olsr")) do + if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then + uci:t_del("olsr", k) + end + end + + if ffluci.http.formvalue("shareinet") then + uci:t_set("olsr", "dyn_gw", nil, "LoadPlugin") + uci:t_set("olsr", "dyn_gw", "Library", "olsrd_dyn_gw.so.0.4") + end + + uci:t_set("olsr", "nameservice", nil, "LoadPlugin") + uci:t_set("olsr", "nameservice", "Library", "olsrd_nameservice.so.0.3") + uci:t_set("olsr", "nameservice", "name", ip:gsub("%.", "-")) + uci:t_set("olsr", "nameservice", "hosts_file", "/var/etc/hosts") + uci:t_set("olsr", "nameservice", "suffix", ".olsr") + uci:t_set("olsr", "nameservice", "latlon_infile", "/tmp/latlon.txt") + + uci:t_set("olsr", "txtinfo", nil, "LoadPlugin") + uci:t_set("olsr", "txtinfo", "Library", "olsrd_txtinfo.so.0.1") + uci:t_set("olsr", "txtinfo", "Accept", "127.0.0.1") + + local oif = uci:t_add("olsr", "Interface") + uci:t_set("olsr", oif, "Interface", "ff") + uci:t_set("olsr", oif, "HelloInterval", "6.0") + uci:t_set("olsr", oif, "HelloValidityTime", "108.0") + uci:t_set("olsr", oif, "TcInterval", "4.0") + uci:t_set("olsr", oif, "TcValidityTime", "324.0") + uci:t_set("olsr", oif, "MidInterval", "18.0") + uci:t_set("olsr", oif, "MidValidityTime", "324.0") + uci:t_set("olsr", oif, "HnaInterval", "18.0") + uci:t_set("olsr", oif, "HnaValidityTime", "108.0") + end + + -- Configure Wifi + local wcfg = uci:t_sections("wireless") + if wcfg then + for iface, v in pairs(wcfg) do + if v[".type"] == "wifi-device" and ffluci.http.formvalue("wifi."..iface) then + -- Cleanup + for k, j in pairs(wcfg) do + if j[".type"] == "wifi-iface" and j.device == iface then + uci:t_del("wireless", k) + end + end + + uci:t_set("wireless", iface, "disabled", "0") + uci:t_set("wireless", iface, "mode", "11g") + uci:t_set("wireless", iface, "txantenna", 1) + uci:t_set("wireless", iface, "rxantenna", 1) + uci:t_set("wireless", iface, "channel", uci:t_get("freifunk", "community", "channel")) + + local wif = uci:t_add("wireless", "wifi-iface") + uci:t_set("wireless", wif, "device", iface) + uci:t_set("wireless", wif, "network", "ff") + uci:t_set("wireless", wif, "mode", "adhoc") + uci:t_set("wireless", wif, "ssid", uci:t_get("freifunk", "community", "essid")) + uci:t_set("wireless", wif, "bssid", uci:t_get("freifunk", "community", "bssid")) + uci:t_set("wireless", wif, "txpower", 13) + end + end + end + + -- Save UCI + uci:t_save("network") + uci:t_save("dhcp") + uci:t_save("freifunk") + uci:t_save("luci_splash") + uci:t_save("olsr") + uci:t_save("wireless") + + ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes")) +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/index.lua b/modules/freifunk/src/controller/public/index.lua new file mode 100644 index 0000000000..f65478c05f --- /dev/null +++ b/modules/freifunk/src/controller/public/index.lua @@ -0,0 +1 @@ +module("ffluci.controller.public.index", package.seeall) \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/olsr.lua b/modules/freifunk/src/controller/public/olsr.lua new file mode 100644 index 0000000000..d41f5ed41d --- /dev/null +++ b/modules/freifunk/src/controller/public/olsr.lua @@ -0,0 +1,137 @@ +module("ffluci.controller.public.olsr", package.seeall) +require("ffluci.sys") + +function action_index() + local data = fetch_txtinfo("links") + + if not data or not data.Links then + ffluci.template.render("public_olsr/error_olsr") + return nil + end + + local function compare(a, b) + if tonumber(a.ETX) == 0 then + return false + end + + if tonumber(b.ETX) == 0 then + return true + end + + return tonumber(a.ETX) < tonumber(b.ETX) + end + + table.sort(data.Links, compare) + + ffluci.template.render("public_olsr/index", {links=data.Links}) +end + +function action_routes() + local data = fetch_txtinfo("routes") + + if not data or not data.Routes then + ffluci.template.render("public_olsr/error_olsr") + return nil + end + + local function compare(a, b) + if tonumber(a.ETX) == 0 then + return false + end + + if tonumber(b.ETX) == 0 then + return true + end + + return tonumber(a.ETX) < tonumber(b.ETX) + end + + table.sort(data.Routes, compare) + + ffluci.template.render("public_olsr/routes", {routes=data.Routes}) +end + +function action_topology() + local data = fetch_txtinfo("topology") + + if not data or not data.Topology then + ffluci.template.render("public_olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a["Destination IP"] < b["Destination IP"] + end + + table.sort(data.Topology, compare) + + ffluci.template.render("public_olsr/topology", {routes=data.Topology}) +end + +function action_hna() + local data = fetch_txtinfo("hna") + + if not data or not data.HNA then + ffluci.template.render("public_olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a.Network < b.Network + end + + table.sort(data.HNA, compare) + + ffluci.template.render("public_olsr/hna", {routes=data.HNA}) +end + +function action_mid() + local data = fetch_txtinfo("mid") + + if not data or not data.MID then + ffluci.template.render("public_olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a.IP < b.IP + end + + table.sort(data.MID, compare) + + ffluci.template.render("public_olsr/mid", {mids=data.MID}) +end + + +-- Internal +function fetch_txtinfo(otable) + otable = otable or "" + local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..otable) + + if #rawdata == 0 then + return nil + end + + local data = {} + + local tables = ffluci.util.split(ffluci.util.trim(rawdata), "\n\n") + + + for i, tbl in ipairs(tables) do + local lines = ffluci.util.split(tbl, "\n") + local name = table.remove(lines, 1):sub(8) + local keys = ffluci.util.split(table.remove(lines, 1), "\t") + + data[name] = {} + + for j, line in ipairs(lines) do + local fields = ffluci.util.split(line, "\t") + data[name][j] = {} + for k, key in pairs(keys) do + data[name][j][key] = fields[k] + end + end + end + + return data +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/status.lua b/modules/freifunk/src/controller/public/status.lua new file mode 100644 index 0000000000..8d2f7a303f --- /dev/null +++ b/modules/freifunk/src/controller/public/status.lua @@ -0,0 +1,21 @@ +module("ffluci.controller.public.status", package.seeall) + +function action_index() + local data = {} + + data.s, data.m, data.r = ffluci.sys.sysinfo() + + data.wifi = ffluci.sys.wifi.getiwconfig() + + data.routes = {} + for i, r in pairs(ffluci.sys.net.routes()) do + if r.Destination == "00000000" then + table.insert(data.routes, r) + end + end + + + ffluci.template.render("public_status/index", data) +end + + diff --git a/modules/freifunk/src/controller/rpc/luciinfo.lua b/modules/freifunk/src/controller/rpc/luciinfo.lua new file mode 100644 index 0000000000..611423fbb0 --- /dev/null +++ b/modules/freifunk/src/controller/rpc/luciinfo.lua @@ -0,0 +1,41 @@ +module("ffluci.controller.rpc.luciinfo", package.seeall) + +function action_index() + local uci = ffluci.model.uci.StateSession() + + ffluci.http.prepare_content("text/plain") + + -- General + print("luciinfo.api=1") + print("luciinfo.version=" .. tostring(ffluci.__version__)) + + -- Sysinfo + local s, m, r = ffluci.sys.sysinfo() + local dr = ffluci.sys.net.defaultroute() + dr = dr and ffluci.sys.net.hexip4(dr.Gateway) or "" + local l1, l5, l15 = ffluci.sys.loadavg() + + print("sysinfo.system=" .. sanitize(s)) + print("sysinfo.cpu=" .. sanitize(m)) + print("sysinfo.ram=" .. sanitize(r)) + print("sysinfo.hostname=" .. sanitize(ffluci.sys.hostname())) + print("sysinfo.load1=" .. tostring(l1)) + print("sysinfo.load5=" .. tostring(l5)) + print("sysinfo.load15=" .. tostring(l15)) + print("sysinfo.defaultgw=" .. dr) + + + -- Freifunk + local ff = uci:sections("freifunk") or {} + for k, v in pairs(ff) do + if k:sub(1, 1) ~= "." then + for i, j in pairs(v) do + print("freifunk." .. k .. "." .. i .. "=" .. j) + end + end + end +end + +function sanitize(val) + return val:gsub("\n", "\t") +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/sudo/status.lua b/modules/freifunk/src/controller/sudo/status.lua new file mode 100644 index 0000000000..fd5127d2cf --- /dev/null +++ b/modules/freifunk/src/controller/sudo/status.lua @@ -0,0 +1 @@ +module("ffluci.controller.sudo.status", package.seeall) \ No newline at end of file diff --git a/modules/freifunk/src/i18n/admin_index_contact.en b/modules/freifunk/src/i18n/admin_index_contact.en new file mode 100644 index 0000000000..e2402e91fc --- /dev/null +++ b/modules/freifunk/src/i18n/admin_index_contact.en @@ -0,0 +1,11 @@ +contact1 = [[This information will be available on the public contact page. +As stated in the Picopeering Agreement you should at least enter your e-mail address. +To display your router on any topography map, please enter your geographical coordinates or at least +your street and house number in the location field.]] +nickname = "Nickname" +mail1 = "This field is essential!" +phone = "Phone" +location = "Location" +coord = "Coordinates" +coord1 = "Latitude;Longitude (e.g. 51.5;12.9)" +note = "Note" \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/admin_index/contact.lua b/modules/freifunk/src/model/cbi/admin_index/contact.lua new file mode 100644 index 0000000000..66a1ec4bde --- /dev/null +++ b/modules/freifunk/src/model/cbi/admin_index/contact.lua @@ -0,0 +1,18 @@ +-- Todo: Translate +m = Map("freifunk", translate("contact", "Kontakt"), translate("contact1", [[Diese Daten sind +auf der öffentlichen Kontaktseite sichtbar. Bitte gib an, wie man dich am besten kontaktieren kann. +Diese Informationen sollten nach der Picopeering Vereinbarung mindestens deine E-Mail-Adresse enthalten. +Damit dein Knoten durch Topographieprogramme erfasst werden kann, gib bitte deine Geokoordinaten oder +zumindest deine Straße und Hausnummer unter Standort an.]])) + +c = m:section(NamedSection, "contact", "public") + +c:option(Value, "nickname", translate("nickname", "Pseudonym")) +c:option(Value, "name", translate("name", "Name")) +c:option(Value, "mail", translate("mail", "E-Mail"), translate("mail1", "Bitte unbedingt angeben!")) +c:option(Value, "phone", translate("phone", "Telefon")) +c:option(Value, "location", translate("location", "Standort")) +c:option(Value, "geo", translate("coord", "Koordinaten"), translate("coord1", "Bitte als Breite;Länge (z.B: 51.5;12.9) angeben")) +c:option(Value, "note", translate("note", "Notiz")) + +return m \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/admin_index/freifunk.lua b/modules/freifunk/src/model/cbi/admin_index/freifunk.lua new file mode 100644 index 0000000000..ec4d100b87 --- /dev/null +++ b/modules/freifunk/src/model/cbi/admin_index/freifunk.lua @@ -0,0 +1,23 @@ +-- Todo: Translate +m = Map("freifunk", "Freifunk") + +s = m:section(NamedSection, "routing", "settings", "Netzverkehr") +s:option(Flag, "internal", "Freifunk zulassen", "immer aktivieren!") +s:option(Flag, "internet", "Internet zulassen") + +c = m:section(NamedSection, "community", "public", "Gemeinschaft", [[Dies sind die Grundeinstellungen +für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konfiguration +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") + +return m \ No newline at end of file diff --git a/modules/freifunk/src/model/menu/10freifunk.lua b/modules/freifunk/src/model/menu/10freifunk.lua new file mode 100644 index 0000000000..3adbe89858 --- /dev/null +++ b/modules/freifunk/src/model/menu/10freifunk.lua @@ -0,0 +1,18 @@ +add("public", "index", "Übersicht", 10) +act("contact", "Kontakt") + +add("public", "status", "Status", 20) +act("routes", "Routingtabelle") +act("iwscan", "WLAN-Scan") + +add("public", "olsr", "OLSR", 30) +act("routes", "Routen") +act("topology", "Topologie") +act("hna", "HNA") +act("mid", "MID") + + +sel("admin", "index") +act("wizard", "Freifunkassistent") +act("contact", "Kontakt") +act("freifunk", "Freifunk") \ No newline at end of file diff --git a/modules/freifunk/src/view/public_index/contact.htm b/modules/freifunk/src/view/public_index/contact.htm new file mode 100644 index 0000000000..221dc89ccc --- /dev/null +++ b/modules/freifunk/src/view/public_index/contact.htm @@ -0,0 +1,13 @@ +<%+header%> +<% local contact = ffluci.model.uci.sections("freifunk").contact %> +

<%:contact Kontakt%>

+ + + + + + + + +
<%:nickname Pseudonym%>:<%=contact.nickname%>
<%:name Name%>:<%=contact.name%>
<%:mail E-Mail%>:<%=contact.mail%>
<%:phone Telefon%>:<%=contact.phone%>
<%:location Standort%>:<%=contact.location%>
<%:geocoord Geokoordinaten%>:<%=contact.geo%>
<%:note Notiz%>:<%=contact.note%>
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_index/index.htm b/modules/freifunk/src/view/public_index/index.htm new file mode 100644 index 0000000000..6c7fe85883 --- /dev/null +++ b/modules/freifunk/src/view/public_index/index.htm @@ -0,0 +1,11 @@ +<%+header%> +<% local ff = ffluci.model.uci.sections("freifunk") %> +

<%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!

+

<%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%>
+<%:public2 Dies ist der Zugangspunkt %><%=ffluci.sys.hostname()%>. <%:public3 Er wird betrieben von %> +<%=ff.contact.nickname%>.

+

<%:public4 Weitere Informationen zur globalen Freifunkinitiative findest du unter%> Freifunk.net.
+<%:public5 Hast du Interesse an diesem Projekt, dann wende dich an deine lokale Gemeinschaft%> <%=ff.community.name%>.

+

<%:note Hinweis%>: <%:public6 Der Internetzugang über das experimentelle Freifunknetz ist an technische und organisatorische Bedingungen geknüpft und deshalb möglicherweise +nicht (immer) gewährleistet.%>

+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/error_olsr.htm b/modules/freifunk/src/view/public_olsr/error_olsr.htm new file mode 100644 index 0000000000..25426f50d7 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/error_olsr.htm @@ -0,0 +1,6 @@ +<%+header%> +

<%:olsr OLSR%>

+

<%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%>

+

<%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet +und das Plugin "txtinfo" geladen sein.%>

+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/hna.htm b/modules/freifunk/src/view/public_olsr/hna.htm new file mode 100644 index 0000000000..c13369f426 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/hna.htm @@ -0,0 +1,17 @@ +<%+header%> +

<%:olsrhna OLSR-HNA%>

+
+ + + + + +<% for k, route in ipairs(routes) do %> + + + + +<% end %> +
<%:destination Ziel%><%:gateway Gateway%>
<%=route.Network%>/<%=route.Netmask%><%=route.Gateway%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/index.htm b/modules/freifunk/src/view/public_olsr/index.htm new file mode 100644 index 0000000000..0633d1f456 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/index.htm @@ -0,0 +1,43 @@ +<%+header%> +

<%:olsrlinks OLSR-Verbindungen%>

+

<%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%>

+
+ + + + + + + + +<% for k, link in ipairs(links) do + local color = "#bb3333" + + link.ETX = tonumber(link.ETX) + if link.ETX == 0 then + color = "#bb3333" + elseif link.ETX < 4 then + color = "#00cc00" + elseif link.ETX < 10 then + color = "#ffcb05" + elseif link.ETX < 100 then + color = "#ff6600" + end +%> + + + + + + + +<% end %> +
<%:destination Ziel%><%:local Lokal%>LQNLQETX
"><%=link["remote IP"]%><%=link["Local IP"]%><%=link.LinkQuality%><%=link.NLQ%><%=link.ETX%>
+
+

<%:legend Legende%>:

+ +<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/mid.htm b/modules/freifunk/src/view/public_olsr/mid.htm new file mode 100644 index 0000000000..6553237ea5 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/mid.htm @@ -0,0 +1,17 @@ +<%+header%> +

<%:olsrmid OLSR-MID%>

+
+ + + + + +<% for k, mid in ipairs(mids) do %> + + + + +<% end %> +
<%:node Knoten%><%:aliases Aliasse%>
<%=mid.IP%><%=mid.Aliases%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/routes.htm b/modules/freifunk/src/view/public_olsr/routes.htm new file mode 100644 index 0000000000..f3a0fd3366 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/routes.htm @@ -0,0 +1,36 @@ +<%+header%> +

<%:olsrlinks OLSR-Routen%>

+
+ + + + + + + + +<% for k, route in ipairs(routes) do + local color = "#bb3333" + + route.ETX = tonumber(route.ETX) + if route.ETX == 0 then + color = "#bb3333" + elseif route.ETX < 4 then + color = "#00cc00" + elseif route.ETX < 10 then + color = "#ffcb05" + elseif route.ETX < 100 then + color = "#ff6600" + end +%> + + + + + + + +<% end %> +
<%:destination Ziel%><%:gateway Gateway%><%:interface Schnittstelle%><%:metric Metrik%>ETX
<%=route.Destination%><%=route.Gateway%><%=route.Interface%><%=route.Metric%><%=route.ETX%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/topology.htm b/modules/freifunk/src/view/public_olsr/topology.htm new file mode 100644 index 0000000000..c622026d48 --- /dev/null +++ b/modules/freifunk/src/view/public_olsr/topology.htm @@ -0,0 +1,23 @@ +<%+header%> +

<%:olsrtopo OLSR-Topologie%>

+
+ + + + + + + + +<% for k, route in ipairs(routes) do %> + + + + + + + +<% end %> +
<%:destination Ziel%><%:lasthop Letzter Router%>LQILQETX
"><%=route["Destination IP"]%>"><%=route["Last hop IP"]%><%=route.LQ%><%=route.ILQ%><%=route.ETX%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_status/index.htm b/modules/freifunk/src/view/public_status/index.htm new file mode 100644 index 0000000000..be0b96888b --- /dev/null +++ b/modules/freifunk/src/view/public_status/index.htm @@ -0,0 +1,59 @@ +<%+header%> +

<%:status Status%>

+

<%:system System%>

+ +
+ + + + + + + + + + + + + +
<%:system_type Systemtyp%>:<%=s%>
<%:cpu Prozessor%>:<%=m%>
<%:ram Hauptspeicher%>:<%=r%>
+

+ +

<%:wifi Drahtlos%>

+
+ + + + + + + + + + + + + +<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwconfig")%> +
<%:name Name%><%:protocol Protokoll%><%:frequency Frequenz%><%:power Leistung%><%:bitrate Bitrate%><%:rts RTS%><%:frag Frag.%><%:link Verb.%><%:signal Signal%><%:noise Rausch%>
+
+
+

<%:defroutes Standardrouten%>

+
+ + + + + + +<% +for i, rt in pairs(routes) do +%> + + +<% end %> +
<%:gateway Gateway%><%:metric Metrik%><%:iface Schnittstelle%>
<%=ffluci.sys.net.hexip4(rt.Gateway)%> +<%=rt.Metric%> +<%=rt.Iface%> +
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_status/iwscan.htm b/modules/freifunk/src/view/public_status/iwscan.htm new file mode 100644 index 0000000000..a8924c8925 --- /dev/null +++ b/modules/freifunk/src/view/public_status/iwscan.htm @@ -0,0 +1,21 @@ +<%+header%> +

<%:iwscan WLAN-Scan%>

+

<%:iwscan1 Drahtlosnetzwerke in der lokalen Umgebung des Routers:%>

+ +
+ + + + + + + + + + + + +<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwscan")%> +
<%:interface Schnittstelle%><%:essid ESSID%><%:bssid BSSID%><%:mode Modus%><%:channel Kanal%><%:encr Vers.%><%:link Verb.%><%:signal Signal%><%:noise Rausch%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_status/routes.htm b/modules/freifunk/src/view/public_status/routes.htm new file mode 100644 index 0000000000..85b02212d7 --- /dev/null +++ b/modules/freifunk/src/view/public_status/routes.htm @@ -0,0 +1,28 @@ +<%+header%> +

<%:routes Routen%>

+ +
+ + + + + + + + +<% +local routes = ffluci.sys.net.routes() + +for i, r in pairs(routes) do +%> + + + + + + + +<% end %> +
<%:target Ziel%><%:netmask Netzmaske%><%:gateway Gateway%><%:metric Metrik%><%:iface Schnittstelle%>
<%=ffluci.sys.net.hexip4(r.Destination)%><%=ffluci.sys.net.hexip4(r.Mask)%><%=ffluci.sys.net.hexip4(r.Gateway)%><%=r.Metric%><%=r.Iface%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/sudo_status/iwconfig.htm b/modules/freifunk/src/view/sudo_status/iwconfig.htm new file mode 100644 index 0000000000..6f5dede700 --- /dev/null +++ b/modules/freifunk/src/view/sudo_status/iwconfig.htm @@ -0,0 +1,21 @@ +<% +ffluci.http.prepare_content("text/plain") +for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do +%> + +<%=k%> +<%=v[1]%> +<%=v.Frequency%> +<%=v["Tx-Power"]%> +<%=v["Bit Rate"]%> +<%=v["RTS thr"]%> +<%=v["Fragment thr"]%> +<%=v["Link Quality"]%> +<%=v["Signal level"]%> +<%=v["Noise level"]%> + + +ESSID: <%=v.ESSID%> +BSSID: <%=(v.Cell or v["Access Point"])%> + +<%end%> diff --git a/modules/freifunk/src/view/sudo_status/iwscan.htm b/modules/freifunk/src/view/sudo_status/iwscan.htm new file mode 100644 index 0000000000..6f321ae9e2 --- /dev/null +++ b/modules/freifunk/src/view/sudo_status/iwscan.htm @@ -0,0 +1,22 @@ +<% +ffluci.http.prepare_content("text/plain") +for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do + for i, cell in ipairs(cells) do +%> + +<%=iface%> +<%=cell.ESSID%> +<%=cell.Address%> +<%=cell.Mode%> +<%=(cell.Channel or cell.Frequency or "")%> +<%=cell["Encryption key"]%> +<%=cell.Quality%> +<%=cell["Signal level"]%> +<%=cell["Noise level"]%> + +<% + end +end +%> + +