From 49ab7b003bd19bac4be4461ae8fffd09a060126a Mon Sep 17 00:00:00 2001 From: TimStallard Date: Sun, 27 Jan 2019 19:56:17 +0000 Subject: [PATCH] Fix for internal routes via unselected hosts --- lg.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lg.py b/lg.py index cb79376..c51613b 100644 --- a/lg.py +++ b/lg.py @@ -688,7 +688,9 @@ def show_route(request_type, hosts, proto): detail = {} errors = [] - for host in hosts.split("+"): + hosts = hosts.split("+") + allhosts = hosts[:] + for host in allhosts: ret, res = bird_command(host, proto, command) res = res.split("\n") @@ -702,6 +704,15 @@ def show_route(request_type, hosts, proto): if bgpmap: detail[host] = build_as_tree_from_raw_bird_ouput(host, proto, res) + #for internal routes via hosts not selected + #add them to the list, but only show preferred route + if host not in hosts: + detail[host] = detail[host][:1] + for path in detail[host]: + if len(path) == 2: + if (path[1] not in allhosts) and (path[1] in app.config["PROXY"]): + allhosts.append(path[1]) + else: detail[host] = add_links(res)