On Wed, May 20, 2020 at 02:47:58PM +0000, Kenth Eriksson wrote:
> Upgraded from 2.0.4 to 2.0.7 and observed strange OSPF path
> computation. Re-tested against v2.0.5, same result. Any known issues in
> this area? 

This patch should fix the issue, could you try it?

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index b5787b54..2e17c4c9 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -395,12 +395,11 @@ px_pos_to_ifa(struct ospf_area *oa, int pos)
 static inline struct ospf_iface *
 rt_find_iface2(struct ospf_area *oa, uint data)
 {
-  ip_addr addr = ipa_from_u32(data);
-
   /* We should handle it differently for unnumbered PTP links */
   struct ospf_iface *ifa;
   WALK_LIST(ifa, oa->po->iface_list)
-    if ((ifa->oa == oa) && ifa->addr && (ipa_equal(ifa->addr->ip, addr)))
+    if ((ifa->oa == oa) && ifa->addr &&
+	(((ifa->addr->flags & IA_PEER) ? ifa->iface_id : ipa_to_u32(ifa->addr->ip)) == data))
       return ifa;
 
   return NULL;
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index c8ec730a..8c6b6103 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -804,7 +804,8 @@ prepare_rt2_lsa_body(struct ospf_proto *p, struct ospf_area *oa)
 	   * compatibility with some broken implementations that use
 	   * this address as a next-hop.
 	   */
-	  add_rt2_lsa_link(p, LSART_PTP, neigh->rid, ipa_to_u32(ifa->addr->ip), link_cost);
+	  u32 data = (ifa->addr->flags & IA_PEER) ? ifa->iface_id : ipa_to_u32(ifa->addr->ip);
+	  add_rt2_lsa_link(p, LSART_PTP, neigh->rid, data, link_cost);
 	  i++;
 	}
       break;

Attachment: signature.asc
Description: PGP signature

Reply via email to