diff --git a/lg.py b/lg.py
index 0913317..2c69953 100755
--- a/lg.py
+++ b/lg.py
@@ -361,9 +361,15 @@ def show_bgpmap():
nodes = {}
edges = {}
+ def escape(label):
+ label = label.replace("&", "&")
+ label = label.replace(">", ">")
+ label = label.replace("<", "<")
+ return label
+
def add_node(_as, **kwargs):
if _as not in nodes:
- kwargs["label"] = '<
' + kwargs.get("label", get_as_name(_as)).replace("\r"," ") + " |
>"
+ kwargs["label"] = '<' + escape(kwargs.get("label", get_as_name(_as))).replace("\r"," ") + " |
>"
nodes[_as] = pydot.Node(_as, style="filled", fontsize="10", **kwargs)
graph.add_node(nodes[_as])
return nodes[_as]
@@ -385,8 +391,9 @@ def show_bgpmap():
if "%s*" % label_without_star not in labels:
labels = [ kwargs["label"] ] + [ l for l in labels if not l.startswith(label_without_star) ]
labels = sorted(labels, cmp=lambda x,y: x.endswith("*") and -1 or 1)
-
- e.set_label("\r".join(labels))
+
+ label = escape("\r".join(labels))
+ e.set_label(label)
return edges[edge_tuple]
for host, asmaps in data.iteritems():