From aa68cd73c7ce132ff6d592675aea4a6f9aa02b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 15 Jan 2024 10:26:24 +0100 Subject: [PATCH] OSPF: Fix nasty bug when router-ids was converted to host routes Caused collision with the key (prefix) in the list --- board/netconf/rootfs/libexec/infix/yanger | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/board/netconf/rootfs/libexec/infix/yanger b/board/netconf/rootfs/libexec/infix/yanger index 142e0773..c8787e5f 100755 --- a/board/netconf/rootfs/libexec/infix/yanger +++ b/board/netconf/rootfs/libexec/infix/yanger @@ -194,10 +194,12 @@ def add_ospf_routes(ospf): data = run_json_cmd(cmd) routes=[] for prefix,info in data.items(): + if(prefix.find("/") == -1): # Ignore router IDs + continue + route={} - if prefix.find("/") == -1: - prefix = prefix+"/32" route["prefix"] = prefix + nexthops=[] routetype=info["routeType"].split(" ") if(len(routetype) > 1): @@ -207,10 +209,8 @@ def add_ospf_routes(ospf): route["route-type"] = "external-2" elif(routetype[1]=="IA"): route["route-type"] = "inter-area" - else: - route["route-type"] = "intra-area" - else: - route["route-type"] = "intra-area" + elif(routetype[0] == "N"): + route["route-type"] = "intra-area" for hop in info["nexthops"]: nexthop={} if(hop["ip"] != " "):