Developing lightweight computation at the DSG edge

Commit 102b990b authored by p4u's avatar p4u
Browse files

Merge branch 'testing' into gsoc

parents 3dbf09af d5cf2c4a
...@@ -6,7 +6,7 @@ cd 13f ...@@ -6,7 +6,7 @@ cd 13f
git clone ssh://gitosis@qmp.cat:221/qmp.git; cd qmp; git checkout --track origin/autoconfig; cd .. git clone ssh://gitosis@qmp.cat:221/qmp.git; cd qmp; git checkout --track origin/autoconfig; cd ..
svn co -r 27617 svn://svn.openwrt.org/openwrt/branches/backfire svn co -r 27617 svn://svn.openwrt.org/openwrt/branches/backfire
git clone git://gitorious.org/eigennet/packages.git eigennet/packages git clone git://gitorious.org/eigennet/packages.git eigennet/packages
svn co -r 27617 svn://svn.openwrt.org/openwrt/packages packages svn co -r 27617 svn://svn.openwrt.org/openwrt/packages packages
cd backfire cd backfire
rm -rf feeds/ rm -rf feeds/
...@@ -27,11 +27,11 @@ cd backfire ...@@ -27,11 +27,11 @@ cd backfire
## Configuring system ## Configuring system
make menuconfig make menuconfig
* Target System (BCM947xxx, x86, atheros,...) * Target System (BCM947xxx, x86, atheros,...)
* Target Profile (WGT634u, wrap, alix, routerstation,...) * Target Profile (WGT634u, wrap, alix, routerstation,...)
(* Global build-settings -> Compile the kernel with profiling enabled ) (* Global build-settings -> Compile the kernel with profiling enabled )
(* Advanced configuration options for developers -> Toolchain options -> Build gdb ) (* Advanced configuration options for developers -> Toolchain options -> Build gdb )
* Base system -> * Base system ->
qmp-big-node # for 8Mbyte flash devices qmp-big-node # for 8Mbyte flash devices
qmp-small-node # for 4MByte flash devices STILL TO BIG ?? Needs testing on 4MB flash devices !!! qmp-small-node # for 4MByte flash devices STILL TO BIG ?? Needs testing on 4MB flash devices !!!
* remove for 4MByte-flash devices: network -> ppp * remove for 4MByte-flash devices: network -> ppp
...@@ -41,12 +41,12 @@ HT40 is supported since backfire revision 27441 ...@@ -41,12 +41,12 @@ HT40 is supported since backfire revision 27441
#### Optional, to have HT40 in IBSS mode: Patching files #### Optional, to have HT40 in IBSS mode: Patching files
## cp ../qmp/patches/004-ibss.patch package/mac80211/patches/ ## cp ../qmp/patches/004-ibss.patch package/mac80211/patches/
## cp ../qmp/patches/002-ibss_ht40.patch package/iw/patches/ ## cp ../qmp/patches/002-ibss_ht40.patch package/iw/patches/
## patch -p1 -i ../qmp/patches/mac80211.sh_ht40.patch package/mac80211/files/lib/wifi/mac80211.sh ## patch -p1 -i ../qmp/patches/mac80211.sh_ht40.patch package/mac80211/files/lib/wifi/mac80211.sh
## rm package/mac80211/patches/542-mac80211_enable_iftype_wds_aggregation.patch ## rm package/mac80211/patches/542-mac80211_enable_iftype_wds_aggregation.patch
## Kernel configuration ## Kernel configuration
# sometimes you have to run make (build backfire with default kernel) once before you can continue with make kernel_menuconfig # sometimes you have to run make (build backfire with default kernel) once before you can continue with make kernel_menuconfig
make kernel_menuconfig make kernel_menuconfig
(* File systems -> Dnotify support && Inotify file change notification support && Inotify support for userspace ) (* File systems -> Dnotify support && Inotify file change notification support && Inotify support for userspace )
(* General setup -> Configure standard kernel features (for small systems) -> Enable ELF core dumps ) (* General setup -> Configure standard kernel features (for small systems) -> Enable ELF core dumps )
...@@ -95,13 +95,13 @@ sysupgrade -n /tmp/openwrt-ar71xx-ubnt-rspro-squashfs-sysupgrade.bin ...@@ -95,13 +95,13 @@ sysupgrade -n /tmp/openwrt-ar71xx-ubnt-rspro-squashfs-sysupgrade.bin
#### POSTCONFIGURE: #### POSTCONFIGURE:
after a second reboot (better wait a while) the system should be autoconfigured after a second reboot (better wait a while) the system should be autoconfigured
ssh root@192.168.1.1 ssh root@192.168.1.1
to enforce a reconfiguration remove /qmp_configured to enforce a reconfiguration remove /qmp_configured
TODO: Which further options exist here??? TODO: Which further options exist here???
......
## AUTOCONF SYSTEM ##
- change option "name" for "essid"
- ESSID should depends on channel
- after removing /qmp_configured and having changed driver
to madwifi autoconf scripts system ignores that.
In fact the decision wheter it loads madwifi or mac80211
depends on whether the qmp/network option mesh_devices
has wlan* or ath* names in the list
- felix patches must be checked:
https://dev.openwrt.org/log/branches/backfire?rev=27441 and here:
https://dev.openwrt.org/log/branches/backfire/package/mac80211/files/lib/wifi
currently the patch instructions in the HOWTO fail!!!!!!
- Make sure firewall is really disabled !!!!!!!!!! ARGHHH!!!!!
DONE:
- The vlan problem with mac80211 drivers:
vlan interfaces for ath9k are created as vlan12@wlan1
NO vlan interfaces for ath5k devices are created.
Off the record:
## PAU ##
- this is off the record...
## AGUSTI ##
- Configuration eth0 in ipv4. Change 192.168.1.1 by default?
...@@ -23,40 +23,40 @@ ...@@ -23,40 +23,40 @@
local bmx6json = require("luci.model.bmx6json") local bmx6json = require("luci.model.bmx6json")
module("luci.controller.bmx6", package.seeall) module("luci.controller.bmx6", package.seeall)
function index() function index()
local place = {} local place = {}
local ucim = require "luci.model.uci" local ucim = require "luci.model.uci"
local uci = ucim.cursor() local uci = ucim.cursor()
-- checking if ignore is on -- checking if ignore is on
if uci:get("luci-bmx6","luci","ignore") == "1" then if uci:get("luci-bmx6","luci","ignore") == "1" then
return nil return nil
end end
-- getting value from uci database -- getting value from uci database
local uci_place = uci:get("luci-bmx6","luci","place") local uci_place = uci:get("luci-bmx6","luci","place")
-- default values -- default values
if uci_place == nil then if uci_place == nil then
place = {"bmx6"} place = {"bmx6"}
else else
local util = require "luci.util" local util = require "luci.util"
place = util.split(uci_place," ") place = util.split(uci_place," ")
end end
--------------------------- ---------------------------
-- Starting with the pages -- Starting with the pages
--------------------------- ---------------------------
--- neighbours/descriptions (default) --- neighbours/descriptions (default)
entry(place,call("action_neighbours_j"),place[#place]) entry(place,call("action_neighbours_j"),place[#place])
table.insert(place,"neighbours_nojs") table.insert(place,"neighbours_nojs")
entry(place, call("action_neighbours"), nil) entry(place, call("action_neighbours"), nil)
table.remove(place) table.remove(place)
--- status (this is default one) --- status (this is default one)
table.insert(place,"Status") table.insert(place,"Status")
entry(place,call("action_status"),"Status") entry(place,call("action_status"),"Status")
table.remove(place) table.remove(place)
--- links --- links
...@@ -64,56 +64,61 @@ function index() ...@@ -64,56 +64,61 @@ function index()
entry(place,call("action_links"),"Links").leaf = true entry(place,call("action_links"),"Links").leaf = true
table.remove(place) table.remove(place)
-- Gateways
table.insert(place,"Gateways")
entry(place,call("action_gateways_j"),"Gateways").leaf = true
table.remove(place)
--- chat --- chat
table.insert(place,"Chat") table.insert(place,"Chat")
entry(place,call("action_chat"),"Chat") entry(place,call("action_chat"),"Chat")
table.remove(place) table.remove(place)
--- Graph --- Graph
table.insert(place,"Graph") table.insert(place,"Graph")
entry(place, template("bmx6/graph"), "Graph") entry(place, template("bmx6/graph"), "Graph")
table.remove(place) table.remove(place)
--- Topology (hidden) --- Topology (hidden)
table.insert(place,"topology") table.insert(place,"topology")
entry(place, call("action_topology"), nil) entry(place, call("action_topology"), nil)
table.remove(place) table.remove(place)
--- configuration (CBI) --- configuration (CBI)
table.insert(place,"Configuration") table.insert(place,"Configuration")
entry(place, cbi("bmx6/main"), "Configuration").dependent=false entry(place, cbi("bmx6/main"), "Configuration").dependent=false
table.insert(place,"Advanced") table.insert(place,"Advanced")
entry(place, cbi("bmx6/advanced"), "Advanced") entry(place, cbi("bmx6/advanced"), "Advanced")
table.remove(place) table.remove(place)
table.insert(place,"Interfaces") table.insert(place,"Interfaces")
entry(place, cbi("bmx6/interfaces"), "Interfaces") entry(place, cbi("bmx6/interfaces"), "Interfaces")
table.remove(place) table.remove(place)
table.insert(place,"Plugins") table.insert(place,"Plugins")
entry(place, cbi("bmx6/plugins"), "Plugins") entry(place, cbi("bmx6/plugins"), "Plugins")
table.remove(place) table.remove(place)
table.insert(place,"HNA") table.insert(place,"HNA")
entry(place, cbi("bmx6/hna"), "HNA") entry(place, cbi("bmx6/hna"), "HNA")
table.remove(place) table.remove(place)
table.remove(place) table.remove(place)
end end
function action_status() function action_status()
local status = bmx6json.get("status").status or nil local status = bmx6json.get("status").status or nil
local interfaces = bmx6json.get("interfaces").interfaces or nil local interfaces = bmx6json.get("interfaces").interfaces or nil
if status == nil or interfaces == nil then if status == nil or interfaces == nil then
luci.template.render("bmx6/error", {txt="Cannot fetch data from bmx6 json"}) luci.template.render("bmx6/error", {txt="Cannot fetch data from bmx6 json"})
else else
luci.template.render("bmx6/status", {status=status,interfaces=interfaces}) luci.template.render("bmx6/status", {status=status,interfaces=interfaces})
end end
end end
function action_neighbours() function action_neighbours()
local orig_list = bmx6json.get("originators").originators or nil local orig_list = bmx6json.get("originators").originators or nil
...@@ -127,32 +132,32 @@ function action_neighbours() ...@@ -127,32 +132,32 @@ function action_neighbours()
local orig = nil local orig = nil
local name = "" local name = ""
local ipv4 = "" local ipv4 = ""
for _,o in ipairs(orig_list) do for _,o in ipairs(orig_list) do
orig = bmx6json.get("originators/"..o.name) or {} orig = bmx6json.get("originators/"..o.name) or {}
desc = bmx6json.get("descriptions/"..o.name) or {} desc = bmx6json.get("descriptions/"..o.name) or {}
if string.find(o.name,'.') then if string.find(o.name,'.') then
name = luci.util.split(o.name,'.')[1] name = luci.util.split(o.name,'.')[1]
else else
name = o.name name = o.name
end end
--Not sure about that, but trying to find main ipv4 from HNA6 published by each node --Not sure about that, but trying to find main ipv4 from HNA6 published by each node
if desc.DESC_ADV ~= nil then if desc.DESC_ADV ~= nil then
for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do
if h ~= nil and string.find(h.address,"::ffff:") then if h ~= nil and string.find(h.address,"::ffff:") then
ipv4=string.gsub(h.address,"::ffff:","") ipv4=string.gsub(h.address,"::ffff:","")
break break
end end
end end
end end
if ipv4 == "" then if ipv4 == "" then
ipv4="0.0.0.0" ipv4="0.0.0.0"
end end
table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc}) table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc})
end end
...@@ -166,6 +171,11 @@ function action_neighbours_j() ...@@ -166,6 +171,11 @@ function action_neighbours_j()
luci.template.render("bmx6/neighbours_j", {link_non_js=link_non_js}) luci.template.render("bmx6/neighbours_j", {link_non_js=link_non_js})
end end
function action_gateways_j()
luci.template.render("bmx6/gateways_j", {})
end
function action_links(host) function action_links(host)
local links = bmx6json.get("links", host) local links = bmx6json.get("links", host)
local devlinks = {} local devlinks = {}
...@@ -178,11 +188,11 @@ function action_links(host) ...@@ -178,11 +188,11 @@ function action_links(host)
end end
for _,l in ipairs(links) do for _,l in ipairs(links) do
l.globalId = luci.util.split(l.globalId,'.')[1] l.globalId = luci.util.split(l.globalId,'.')[1]
table.insert(devlinks[l.viaDev],l) table.insert(devlinks[l.viaDev],l)
end end
end end
luci.template.render("bmx6/links", {links=devlinks}) luci.template.render("bmx6/links", {links=devlinks})
end end
function action_topology() function action_topology()
...@@ -202,7 +212,7 @@ function action_topology() ...@@ -202,7 +212,7 @@ function action_topology()
end end
luci.http.write('{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+")) luci.http.write('{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+"))
local first2 = true local first2 = true
for i2,l in ipairs(links.links) do for i2,l in ipairs(links.links) do
...@@ -211,12 +221,12 @@ function action_topology() ...@@ -211,12 +221,12 @@ function action_topology()
else else
luci.http.write(', ') luci.http.write(', ')
end end
luci.http.write('{ "globalId": "%s", "rxRate": %s, "txRate": %s }' luci.http.write('{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
%{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate }) %{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate })
end end
luci.http.write(']}') luci.http.write(']}')
end end
...@@ -257,11 +267,11 @@ function action_chat() ...@@ -257,11 +267,11 @@ function action_chat()
fd = io.open(sms_path,"r") fd = io.open(sms_path,"r")
chat[sender] = fd:read() chat[sender] = fd:read()
fd:close() fd:close()
end end
end end
to_send = luci.http.formvalue("toSend") to_send = luci.http.formvalue("toSend")
if to_send ~= nil and #to_send > 1 then if to_send ~= nil and #to_send > 1 then
fd = io.open(send_file,"w") fd = io.open(send_file,"w")
fd:write(to_send) fd:write(to_send)
......
...@@ -59,7 +59,7 @@ function get(field, host) ...@@ -59,7 +59,7 @@ function get(field, host)
if json_url[1] == "http" then if json_url[1] == "http" then
raw,err = wget(url..field,1000) raw,err = wget(url..field,1000)
else else
if json_url[1] == "exec" then if json_url[1] == "exec" then
raw = sys.exec(json_url[2]..' '..field) raw = sys.exec(json_url[2]..' '..field)
...@@ -78,11 +78,11 @@ function get(field, host) ...@@ -78,11 +78,11 @@ function get(field, host)
data = decoder:get() data = decoder:get()
-- else -- else
-- print_error("Cannot get data from bmx6 daemon",true) -- print_error("Cannot get data from bmx6 daemon",true)
-- return nil -- return nil
end end
return data return data
end end
function print_error(txt,popup) function print_error(txt,popup)
util.perror(txt) util.perror(txt)
...@@ -112,7 +112,7 @@ function wget(url, timeout) ...@@ -112,7 +112,7 @@ function wget(url, timeout)
if pid == 0 then if pid == 0 then
rfd:close() rfd:close()
nixio.dup(wfd, nixio.stdout) nixio.dup(wfd, nixio.stdout)
local candidates = { "/usr/bin/wget", "/bin/wget" } local candidates = { "/usr/bin/wget", "/bin/wget" }
local _, bin local _, bin
for _, bin in ipairs(candidates) do for _, bin in ipairs(candidates) do
...@@ -135,7 +135,7 @@ function wget(url, timeout) ...@@ -135,7 +135,7 @@ function wget(url, timeout)
err1 = "timeout" err1 = "timeout"
break break
end end
local rv = rfd:read(4096) local rv = rfd:read(4096)
if rv then if rv then
-- eof -- eof
......
...@@ -27,8 +27,8 @@ local http = require("luci.http") ...@@ -27,8 +27,8 @@ local http = require("luci.http")
local sys = require("luci.sys") local sys = require("luci.sys")
local options = bmx6json.get("options") local options = bmx6json.get("options")
if options == nil or options.OPTIONS == nil then if options == nil or options.OPTIONS == nil then
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6" m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
options = {} options = {}
else else
options = options.OPTIONS options = options.OPTIONS
...@@ -41,17 +41,17 @@ local help = "" ...@@ -41,17 +41,17 @@ local help = ""
local value = nil local value = nil
local _,o local _,o
for _,o in ipairs(options) do for _,o in ipairs(options) do
if o.name ~= nil and o.CHILD_OPTIONS == nil and o.configurable == 1 then if o.name ~= nil and o.CHILD_OPTIONS == nil and o.configurable == 1 then
help = "" help = ""
name = o.name name = o.name
if o.help ~= nil then if o.help ~= nil then
help = bmx6json.text2html(o.help) help = bmx6json.text2html(o.help)
end end
if o.syntax ~= nil then if o.syntax ~= nil then
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax) help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
end end
if o.def ~= nil then if o.def ~= nil then
......
...@@ -32,8 +32,8 @@ function hna_option:validate(value) ...@@ -32,8 +32,8 @@ function hna_option:validate(value)
local err = sys.call('bmx6 -c --test -a ' .. value) local err = sys.call('bmx6 -c --test -a ' .. value)
if err ~= 0 then if err ~= 0 then
return nil return nil
end end
return value return value
end end
function m.on_commit(self,map) function m.on_commit(self,map)
......
...@@ -37,7 +37,7 @@ end ...@@ -37,7 +37,7 @@ end
-- Getting json and looking for device section -- Getting json and looking for device section
local json = bmx6json.get("options") local json = bmx6json.get("options")
if json == nil or json.OPTIONS == nil then if json == nil or json.OPTIONS == nil then
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6" m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
json = {} json = {}
else else
......
...@@ -60,7 +60,7 @@ for _,o in ipairs(options) do ...@@ -60,7 +60,7 @@ for _,o in ipairs(options) do
ipoptions = o.CHILD_OPTIONS