[quagga-dev 5410] Re: [PATCH] RFC 2328, chap 8.1:

Joakim Tjernlund joakim.tjernlund at transmode.se
Sun Jun 1 15:09:46 BST 2008


On Sun, 2008-06-01 at 14:50 +0100, paul at clubi.ie wrote:
> On Sun, 1 Jun 2008, Joakim Tjernlund wrote:
> 
> > Did a pass updating all callers to set AllSPRRouters as destination
> > for Ptp links. Dunno if this is what you want.
> 
> Cheers, thanks.
> 
> > Still waiting :)
> 
> The SNMP one? I'll try look at that in a bit. What others were there?

Yes, there was one more titled:
"[PATCH] Make ospf_if_lookup_recv_if() find the right unnumbered i/f"

I am working on modifying ospf_calculate_nexthop() too, not ready yet
but if you have some more time I really could use you feedback.
Patch last in this mail.

> 
> BTW, if possible, could you also update the ChangeLog in the 
> customary way? (If not, I'll do it, but it makes my life easier. And 
> yes, we should really let the SCM handle changelogs, but we'd need to 
> switch to a more modern SCM to be able to abolish the ChangeLog 
> files..).

I could try to remember, but on the other hand not doing it will
speed up the process of switching to a better SCM :)

Joke aside, did you know the git can emulate a CVS server? If you set
that up you can have both and let people migrate in their own pace.

 Jocke

>From e516aca71306320c5a5a5db7b75151eb7c5f8286 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Fri, 30 May 2008 10:15:35 +0200
Subject: [PATCH] First test in SPF for unnumbered links.

---
 ospfd/ospf_spf.c |   76 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 59 insertions(+), 17 deletions(-)

diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 23d45dd..6df8143 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -467,6 +467,22 @@ ospf_spf_add_parent (struct vertex *v, struct vertex *w,
 
   return;
 }
+/*
+ * Used for creating a temporary ordered list of pt-to-pt OSPF
+ * interfaces pointing at a common node.
+ * Sorted after increasing output interface cost.
+ */
+static
+int ospf_output_cost_cmp(void *v1, void *v2)
+{
+  struct ospf_interface *a1 = v1, *a2 = v2;
+
+  if (a1->output_cost > a2->output_cost)
+    return 1;
+  if (a1->output_cost < a2->output_cost)
+    return -1;
+  return 0;
+}
 
 /* 16.1.1.  Calculate nexthop from root through V (parent) to
  * vertex W (destination), with given distance from root->W.
@@ -573,24 +589,50 @@ ospf_nexthop_calculation (struct ospf_area *area, struct vertex *v,
               else
                 {
                   /* l is a regular point-to-point link.
-                     Look for a link from W to V.
+                     Look for a links from W to V.
                    */
-                  while ((l2 = ospf_get_next_link (w, v, l2)))
-                    {
-                      oi = ospf_if_is_configured (area->ospf,
-                                                  &(l2->link_data));
-
-                      if (oi == NULL)
-                        continue;
-
-                      if (!IPV4_ADDR_SAME (&oi->address->u.prefix4,
-                                           &l->link_data))
-                        continue;
-
-                      break;
-                    }
-                }
-
+		  struct ospf_interface *tmp_oi;
+		  struct listnode *node;
+		  struct list *oiflist;
+		  u_int32_t cost;
+		  struct in_addr match_id;
+
+		  oiflist = list_new();
+		  oiflist->cmp = ospf_output_cost_cmp;
+		  match_id = l->link_data;
+		  if (match_id.s_addr < 0x00ffffff) /* is ifIndex ? */
+		    match_id = l->link_id; /* yes, use RouterID instead */
+		  for (ALL_LIST_ELEMENTS_RO(area->ospf->oiflist, node, tmp_oi))
+		    if (tmp_oi->type == OSPF_IFTYPE_POINTOPOINT &&
+			tmp_oi->state != ISM_Down)
+		      {
+#if 0
+			if (IPV4_ADDR_SAME (&tmp_oi->address->u.prefix4,
+#elif 0
+			if (IPV4_ADDR_SAME (&tmp_oi->connected->address->u.prefix4,
+#else
+		        if (IPV4_ADDR_SAME (&tmp_oi->connected->destination->u.prefix4,
+#endif
+					    &match_id))
+			  listnode_add_sort(oiflist, oi); /* cheapest i/f first */
+		      }
+		  cost = OSPF_OUTPUT_COST_INFINITE;
+		  /* Only add the cheapest i/f's */
+		  for (ALL_LIST_ELEMENTS_RO(oiflist, node, tmp_oi))
+		    {
+		      if (tmp_oi->output_cost > cost)
+			break; /* Cost too high, drop out */
+		      cost = tmp_oi->output_cost;
+		      /* found all necessary info to build nexthop */
+		      nh = vertex_nexthop_new ();
+		      nh->oi = tmp_oi;
+		      nh->router.s_addr = 0; /* use l->link_data instead ? */
+		      ospf_spf_add_parent (v, w, nh, distance);
+		    }
+		  list_delete(oiflist);
+		  if (cost != OSPF_OUTPUT_COST_INFINITE)
+		    return 1;
+		}
               if (oi && l2)
                 {
                   /* found all necessary info to build nexthop */
-- 
1.5.5.1





More information about the Quagga-dev mailing list