WIP: Babel Version

This commit is contained in:
Martin/Geno 2019-05-21 09:37:46 +02:00 committed by genofire
parent eefcc272f9
commit 712a41b5fc
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
3 changed files with 11 additions and 4 deletions

View File

@ -60,3 +60,7 @@
[[constraint]]
name = "github.com/shirou/gopsutil"
revision = "01487156ffd97029bd146658b44e4c0d06388d82"
[[constraint]]
branch = "master"
name = "github.com/Vivena/babelweb2"

View File

@ -32,12 +32,12 @@ func (d *Daemon) updateNeighbours(iface string, resp *data.ResponseData) {
resp.Neighbours.Babel = make(map[string]data.BabelNeighbours)
d.babelData.Iter(func(bu parser.BabelUpdate) error {
sbu := bu.ToSUpdate()
if sbu.TableId != "interface" {
if sbu.Table != "interface" {
return nil
}
if sbu.EntryData["up"].(bool) {
addr := sbu.EntryData["ipv6"].(string)
resp.Neighbours.Babel[string(sbu.EntryId)] = data.BabelNeighbours{
resp.Neighbours.Babel[string(sbu.Entry)] = data.BabelNeighbours{
Protocol: "babel",
LinkLocalAddress: addr,
Neighbours: make(map[string]data.BabelLink),
@ -48,7 +48,7 @@ func (d *Daemon) updateNeighbours(iface string, resp *data.ResponseData) {
d.babelData.Iter(func(bu parser.BabelUpdate) error {
sbu := bu.ToSUpdate()
if sbu.TableId != "neighbour" {
if sbu.Table != "neighbour" {
return nil
}
ifname, ok := sbu.EntryData["if"].(string)

View File

@ -56,6 +56,9 @@ func (d *Daemon) updateNodeinfo(iface string, resp *data.ResponseData) {
if v, err := ioutil.ReadFile("/sys/module/batman_adv/version"); err == nil {
resp.Nodeinfo.Software.BatmanAdv.Version = trim(string(v))
}
if babel := d.babelData; babel != nil {
resp.Nodeinfo.Software.Babeld.Version = babel.Version
}
if resp.Nodeinfo.Network.Mac == "" {
resp.Nodeinfo.Network.Mac = fmt.Sprintf("%s:%s:%s:%s:%s:%s", nodeID[0:2], nodeID[2:4], nodeID[4:6], nodeID[6:8], nodeID[8:10], nodeID[10:12])
@ -96,7 +99,7 @@ func (d *Daemon) updateNodeinfo(iface string, resp *data.ResponseData) {
d.babelData.Iter(func(bu babelParser.BabelUpdate) error {
sbu := bu.ToSUpdate()
if sbu.TableId != "interface" {
if sbu.Table != "interface" {
return nil
}
if sbu.EntryData["up"].(bool) {