diff --git a/.gitignore b/.gitignore index 35a04d9..0f42dec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc aliases.json +nodedb/ diff --git a/alfred.py b/alfred.py index 63296c9..6d926bb 100755 --- a/alfred.py +++ b/alfred.py @@ -38,5 +38,5 @@ class alfred: if __name__ == "__main__": ad = alfred() - al = ad.alias() + al = ad.aliases() print(al) diff --git a/bat2nodes.py b/bat2nodes.py index 8e6d738..921b548 100755 --- a/bat2nodes.py +++ b/bat2nodes.py @@ -49,7 +49,7 @@ if options['mesh']: bm = batman(mesh_interface) db.parse_vis_data(bm.vis_data(options['alfred'])) for gw in bm.gateway_list(): - db.mark_gateways(gw.mac) + db.mark_gateways(gw['mac']) else: bm = batman() db.parse_vis_data(bm.vis_data(options['alfred'])) diff --git a/batman.py b/batman.py index fac2a9e..c9b3db6 100755 --- a/batman.py +++ b/batman.py @@ -59,6 +59,8 @@ class batman: gw.append({'mac': own_mac, 'bandwidth': gw_mode['bandwidth']}) for line in lines: gw_line = line.split() + if (gw_line[0] == 'No'): + continue # When in client gateway mode maybe gw_line[0] is not the right. gw.append({'mac':gw_line[0], 'bandwidth': gw_line[-1]}) return gw diff --git a/nodedb.py b/nodedb.py index 25c0e8c..fa9caed 100644 --- a/nodedb.py +++ b/nodedb.py @@ -182,7 +182,7 @@ class NodeDB: if 'name' in alias: node.name = alias['name'] - if 'vpn' in alias and alias['vpn']: + if 'vpn' in alias and alias['vpn'] and mac and node.interfaces and mac in node.interfaces: node.interfaces[mac].vpn = True if 'gps' in alias: @@ -202,6 +202,7 @@ class NodeDB: try: node = self.maybe_node_by_mac((gateway, )) except: + print("WARNING: did not find gateway '",gateway,"' in node list") continue node.flags['gateway'] = True