From 822d54cd3d647bd22c81b8d2e4a56abdd7a086a1 Mon Sep 17 00:00:00 2001 From: tamihiro Date: Sun, 9 Jun 2019 21:31:38 +0900 Subject: [PATCH] Prevent 4-byte AS capability from being treated like it is ASN Bird displays neighbor's 4-byte AS capability as `AS4`. This patch prevents it from being treated as an clickable ASN in the output of `show protocols all` response. --- lg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lg.py b/lg.py index 40caa95..b8f829c 100644 --- a/lg.py +++ b/lg.py @@ -76,7 +76,7 @@ def add_links(text): ret_text.append(re.sub(r'(\d+)', r'\1', line)) else: line = re.sub(r'([a-zA-Z0-9\-]*\.([a-zA-Z]{2,3}){1,2})(\s|$)', r'\1\3', line) - line = re.sub(r'AS(\d+)', r'AS\1', line) + line = re.sub(r'(?<=\[)AS(\d+)', r'AS\1', line) line = re.sub(r'(\d+\.\d+\.\d+\.\d+)', r'\1', line) if len(request.path) >= 2: hosts = "/".join(request.path.split("/")[2:])