]> git.puffer.fish Git - mirror/frr.git/commitdiff
SVN revisions 935-940 merge from Zebra CVS.
authorhasso <hasso>
Wed, 25 Aug 2004 09:10:37 +0000 (09:10 +0000)
committerhasso <hasso>
Wed, 25 Aug 2004 09:10:37 +0000 (09:10 +0000)
15 files changed:
ospf6d/ChangeLog
ospf6d/ospf6_abr.c
ospf6d/ospf6_abr.h
ospf6d/ospf6_area.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_flood.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_lsa.c
ospf6d/ospf6_lsa.h
ospf6d/ospf6_lsdb.c
ospf6d/ospf6_message.c
ospf6d/ospf6_route.c
ospf6d/ospf6_route.h
ospf6d/ospf6_top.c
ospf6d/ospf6d.h

index 43225bf24d1aaccc8ba43f5d7a199b60582cd2f0..e802e3292326d7524da15fd119abad44fb8b8cf7 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-19  Yasuhiro Ohara  <yasu@sfc.wide.ad.jp>
+
+       * ospf6_asbr.c: Bug in ASBR check fixed.
+       * ospf6d.h: version 0.9.7k
+
 2004-08-19  Yasuhiro Ohara  <yasu@sfc.wide.ad.jp>
 
        * ospf6_asbr.c: Bug in AS-External Origination fixed.
index e9dc238ac55f01b94250bcce5836528057c8b6fd..2d4b10f9798e00ca759761b2088525802d5a09f4 100644 (file)
@@ -499,6 +499,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
   u_int8_t prefix_options = 0;
   u_int32_t cost = 0;
   int i;
+  char buf[64];
 
   if (IS_OSPF6_DEBUG_ABR)
     zlog_info ("Examin %s in area %s", lsa->name, oa->name);
@@ -511,6 +512,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
       prefix.family = AF_INET6;
       prefix.prefixlen = prefix_lsa->prefix.prefix_length;
       ospf6_prefix_in6_addr (&prefix.u.prefix6, &prefix_lsa->prefix);
+      prefix2str (&prefix, buf, sizeof (buf));
       table = oa->ospf6->route_table;
       type = OSPF6_DEST_TYPE_NETWORK;
       prefix_options = prefix_lsa->prefix.prefix_options;
@@ -522,6 +524,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
       router_lsa = (struct ospf6_inter_router_lsa *)
         OSPF6_LSA_HEADER_END (lsa->header);
       ospf6_linkstate_prefix (router_lsa->router_id, htonl (0), &prefix);
+      inet_ntop (AF_INET, &router_lsa->router_id, buf, sizeof (buf));
       table = oa->ospf6->brouter_table;
       type = OSPF6_DEST_TYPE_ROUTER;
       options[0] = router_lsa->options[0];
@@ -532,15 +535,18 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
   else
     assert (0);
 
-  for (route = ospf6_route_lookup (&prefix, table);
-       route && ospf6_route_is_prefix (&prefix, route);
-       route = ospf6_route_next (route))
+  /* Find existing route */
+  route = ospf6_route_lookup (&prefix, table);
+  if (route)
+    ospf6_route_lock (route);
+  while (route && ospf6_route_is_prefix (&prefix, route))
     {
       if (route->path.area_id == oa->area_id &&
           route->path.origin.type == lsa->header->type &&
           route->path.origin.id == lsa->header->id &&
           route->path.origin.adv_router == lsa->header->adv_router)
         old = route;
+      route = ospf6_route_next (route);
     }
 
   /* (1) if cost == LSInfinity or if the LSA is MaxAge */
@@ -589,6 +595,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
   ospf6_linkstate_prefix (lsa->header->adv_router, htonl (0), &abr_prefix);
   abr_entry = ospf6_route_lookup (&abr_prefix, oa->ospf6->brouter_table);
   if (abr_entry == NULL || abr_entry->path.area_id != oa->area_id ||
+      CHECK_FLAG (abr_entry->flag, OSPF6_ROUTE_REMOVE) ||
       ! CHECK_FLAG (abr_entry->path.router_bits, OSPF6_ROUTER_BIT_B))
     {
       if (IS_OSPF6_DEBUG_ABR)
@@ -602,7 +609,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
      in the routing table. Always install the path by substituting
      old route (if any). */
   if (old)
-    route = old;
+    route = ospf6_route_copy (old);
   else
     route = ospf6_route_create ();
 
@@ -622,10 +629,45 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
     route->nexthop[i] = abr_entry->nexthop[i];
 
   if (IS_OSPF6_DEBUG_ABR)
-    zlog_info ("Install route");
+    zlog_info ("Install route: %s", buf);
   ospf6_route_add (route, table);
 }
 
+void
+ospf6_abr_examin_brouter (u_int32_t router_id)
+{
+  struct ospf6_lsa *lsa;
+  struct ospf6_area *oa;
+  listnode node;
+  u_int16_t type;
+
+  if (IS_OSPF6_DEBUG_ABR)
+    {
+      char buf[16];
+      inet_ntop (AF_INET, &router_id, buf, sizeof (buf));
+      zlog_info ("Router entry of %s changed", buf);
+      zlog_info ("Examin summary LSAs originated by the router");
+    }
+
+  type = htons (OSPF6_LSTYPE_INTER_ROUTER);
+  for (node = listhead (ospf6->area_list); node; nextnode (node))
+    {
+      oa = OSPF6_AREA (getdata (node));
+      for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
+           lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
+        ospf6_abr_examin_summary (lsa, oa);
+    }
+
+  type = htons (OSPF6_LSTYPE_INTER_PREFIX);
+  for (node = listhead (ospf6->area_list); node; nextnode (node))
+    {
+      oa = OSPF6_AREA (getdata (node));
+      for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
+           lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
+        ospf6_abr_examin_summary (lsa, oa);
+    }
+}
+
 \f
 /* Display functions */
 int
index 3257c734f76ef6590ff4145c7ad944e090629016..ce3c19a03054b38674fe2585ba6eaf06c90a59d0 100644 (file)
@@ -61,6 +61,7 @@ void ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
                                           struct ospf6_area *area);
 void ospf6_abr_originate_summary (struct ospf6_route *route);
 void ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa);
+void ospf6_abr_examin_brouter (u_int32_t router_id);
 
 int config_write_ospf6_debug_abr (struct vty *vty);
 void install_element_ospf6_debug_abr ();
index fc2103ca65fce8d5c608d96f6f02dc190d05a43c..312d88fe52e3a9f1d1633ede25159f8d2652acee 100644 (file)
@@ -68,6 +68,7 @@ ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa)
 
     case OSPF6_LSTYPE_INTER_PREFIX:
     case OSPF6_LSTYPE_INTER_ROUTER:
+      ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data);
       break;
 
     default:
@@ -94,6 +95,7 @@ ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa)
 
     case OSPF6_LSTYPE_INTER_PREFIX:
     case OSPF6_LSTYPE_INTER_ROUTER:
+      ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data);
       break;
 
     default:
index 7884a6bf64de32bd136a9c9414b8bae0ea6314de..3352465cfa3e594f75e01a3cff8c66fc3a132d67 100644 (file)
@@ -192,11 +192,8 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa)
       return;
     }
 
-  asbr_id.family = AF_INET;
-  asbr_id.prefixlen = 32;
-  asbr_id.u.prefix4.s_addr = lsa->header->adv_router;
+  ospf6_linkstate_prefix (lsa->header->adv_router, htonl (0), &asbr_id);
   asbr_entry = ospf6_route_lookup (&asbr_id, ospf6->brouter_table);
-
   if (asbr_entry == NULL)
     {
       if (IS_OSPF6_DEBUG_ASBR)
index 05112021c9c914e982017d66996593846c627f1b..660e63695b7a92112313c98dc8e2e8fc65f2a909 100644 (file)
@@ -220,7 +220,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa)
     }
 
   gettimeofday (&now, (struct timezone *) NULL);
-  if (ospf6_lsa_age_current (lsa) != MAXAGE)
+  if (! OSPF6_LSA_IS_MAXAGE (lsa))
     lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa,
                                     MAXAGE + lsa->birth.tv_sec - now.tv_sec);
   else
@@ -843,11 +843,17 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
             }
         }
 
+      gettimeofday (&new->received, (struct timezone *) NULL);
+
       if (IS_OSPF6_DEBUG_LSA (RECV))
         zlog_info ("Flood, Install, Possibly acknowledge the received LSA");
 
       /* (b) immediately flood and (c) remove from all retrans-list */
-      ospf6_flood (from, new);
+      /* Prevent self-originated LSA to be flooded. this is to make
+      reoriginated instance of the LSA not to be rejected by other routers
+      due to MinLSArrival. */
+      if (new->header->adv_router != from->ospf6_if->area->ospf6->router_id)
+        ospf6_flood (from, new);
 
       /* (c) Remove the current database copy from all neighbors' Link
              state retransmission lists. */
index 74a89642260266e74a34db610fa6ee644765eb00..8383fd9da1786110c4929b3352deb384b9249354 100644 (file)
@@ -1036,6 +1036,9 @@ ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa)
   char *start, *current, *end;
   char buf[64];
 
+  if (OSPF6_LSA_IS_MAXAGE (lsa))
+    return;
+
   if (IS_OSPF6_DEBUG_ROUTE (INTRA))
     zlog_info ("%s found", lsa->name);
 
@@ -1081,10 +1084,12 @@ ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa)
         break;
 
       route = ospf6_route_create ();
-      route->prefix.prefixlen = op->prefix_length;
+
+      memset (&route->prefix, 0, sizeof (struct prefix));
       route->prefix.family = AF_INET6;
-      memcpy (&route->prefix.u.prefix6, OSPF6_PREFIX_BODY (op),
-              OSPF6_PREFIX_SPACE (op->prefix_length));
+      route->prefix.prefixlen = op->prefix_length;
+      ospf6_prefix_in6_addr (&route->prefix.u.prefix6, op);
+
       route->type = OSPF6_DEST_TYPE_NETWORK;
       route->path.origin.type = lsa->header->type;
       route->path.origin.id = lsa->header->id;
@@ -1147,6 +1152,7 @@ ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa)
         break;
       prefix_num--;
 
+      memset (&prefix, 0, sizeof (struct prefix));
       prefix.family = AF_INET6;
       prefix.prefixlen = op->prefix_length;
       ospf6_prefix_in6_addr (&prefix.u.prefix6, op);
@@ -1246,6 +1252,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
   struct ospf6_route *lsentry, *copy;
   void (*hook_add) (struct ospf6_route *) = NULL;
   void (*hook_remove) (struct ospf6_route *) = NULL;
+  char buf[16];
 
   if (IS_OSPF6_DEBUG_ROUTE (INTRA))
     zlog_info ("Border-router calculation for area %s", oa->name);
@@ -1277,9 +1284,15 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
 
       copy = ospf6_route_copy (lsentry);
       copy->type = OSPF6_DEST_TYPE_ROUTER;
-      copy->prefix.family = AF_INET;
-      copy->prefix.prefixlen = 32;
+      copy->path.area_id = oa->area_id;
       ospf6_route_add (copy, oa->ospf6->brouter_table);
+
+      if (IS_OSPF6_DEBUG_ROUTE (INTRA))
+        {
+          inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&copy->prefix),
+                     buf, sizeof (buf));
+          zlog_info ("Re-install router entry %s", buf);
+        }
     }
 
   oa->ospf6->brouter_table->hook_add = hook_add;
@@ -1303,6 +1316,12 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
       else if (CHECK_FLAG (lsentry->flag, OSPF6_ROUTE_ADD) ||
                CHECK_FLAG (lsentry->flag, OSPF6_ROUTE_CHANGE))
         {
+          if (IS_OSPF6_DEBUG_ROUTE (INTRA))
+            {
+              inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&lsentry->prefix),
+                         buf, sizeof (buf));
+              zlog_info ("Call hook for router entry %s", buf);
+            }
           if (hook_add)
             (*hook_add) (lsentry);
         }
index 8eea002ea5dfb7a1953101a6db7d414d08cb3150..6c8341f7cf02947eb0448623f7b295cf0e82f847 100644 (file)
@@ -497,8 +497,9 @@ ospf6_lsa_copy (struct ospf6_lsa *lsa)
   assert (copy->lock == 0);
 
   copy->birth = lsa->birth;
-  copy->installed = lsa->installed;
   copy->originated = lsa->originated;
+  copy->received = lsa->received;
+  copy->installed = lsa->installed;
   copy->lsdb = lsa->lsdb;
 
   return copy;
index 961f11e1d7603193a4a2c515df7cdd38f12879ca..be284498a3f6a629925fbdda71dbe64e3892c811 100644 (file)
@@ -113,8 +113,9 @@ struct ospf6_lsa
   unsigned char     flag;           /* special meaning (e.g. floodback) */
 
   struct timeval    birth;          /* tv_sec when LS age 0 */
-  struct timeval    installed;      /* used by MinLSArrival check */
   struct timeval    originated;     /* used by MinLSInterval check */
+  struct timeval    received;       /* used by MinLSArrival check */
+  struct timeval    installed;
 
   struct thread    *expire;
   struct thread    *refresh;        /* For self-originated LSA */
index 247238b9adc289a9ad27e9605d483e04b877ba33..6cd633f554299922bb83bdc7f409b1e8a6cd1cd9 100644 (file)
@@ -174,6 +174,11 @@ ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb)
                   (*lsdb->hook_remove) (lsa);
                 }
             }
+          else if (OSPF6_LSA_IS_MAXAGE (old))
+            {
+              if (lsdb->hook_add)
+                (*lsdb->hook_add) (lsa);
+            }
           else
             {
               if (lsdb->hook_remove)
index 7e022da5597a79f8a15019580139f97f17980ea0..276c847d77bc01989efcb9c417e434963965b663 100644 (file)
@@ -557,19 +557,19 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
       if (mine == NULL)
         {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
-            zlog_info ("Add request (No database copy)", his->name);
+            zlog_info ("Add request (No database copy)");
           ospf6_lsdb_add (his, on->request_list);
         }
       else if (ospf6_lsa_compare (his, mine) < 0)
         {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
-            zlog_info ("Add request (Received MoreRecent)", his->name);
+            zlog_info ("Add request (Received MoreRecent)");
           ospf6_lsdb_add (his, on->request_list);
         }
       else
         {
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
-            zlog_info ("Discard (Existing MoreRecent)", his->name);
+            zlog_info ("Discard (Existing MoreRecent)");
           ospf6_lsa_delete (his);
         }
     }
index 1202a3aeaf76b07bdc718b03ebb8bc9a5ed062a9..dae9222658b17975de8cbdef4f20ee33324ceb62 100644 (file)
@@ -201,10 +201,25 @@ static void
 _route_count_assert (struct ospf6_route_table *table)
 {
   struct ospf6_route *debug;
+  char buf[64];
   int num = 0;
   for (debug = ospf6_route_head (table); debug;
        debug = ospf6_route_next (debug))
     num++;
+
+  if (num == table->count)
+    return;
+
+  zlog_info ("PANIC !! table[%p]->count = %d, real = %d",
+             table, table->count, num);
+  for (debug = ospf6_route_head (table); debug;
+       debug = ospf6_route_next (debug))
+    {
+      prefix2str (&debug->prefix, buf, sizeof (buf));
+      zlog_info ("%p %p %s", debug->prev, debug->next, buf);
+    }
+  zlog_info ("DUMP END");
+
   assert (num == table->count);
 }
 #define ospf6_route_count_assert(t) (_route_count_assert (t))
index 069502f5692c4ab70520868066cee5da91a166e6..3d3e1014fca4443769c8d290d8cf825e231e0e6c 100644 (file)
@@ -215,9 +215,9 @@ extern char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
 #define ospf6_linkstate_prefix_id(x) \
   (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
 
-#define ID_IN_PREFIX(x) \
-  (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
 #define ADV_ROUTER_IN_PREFIX(x) \
+  (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
+#define ID_IN_PREFIX(x) \
   (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
 
 /* Function prototype */
index 57103160ef6a2d1bbd4b9aad64796e437164470f..b031330f0a30791062ee4671532f2b39056d57ba 100644 (file)
@@ -100,15 +100,17 @@ ospf6_top_route_hook_remove (struct ospf6_route *route)
 void
 ospf6_top_brouter_hook_add (struct ospf6_route *route)
 {
-  ospf6_abr_originate_summary (route);
+  ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
   ospf6_asbr_lsentry_add (route);
+  ospf6_abr_originate_summary (route);
 }
 
 void
 ospf6_top_brouter_hook_remove (struct ospf6_route *route)
 {
-  ospf6_abr_originate_summary (route);
+  ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
   ospf6_asbr_lsentry_remove (route);
+  ospf6_abr_originate_summary (route);
 }
 
 struct ospf6 *
index 1b68a0fc9f2ecc2b0479626a29881e6dab765cac..b08d07c941b261ecdfe0e22b20fba575b7d82ecb 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef OSPF6D_H
 #define OSPF6D_H
 
-#define OSPF6_DAEMON_VERSION    "0.9.7j"
+#define OSPF6_DAEMON_VERSION    "0.9.7k"
 
 /* global variables */
 extern int errno;