]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: Discriminate better when selecting links between vertices in SPF
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Mon, 27 Jul 2009 10:42:31 +0000 (12:42 +0200)
committerPaul Jakma <paul@quagga.net>
Thu, 30 Jul 2009 15:18:30 +0000 (16:18 +0100)
* ospf_spf.c: (ospf_get_next_link) One must check the vertex type, Router or
  Network, to select type link to match against.  Link type 1 has neighbour
  router ID in link_id and link type 2 has IP address of DR.  Since router
  id may have same value as an existing IP address one risks matching a
  router ID against a DR.

ospfd/ospf_spf.c

index 82f0fedda522c40834c00eba26bdb3935e330bf6..12afe5d99745c7396e752f08fb9a80a3c3557dc7 100644 (file)
@@ -369,8 +369,12 @@ ospf_get_next_link (struct vertex *v, struct vertex *w,
 {
   u_char *p;
   u_char *lim;
+  u_char lsa_type =  LSA_LINK_TYPE_TRANSIT;
   struct router_lsa_link *l;
 
+  if (w->type == OSPF_VERTEX_ROUTER)
+    lsa_type = LSA_LINK_TYPE_POINTOPOINT;
+
   if (prev_link == NULL)
     p = ((u_char *) v->lsa) + OSPF_LSA_HEADER_SIZE + 4;
   else
@@ -388,13 +392,7 @@ ospf_get_next_link (struct vertex *v, struct vertex *w,
 
       p += (ROUTER_LSA_MIN_SIZE + (l->m[0].tos_count * ROUTER_LSA_TOS_SIZE));
 
-      if (l->m[0].type == LSA_LINK_TYPE_STUB)
-        continue;
-
-      /* Defer NH calculation via VLs until summaries from
-         transit areas area confidered             */
-
-      if (l->m[0].type == LSA_LINK_TYPE_VIRTUALLINK)
+      if (l->m[0].type != lsa_type)
         continue;
 
       if (IPV4_ADDR_SAME (&l->link_id, &w->id))