Merge 5892f399d3
into 9711afaf69
This commit is contained in:
commit
d76a859d50
@ -13,7 +13,7 @@ define Package/gluon-mesh-batman-adv/common
|
||||
SECTION:=gluon
|
||||
CATEGORY:=Gluon
|
||||
PROVIDES:=gluon-mesh-batman-adv
|
||||
DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +gluon-ebtables +firewall +libiwinfo +kmod-dummy +libnl-tiny +libbatadv
|
||||
DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +gluon-ebtables +firewall +libiwinfo +kmod-dummy +libnl-tiny +libbatadv +libjson-c
|
||||
endef
|
||||
|
||||
define Package/gluon-mesh-batman-adv-14
|
||||
@ -43,6 +43,8 @@ define Package/gluon-mesh-batman-adv/common/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/respondd
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/status-page/providers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/neighbours-batadv $(1)/lib/gluon/status-page/providers/
|
||||
$(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/mesh-batman-adv.so
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/mesh-batman-adv
|
||||
|
@ -1,4 +1,4 @@
|
||||
all: respondd.so
|
||||
all: neighbours-batadv respondd.so
|
||||
|
||||
CFLAGS += -Wall
|
||||
|
||||
@ -9,6 +9,17 @@ ifeq ($(origin PKG_CONFIG), undefined)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(origin LIBJSONC_CFLAGS) $(origin LIBJSONC_LDLIBS), undefined undefined)
|
||||
LIBJSONC_NAME ?= json-c
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBJSONC_NAME) 2>/dev/null),)
|
||||
$(error No $(LIBJSONC_NAME) development libraries found!)
|
||||
endif
|
||||
LIBJSONC_CFLAGS += $(shell $(PkG_CONFIG) --cflags $(LIBJSONC_NAME))
|
||||
LIBJSONC_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBJSONC_NAME))
|
||||
endif
|
||||
CFLAGS += $(LIBJSONC_CFLAGS)
|
||||
LDLIBS += $(LIBJSONC_LDLIBS)
|
||||
|
||||
ifeq ($(origin LIBNL_CFLAGS) $(origin LIBNL_LDLIBS), undefined undefined)
|
||||
LIBNL_NAME ?= libnl-tiny
|
||||
ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBNL_NAME) 2>/dev/null),)
|
||||
@ -33,3 +44,7 @@ LDLIBS += $(LIBBATADV_LDLIBS)
|
||||
|
||||
respondd.so: respondd.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -D_GNU_SOURCE -o $@ $^ $(LDLIBS) -lgluonutil -liwinfo -luci
|
||||
|
||||
neighbours-batadv: neighbours-batadv.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -D_GNU_SOURCE -o $@ $^ $(LDLIBS)
|
||||
|
||||
|
@ -29,7 +29,6 @@ endef
|
||||
|
||||
define Package/gluon-status-page-api/install
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/status-page/providers
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/neighbours-batadv $(1)/lib/gluon/status-page/providers/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/stations $(1)/lib/gluon/status-page/providers/
|
||||
|
||||
$(INSTALL_DIR) $(1)/lib/gluon/respondd
|
||||
|
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo 'Access-Control-Allow-Origin: *'
|
||||
|
||||
CMD='exec /lib/gluon/status-page/providers/neighbours-babel'
|
||||
|
||||
exec /usr/sbin/sse-multiplex "$CMD"
|
@ -8,6 +8,6 @@ badrequest() {
|
||||
|
||||
echo 'Access-Control-Allow-Origin: *'
|
||||
|
||||
batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest
|
||||
ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"| grep -qxF "$QUERY_STRING" || badrequest
|
||||
|
||||
exec /usr/bin/gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo
|
||||
|
@ -8,7 +8,7 @@ badrequest() {
|
||||
|
||||
echo 'Access-Control-Allow-Origin: *'
|
||||
|
||||
batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest
|
||||
ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"| grep -qxF "$QUERY_STRING" || badrequest
|
||||
|
||||
CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'"
|
||||
|
||||
|
@ -29,10 +29,7 @@ ifeq ($(origin LIBBATADV_CFLAGS) $(origin LIBBATADV_LDLIBS), undefined undefined
|
||||
LIBBATADV_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBBATADV_NAME))
|
||||
endif
|
||||
|
||||
all: neighbours-batadv stations respondd.so
|
||||
|
||||
neighbours-batadv: neighbours-batadv.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LIBNL_CFLAGS) $(LIBBATADV_CFLAGS) $(LDFLAGS) $(LDFLAGS_JSONC) $(LIBNL_LDLIBS) $(LIBBATADV_LDLIBS) -Wall -o $@ $^ $(LDLIBS)
|
||||
all: stations respondd.so
|
||||
|
||||
stations: stations.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -Wall -o $@ $^ $(LDLIBS) -liwinfo
|
||||
|
@ -27,6 +27,8 @@ static struct json_object *get_stations(const struct iwinfo_ops *iw, const char
|
||||
json_object_object_add(station, "signal", json_object_new_int(entry->signal));
|
||||
json_object_object_add(station, "noise", json_object_new_int(entry->noise));
|
||||
json_object_object_add(station, "inactive", json_object_new_int(entry->inactive));
|
||||
json_object_object_add(station, "rx_rate", json_object_new_int(entry->rx_rate.rate));
|
||||
json_object_object_add(station, "tx_rate", json_object_new_int(entry->tx_rate.rate));
|
||||
|
||||
char macstr[18];
|
||||
|
||||
|
@ -77,11 +77,15 @@ function (Helper, SignalGraph, Signal) {
|
||||
tdSignal.textContent = signal
|
||||
tdInactive.textContent = Math.round(inactive / 1000) + " s"
|
||||
}
|
||||
|
||||
if ("batadv" in d)
|
||||
tdTQ.textContent = Math.round(d.batadv.tq / 2.55) + " %"
|
||||
else
|
||||
tdTQ.textContent = "‒"
|
||||
if ("batman-adv" in nodeInfo.software) {
|
||||
tdTQ.textContent = "TQ: " + Math.round(d.routingMetrics.tq / 2.55) + " %"
|
||||
}
|
||||
else if ("babeld" in nodeInfo.software) {
|
||||
tdTQ.textContent = "Cost: " + Math.round(d.routingMetrics.cost / 653.53) + " %"
|
||||
}
|
||||
else {
|
||||
tdTQ.textContent = "Unable to extract routing protocol from nodeInfo"
|
||||
}
|
||||
|
||||
if (infoSet)
|
||||
return
|
||||
@ -111,10 +115,11 @@ function (Helper, SignalGraph, Signal) {
|
||||
} catch (e) {
|
||||
tdDistance.textContent = "‒"
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
hostname.textContent = d.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Interface(parent, nodeInfo, iface, stream, mgmtBus) {
|
||||
var colors = graphColors.slice(0)
|
||||
@ -136,7 +141,7 @@ function (Helper, SignalGraph, Signal) {
|
||||
tr.appendChild(th)
|
||||
|
||||
th = document.createElement("th")
|
||||
th.textContent = "TQ"
|
||||
th.textContent = "Metrik"
|
||||
tr.appendChild(th)
|
||||
|
||||
th = document.createElement("th")
|
||||
|
@ -184,6 +184,10 @@ define(["lib/helper"], function (Helper) {
|
||||
function prettyPrefix(prefixes, step, d) {
|
||||
var prefix = 0
|
||||
|
||||
if (d == undefined) {
|
||||
d = 0
|
||||
}
|
||||
|
||||
while (d > step && prefix < prefixes.length - 1) {
|
||||
d /= step
|
||||
prefix++
|
||||
|
@ -64,15 +64,16 @@ define([ "bacon"
|
||||
})
|
||||
|
||||
var batadvStream = new Streams.Batadv(ip).toProperty({})
|
||||
var babelStream = new Streams.Babel(ip).toProperty({})
|
||||
|
||||
return Bacon.combineWith(combine, wifiStream
|
||||
, batadvStream.map(extractIfname)
|
||||
, Bacon.combineWith(Object.assign, batadvStream, babelStream).map(extractIfname)
|
||||
, nodesBus.map(".macs")
|
||||
)
|
||||
}
|
||||
|
||||
function combine(wifi, batadv, macs) {
|
||||
var interfaces = combineWithIfnames(wifi, batadv)
|
||||
function combine(wifi, routingMetrics, macs) {
|
||||
var interfaces = combineWithIfnames(wifi, routingMetrics)
|
||||
|
||||
for (var ifname in interfaces) {
|
||||
var stations = interfaces[ifname]
|
||||
@ -89,8 +90,8 @@ define([ "bacon"
|
||||
return interfaces
|
||||
}
|
||||
|
||||
function combineWithIfnames(wifi, batadv) {
|
||||
var ifnames = Object.keys(wifi).concat(Object.keys(batadv))
|
||||
function combineWithIfnames(wifi, routingMetrics) {
|
||||
var ifnames = Object.keys(wifi).concat(Object.keys(routingMetrics))
|
||||
|
||||
// remove duplicates
|
||||
ifnames.filter(function(e, i) {
|
||||
@ -100,21 +101,21 @@ define([ "bacon"
|
||||
var out = {}
|
||||
|
||||
ifnames.forEach(function (ifname) {
|
||||
out[ifname] = combineWifiBatadv(wifi[ifname], batadv[ifname])
|
||||
out[ifname] = combineWifiRoutingMetrics(wifi[ifname], routingMetrics[ifname])
|
||||
})
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
function combineWifiBatadv(wifi, batadv) {
|
||||
function combineWifiRoutingMetrics(wifi, routingMetrics) {
|
||||
var station
|
||||
var out = {}
|
||||
|
||||
for (station in batadv) {
|
||||
for (station in routingMetrics) {
|
||||
if (!(station in out))
|
||||
out[station] = {}
|
||||
|
||||
out[station].batadv = batadv[station]
|
||||
out[station].routingMetrics = routingMetrics[station]
|
||||
}
|
||||
|
||||
for (station in wifi) {
|
||||
|
@ -1,4 +1,7 @@
|
||||
"use strict"
|
||||
|
||||
|
||||
|
||||
define(["bacon", "lib/helper"], function(Bacon, Helper) {
|
||||
function nodeInfo(ip, ifname) {
|
||||
return Bacon.fromBinder(function (sink) {
|
||||
@ -43,6 +46,11 @@ define(["bacon", "lib/helper"], function(Bacon, Helper) {
|
||||
})
|
||||
}
|
||||
|
||||
function babel(ip) {
|
||||
var url = Helper.buildUrl(ip, "dyn/neighbours-babel")
|
||||
return simpleStream(url)
|
||||
}
|
||||
|
||||
function batadv(ip) {
|
||||
var url = Helper.buildUrl(ip, "dyn/neighbours-batadv")
|
||||
return simpleStream(url)
|
||||
@ -59,8 +67,9 @@ define(["bacon", "lib/helper"], function(Bacon, Helper) {
|
||||
}
|
||||
|
||||
return { nodeInfo: nodeInfo
|
||||
, Batadv: batadv
|
||||
, Stations: stations
|
||||
, Batadv: batadv
|
||||
, Babel: babel
|
||||
, Statistics: statistics
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user