From 2718c09cbc425e6f81a44afb5af10d043dbdaca5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 23 Feb 2022 17:49:05 -0800 Subject: [PATCH] BirdLGGo: remove inaccurate "hops not responding" parsing --- BirdLGGo/README.md | 2 ++ BirdLGGo/parsetrace.py | 6 +----- BirdLGGo/parsetrace_test.py | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/BirdLGGo/README.md b/BirdLGGo/README.md index 8a93bc8..2ce6f6c 100644 --- a/BirdLGGo/README.md +++ b/BirdLGGo/README.md @@ -7,6 +7,8 @@ First configure the following variables: - `plugins.birdlggo.lgserver` - point this to your looking glass server (e.g. `http://lg.highdef.dn42/`) - `plugins.birdlggo.nodes` - a space separated list of nodes to query. These should use internal server names (as shown in request URLs to the frontend), not the display names that the frontend shows in the navigation bar. +In the bird-lg-go proxy settings I recommend enabling `BIRDLG_TRACEROUTE_RAW`, as only Linux's native traceroute format is fully supported. + ## Usage Currently this provides a slimmed down UI for traceroute and BIRD's `show route`: diff --git a/BirdLGGo/parsetrace.py b/BirdLGGo/parsetrace.py index 94d09a7..2d33449 100644 --- a/BirdLGGo/parsetrace.py +++ b/BirdLGGo/parsetrace.py @@ -43,14 +43,10 @@ def parse_traceroute(text): hops.append(TraceHop(ip, ptr)) latency = m.group("latency") - # bird-lg-go specific truncation - if "hops not responding" in ''.join(notes): - latency = None - return TraceResult(hops, latency, notes) if __name__ == '__main__': - proc = subprocess.run(['traceroute', *sys.argv[1:]], encoding='utf-8', stdout=subprocess.PIPE) + proc = subprocess.run(['traceroute', *sys.argv[1:]], check=False, encoding='utf-8', stdout=subprocess.PIPE) print(parse_traceroute(proc.stdout)) if proc.returncode: diff --git a/BirdLGGo/parsetrace_test.py b/BirdLGGo/parsetrace_test.py index fe5b39b..3fb90c8 100644 --- a/BirdLGGo/parsetrace_test.py +++ b/BirdLGGo/parsetrace_test.py @@ -123,7 +123,8 @@ traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets def testTracerouteTimedOutTruncated(self): - # bird-lg-go specific - set latency to None in this case + # bird-lg-go specific - ignore the "hops not responding message" since the sum + # counts ALL hops, even those in between s = """ traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets 1 172.31.1.1 (172.31.1.1) 6.362 ms @@ -145,7 +146,7 @@ traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets TraceHop(ip='85.10.250.209', ptr='core11.nbg1.hetzner.com'), TraceHop(ip='213.239.245.254', ptr='core1.fra.hetzner.com'), TraceHop(ip='104.44.197.103', ptr='hetzner.fra-96cbe-1a.ntwk.msn.net')], - notes=["23 hops not responding."]), parse_traceroute(s)) + notes=["23 hops not responding."], latency="8.055 ms"), parse_traceroute(s)) def testTracerouteNoDNS(self): s = """