]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: PointToPoint neighbors are identified by router ID
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Fri, 25 Apr 2014 12:36:16 +0000 (14:36 +0200)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 15:33:33 +0000 (15:33 +0000)
According to RFC 2328, section 10.5  PointToPoint neighbors
should be identified by router ID instead of source IP address.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
(cherry picked from commit 5c1791f28e2e831e4e9b92c3c2f7d8ed832cb968)

ospfd/ospf_neighbor.c

index 83f91ad5399849ec7da02b2c10caade260f12e07..36251655a7474d32d24cadb2147fcbf2d45afcf4 100644 (file)
@@ -47,8 +47,8 @@
 
 /* Fill in the the 'key' as appropriate to retrieve the entry for nbr
  * from the ospf_interface's nbrs table. Indexed by interface address
- * for all cases except Virtual-link interfaces, where neighbours are
- * indexed by router-ID instead.
+ * for all cases except Virtual-link and PointToPoint interfaces, where
+ * neighbours are indexed by router-ID instead.
  */
 static void
 ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr,
@@ -58,7 +58,8 @@ ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr,
   key->prefixlen = IPV4_MAX_BITLEN;
 
   /* vlinks are indexed by router-id */
-  if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+  if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+      oi->type == OSPF_IFTYPE_POINTOPOINT)
     key->u.prefix4 = nbr->router_id;
   else
     key->u.prefix4 = nbr->src;
@@ -295,8 +296,8 @@ ospf_nbr_count_opaque_capable (struct ospf_interface *oi)
 #endif /* HAVE_OPAQUE_LSA */
 
 /* lookup nbr by address - use this only if you know you must
- * otherwise use the ospf_nbr_lookup() wrapper, which deals 
- * with virtual link neighbours
+ * otherwise use the ospf_nbr_lookup() wrapper, which deals
+ * with virtual link and PointToPoint neighbours
  */
 struct ospf_neighbor *
 ospf_nbr_lookup_by_addr (struct route_table *nbrs,
@@ -388,7 +389,8 @@ struct ospf_neighbor *
 ospf_nbr_lookup (struct ospf_interface *oi, struct ip *iph,
                  struct ospf_header *ospfh)
 {
-  if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+  if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+      oi->type == OSPF_IFTYPE_POINTOPOINT)
     return (ospf_nbr_lookup_by_routerid (oi->nbrs, &ospfh->router_id));
   else
     return (ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src));
@@ -448,8 +450,9 @@ ospf_nbr_get (struct ospf_interface *oi, struct ospf_header *ospfh,
   key.family = AF_INET;
   key.prefixlen = IPV4_MAX_BITLEN;
 
-  if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
-    key.u.prefix4 = ospfh->router_id;   /* index vlink nbrs by router-id */
+  if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+      oi->type == OSPF_IFTYPE_POINTOPOINT)
+    key.u.prefix4 = ospfh->router_id;/* index vlink and ptp nbrs by router-id */
   else
     key.u.prefix4 = iph->ip_src;