Support for "bat-ffhh" interface, add generate_aliases_v2.py
This commit is contained in:
parent
209271cbf7
commit
325f6cd1f4
8 changed files with 146 additions and 81 deletions
|
@ -96,7 +96,3 @@ if __name__ == "__main__":
|
|||
bc = Batman()
|
||||
vd = bc.vis_data()
|
||||
gw = bc.gateway_list()
|
||||
for x in vd:
|
||||
print(x)
|
||||
print(gw)
|
||||
print(bc.gateway_mode())
|
||||
|
|
|
@ -25,7 +25,6 @@ def mark_vpn(graph, vpn_macs):
|
|||
components = map(frozenset, nx.weakly_connected_components(graph))
|
||||
components = filter(vpn_macs.intersection, components)
|
||||
nodes = reduce(lambda a, b: a | b, components, set())
|
||||
|
||||
for node in nodes:
|
||||
for k, v in graph[node].items():
|
||||
v['vpn'] = True
|
||||
|
|
15
lib/nodes.py
15
lib/nodes.py
|
@ -6,6 +6,10 @@ from functools import reduce
|
|||
def build_mac_table(nodes):
|
||||
macs = dict()
|
||||
for node_id, node in nodes.items():
|
||||
try:
|
||||
macs[node['network']['mac']] = node_id
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
for mac in node['nodeinfo']['network']['mesh_interfaces']:
|
||||
macs[mac] = node_id
|
||||
|
@ -23,6 +27,11 @@ def build_mac_table(nodes):
|
|||
macs[mac] = node_id
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
for mac in node['nodeinfo']['network']['mesh']['bat-ffhh']['interfaces']['tunnel']:
|
||||
macs[mac] = node_id
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
for mac in node['nodeinfo']['network']['mesh']['bat0']['interfaces']['other']:
|
||||
|
@ -145,6 +154,11 @@ def import_mesh_ifs_vis_data(nodes, vis_data):
|
|||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
ifs = ifs.union(set(node['nodeinfo']['network']['mesh']['bat-ffhh']['interfaces']['tunnel']))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
ifs = ifs.union(set(node['nodeinfo']['network']['mesh']['bat0']['interfaces']['other']))
|
||||
except KeyError:
|
||||
|
@ -166,7 +180,6 @@ def import_vis_clientcount(nodes, vis_data):
|
|||
def mark_gateways(nodes, gateways):
|
||||
macs = build_mac_table(nodes)
|
||||
gateways = filter(lambda d: d in macs, gateways)
|
||||
|
||||
for node in map(lambda d: nodes[macs[d]], gateways):
|
||||
node['flags']['gateway'] = True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue