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
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
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
rm -rf feeds/
......@@ -27,11 +27,11 @@ cd backfire
## Configuring system
make menuconfig
* 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 )
(* Advanced configuration options for developers -> Toolchain options -> Build gdb )
* 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 !!!
* remove for 4MByte-flash devices: network -> ppp
......@@ -41,12 +41,12 @@ HT40 is supported since backfire revision 27441
#### Optional, to have HT40 in IBSS mode: Patching files
## cp ../qmp/patches/004-ibss.patch package/mac80211/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
## Kernel configuration
# 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 )
(* 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
#### POSTCONFIGURE:
#### POSTCONFIGURE:
after a second reboot (better wait a while) the system should be autoconfigured
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???
......
## 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 @@
local bmx6json = require("luci.model.bmx6json")
module("luci.controller.bmx6", package.seeall)
function index()
local place = {}
local place = {}
local ucim = require "luci.model.uci"
local uci = ucim.cursor()
-- checking if ignore is on
if uci:get("luci-bmx6","luci","ignore") == "1" then
return nil
end
-- getting value from uci database
local uci_place = uci:get("luci-bmx6","luci","place")
-- default values
if uci_place == nil then
place = {"bmx6"}
else
if uci_place == nil then
place = {"bmx6"}
else
local util = require "luci.util"
place = util.split(uci_place," ")
end
---------------------------
-- Starting with the pages
---------------------------
--- neighbours/descriptions (default)
entry(place,call("action_neighbours_j"),place[#place])
table.insert(place,"neighbours_nojs")
entry(place,call("action_neighbours_j"),place[#place])
table.insert(place,"neighbours_nojs")
entry(place, call("action_neighbours"), nil)
table.remove(place)
--- status (this is default one)
table.insert(place,"Status")
entry(place,call("action_status"),"Status")
entry(place,call("action_status"),"Status")
table.remove(place)
--- links
......@@ -64,56 +64,61 @@ function index()
entry(place,call("action_links"),"Links").leaf = true
table.remove(place)
-- Gateways
table.insert(place,"Gateways")
entry(place,call("action_gateways_j"),"Gateways").leaf = true
table.remove(place)
--- chat
table.insert(place,"Chat")
entry(place,call("action_chat"),"Chat")
entry(place,call("action_chat"),"Chat")
table.remove(place)
--- Graph
table.insert(place,"Graph")
table.insert(place,"Graph")
entry(place, template("bmx6/graph"), "Graph")
table.remove(place)
--- Topology (hidden)
table.insert(place,"topology")
table.insert(place,"topology")
entry(place, call("action_topology"), nil)
table.remove(place)
--- configuration (CBI)
table.insert(place,"Configuration")
entry(place, cbi("bmx6/main"), "Configuration").dependent=false
table.insert(place,"Advanced")
table.insert(place,"Advanced")
entry(place, cbi("bmx6/advanced"), "Advanced")
table.remove(place)
table.insert(place,"Interfaces")
table.insert(place,"Interfaces")
entry(place, cbi("bmx6/interfaces"), "Interfaces")
table.remove(place)
table.insert(place,"Plugins")
table.insert(place,"Plugins")
entry(place, cbi("bmx6/plugins"), "Plugins")
table.remove(place)
table.insert(place,"HNA")
table.insert(place,"HNA")
entry(place, cbi("bmx6/hna"), "HNA")
table.remove(place)
table.remove(place)
table.remove(place)
end
function action_status()
local status = bmx6json.get("status").status or nil
local interfaces = bmx6json.get("interfaces").interfaces or nil
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
luci.template.render("bmx6/status", {status=status,interfaces=interfaces})
end
end
function action_neighbours()
local orig_list = bmx6json.get("originators").originators or nil
......@@ -127,32 +132,32 @@ function action_neighbours()
local orig = nil
local name = ""
local ipv4 = ""
for _,o in ipairs(orig_list) do
orig = bmx6json.get("originators/"..o.name) or {}
desc = bmx6json.get("descriptions/"..o.name) or {}
if string.find(o.name,'.') then
name = luci.util.split(o.name,'.')[1]
else
name = o.name
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
for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do
if h ~= nil and string.find(h.address,"::ffff:") then
ipv4=string.gsub(h.address,"::ffff:","")
break
end
end
end
end
if ipv4 == "" then
if ipv4 == "" then
ipv4="0.0.0.0"
end
table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc})
end
......@@ -166,6 +171,11 @@ function action_neighbours_j()
luci.template.render("bmx6/neighbours_j", {link_non_js=link_non_js})
end
function action_gateways_j()
luci.template.render("bmx6/gateways_j", {})
end
function action_links(host)
local links = bmx6json.get("links", host)
local devlinks = {}
......@@ -178,11 +188,11 @@ function action_links(host)
end
for _,l in ipairs(links) do
l.globalId = luci.util.split(l.globalId,'.')[1]
table.insert(devlinks[l.viaDev],l)
table.insert(devlinks[l.viaDev],l)
end
end
luci.template.render("bmx6/links", {links=devlinks})
luci.template.render("bmx6/links", {links=devlinks})
end
function action_topology()
......@@ -202,7 +212,7 @@ function action_topology()
end
luci.http.write('{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+"))
local first2 = true
for i2,l in ipairs(links.links) do
......@@ -211,12 +221,12 @@ function action_topology()
else
luci.http.write(', ')
end
luci.http.write('{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
%{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate })
end
luci.http.write(']}')
end
......@@ -257,11 +267,11 @@ function action_chat()
fd = io.open(sms_path,"r")
chat[sender] = fd:read()
fd:close()
fd:close()
end
end
to_send = luci.http.formvalue("toSend")
to_send = luci.http.formvalue("toSend")
if to_send ~= nil and #to_send > 1 then
fd = io.open(send_file,"w")
fd:write(to_send)
......
......@@ -59,7 +59,7 @@ function get(field, host)
if json_url[1] == "http" then
raw,err = wget(url..field,1000)
else
else
if json_url[1] == "exec" then
raw = sys.exec(json_url[2]..' '..field)
......@@ -78,11 +78,11 @@ function get(field, host)
data = decoder:get()
-- else
-- print_error("Cannot get data from bmx6 daemon",true)
-- return nil
-- return nil
end
return data
end
end
function print_error(txt,popup)
util.perror(txt)
......@@ -112,7 +112,7 @@ function wget(url, timeout)
if pid == 0 then
rfd:close()
nixio.dup(wfd, nixio.stdout)
local candidates = { "/usr/bin/wget", "/bin/wget" }
local _, bin
for _, bin in ipairs(candidates) do
......@@ -135,7 +135,7 @@ function wget(url, timeout)
err1 = "timeout"
break
end
local rv = rfd:read(4096)
if rv then
-- eof
......
......@@ -27,8 +27,8 @@ local http = require("luci.http")
local sys = require("luci.sys")
local options = bmx6json.get("options")
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"
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"
options = {}
else
options = options.OPTIONS
......@@ -41,17 +41,17 @@ local help = ""
local value = nil
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
help = ""
name = o.name
if o.help ~= nil then
help = bmx6json.text2html(o.help)
if o.help ~= nil then
help = bmx6json.text2html(o.help)
end
if o.syntax ~= nil then
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
if o.syntax ~= nil then
help = help .. "<br/><strong>Syntax: </strong>" .. bmx6json.text2html(o.syntax)
end
if o.def ~= nil then
......
......@@ -32,8 +32,8 @@ function hna_option:validate(value)
local err = sys.call('bmx6 -c --test -a ' .. value)
if err ~= 0 then
return nil
end
return value
end
return value
end
function m.on_commit(self,map)
......
......@@ -37,7 +37,7 @@ end
-- Getting json and looking for device section
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"
json = {}
else
......
......@@ -60,7 +60,7 @@ for _,o in ipairs(options) do
ipoptions = o.CHILD_OPTIONS
break
end
end
end
local help = ""
local name = ""
......
......@@ -26,7 +26,7 @@ plugins_dir = {"/usr/lib/","/var/lib","/lib"}
plugin = m:section(TypedSection,"plugin","Plugin")
plugin.addremove = true
plugin.anonymous = false
plv = plugin:option(ListValue,"plugin", "Plugin")
plv = plugin:option(ListValue,"plugin", "Plugin")
for _,d in ipairs(plugins_dir) do
pl = luci.sys.exec("cd "..d..";ls bmx6_*")
......
......@@ -17,7 +17,7 @@
td.innerHTML = '<em><br /><%:Some problem with JSON: lenght of originators and descriptions different. %></em>';
return 1;
}
if ( originators && descriptions && tb)
{
/* clear all rows */
......@@ -29,7 +29,7 @@
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
tr.insertCell(-1).innerHTML = descriptions[i].DESC_ADV.globalId.replace(/\.[^\.]+$/,"");
var extensions = descriptions[i].DESC_ADV.extensions;
//Looking for the extensions
......@@ -42,7 +42,7 @@
break;
}
}
//Adding first HNA with prefix=128 as main address
var ipstxt = '';
var address;
......@@ -60,13 +60,13 @@
}
tr.insertCell(-1).innerHTML = ipstxt;
tr.insertCell(-1).innerHTML = originators[i].viaDev;
tr.insertCell(-1).innerHTML = originators[i].metric;
tr.insertCell(-1).innerHTML = originators[i].lastDesc;
tr.insertCell(-1).innerHTML = originators[i].lastRef;
tr.insertCell(-1).innerHTML = originators[i].blocked;
}
if( tb.rows.length == 1 )
......
......@@ -21,7 +21,7 @@
<form action="." method="post">
<input type="text" name="toSend" />
<input type="submit" value="send sms" />
<input type="submit" value="send sms" />
</form>
<br />
......
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var displayExtraInfo = function ( id ) {
document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
}
XHR.poll(5, '/cgi-bin/bmx6-info', { 'descriptions/all': '' },
function(x, st)
{
var tb = document.getElementById('descriptions_table');
var rowcount = 0;
var tunicon = "<%=resource%>/icons/tunnel.png";
/* clear all rows */
while( tb.rows.length > 1 ) tb.deleteRow(1);
for ( var k in st )
{
var description = st[k].DESC_ADV;
var tun4in6;
for ( var k in description.extensions )
{
var value = description.extensions[k];
if ( value.TUN4IN6_NET_EXTENSION )
{
tun4in6 = value.TUN4IN6_NET_EXTENSION;
break;
}
}
if ( tun4in6 )
{
var nodename = description.globalId.replace(/\..+$/,'');
for( var i = 0; i < tun4in6.length; i++ )
{
var tr = tb.insertRow(-1);
var network = tun4in6[i].network;
var network_len = tun4in6[i].networklen;
var network_bw = tun4in6[i].bandwidth;
if ( network_len >= 32 ) continue;
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((rowcount++ % 2) + 1);
tr.insertCell(-1).innerHTML = String.format('<a href="/cgi-bin/bmx6control?function=gwselect&amp;node=%s"><img src="%s" /></a>',nodename,tunicon);
tr.insertCell(-1).innerHTML = nodename;
tr.insertCell(-1).innerHTML = network + '/' + network_len;
tr.insertCell(-1).innerHTML = network_bw;
}
if( tb.rows.length == 1 )
{
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:There are no gateways announced in the network.%></em>';
}
}
}
}
);
//]]></script>
<style>
div.hideme{
display: none;
}
div.info{
background: #FFF;
border: solid 1px;
height: 80px;
display: block;
overflow: auto;
}
div.inforow{
text-align:left;
display:inline-block;
width:20%;
margin:5px;
vertical-align:top;
}
#extra-info ul { list-style: none outside none; margin-left: 0em; }
</style>
<div class="cbi-map">
<h2>Originators</h2>
<div class="cbi-map-descr"></div>