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;
