# look for the line with the *, I think that's the "best" one or so
m=re.match(r'^\s+\*\s+([0-9a-f:]+)\s+([0-9.]+)s\s+\(\s*([0-9]+)\s*\)\s+([0-9a-f:]+)\s+\[\s*([a-zA-Z0-9-]+)\s*\]',line)# groups: originator, last-seen, throughput, next best hop, outgoing iface
ifmisNone:continue# spurious line, e.g. the header
ifm.group(1)==originator:
nextMAC=m.group(4)
nextIface=m.group(5)
ifnextMACisNoneornextIfaceisNone:
print("ERROR: Could not find originator in originator table.")
sys.exit(1)
print("Next hop is towards {} via {}.".format(nextMAC,nextIface))
ifnextIface!=domain+"VPN":
print("This client is connected via some other GW, cannot tell more from here.")
sys.exit(0)
# Next, ask the bridge for the port that this next hop is connected to