From 712a41b5fc19991ba23a22ad6f21a51dffc543d9 Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Tue, 21 May 2019 09:37:46 +0200 Subject: [PATCH] WIP: Babel Version --- Gopkg.toml | 4 ++++ respond/daemon/neighbours.go | 6 +++--- respond/daemon/nodeinfo.go | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index e5de329..9ad6c3c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -60,3 +60,7 @@ [[constraint]] name = "github.com/shirou/gopsutil" revision = "01487156ffd97029bd146658b44e4c0d06388d82" + +[[constraint]] + branch = "master" + name = "github.com/Vivena/babelweb2" diff --git a/respond/daemon/neighbours.go b/respond/daemon/neighbours.go index e5d491c..57eb8b3 100644 --- a/respond/daemon/neighbours.go +++ b/respond/daemon/neighbours.go @@ -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) diff --git a/respond/daemon/nodeinfo.go b/respond/daemon/nodeinfo.go index 6c3a5f9..f585f76 100644 --- a/respond/daemon/nodeinfo.go +++ b/respond/daemon/nodeinfo.go @@ -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) {