From 967c721b86899b67614bb47277d4c9dc25cd5ab0 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Tue, 16 Jun 2020 15:39:55 +0200 Subject: [PATCH] bgpmap: fix regexp to match interface names with non-alphanumerical characters Commit eaf531eee21 ("Correctly parse aspath for both bird 1.x and 2.0.") inadvertently made a regexp more strict, and it no longer matches some interface names. Example include `eth1.945` (tagged VLAN, which is a common use-case for routers) or `br-foo`. As a result, the regexp would not parse the "peer protocol name" that is normally displayed on the bgpmap. Fixes: #64 --- lg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lg.py b/lg.py index 4a59d73..59cf17e 100644 --- a/lg.py +++ b/lg.py @@ -568,7 +568,7 @@ def build_as_tree_from_raw_bird_ouput(host, proto, text): net_dest = expr.group(1).strip() peer_protocol_name = expr.group(2).strip() - expr2 = re.search(r'(.*)via\s+([0-9a-fA-F:\.]+)\s+on\s+\w+(\s+\[(\w+)\s+)?', line) + expr2 = re.search(r'(.*)via\s+([0-9a-fA-F:\.]+)\s+on\s+\S+(\s+\[(\w+)\s+)?', line) if expr2: if path: path.append(net_dest)