]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2005-11-20 Paul Jakma <paul.jakma@sun.com>
authorpaul <paul>
Sun, 20 Nov 2005 14:54:12 +0000 (14:54 +0000)
committerpaul <paul>
Sun, 20 Nov 2005 14:54:12 +0000 (14:54 +0000)
        * ospf_abr.c: (ospf_abr_announce_network_to_area) check
          returned LSA of ospf_summary_lsa_refresh and print warning if
          it failed.
          (ospf_abr_announce_network_to_area) similar
          (ospf_abr_announce_rtr_to_area) similar
        * ospf_lsa.c: (ospf_router_lsa_new) check LSA returned is valid.
          (ospf_router_lsa_originate) similar
          (ospf_router_lsa_refresh, ospf_network_lsa_new) similar
          (ospf_summary_lsa_new) Check ID is valid.
          (ospf_summary_lsa_originate) ditto, and check returned LSA from
           previous function is !NULL.
          (ospf_summary_lsa_refresh) check ospf_summary_lsa_new return
           is !NULL.
          (ospf_summary_asbr_lsa_new) ID valid check.
          (ospf_summary_asbr_lsa_originate) similar.

ospfd/ChangeLog
ospfd/ospf_abr.c
ospfd/ospf_lsa.c

index 08a3fcb5bcbf6b3d753e380696473f1569298897..d202e29ceb62cf888f666b1dbf85eea94722c36d 100644 (file)
           timer needed.
         * ospf_zebra.c: (ospf_router_id_update_zebra) call
           ospf_router_id_update directly, not via timer.  
+        * ospf_abr.c: (ospf_abr_announce_network_to_area) check
+          returned LSA of ospf_summary_lsa_refresh and print warning if
+          it failed.
+          (ospf_abr_announce_network_to_area) similar
+          (ospf_abr_announce_rtr_to_area) similar 
+        * ospf_lsa.c: (ospf_router_lsa_new) check LSA returned is valid.
+          (ospf_router_lsa_originate) similar
+          (ospf_router_lsa_refresh, ospf_network_lsa_new) similar  
+          (ospf_summary_lsa_new) Check ID is valid.
+          (ospf_summary_lsa_originate) ditto, and check returned LSA from
+           previous function is !NULL.
+          (ospf_summary_lsa_refresh) check ospf_summary_lsa_new return
+           is !NULL.
+          (ospf_summary_asbr_lsa_new) ID valid check.
+          (ospf_summary_asbr_lsa_originate) similar.
 
 2005-11-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
index 2d47efec1305f5ba9222eab335c9bc7369b6fdba..8f365da77cfdd810a65f0e7b0fd0f720955b40f3 100644 (file)
@@ -748,6 +748,19 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
                        "refreshing summary");
           set_metric (old, cost);
           lsa = ospf_summary_lsa_refresh (area->ospf, old);
+          
+          if (!lsa)
+            {
+             char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+             
+             prefix2str ((struct prefix *) p, buf, sizeof(buf));
+             zlog_warn ("%s: Could not refresh %s to %s",
+                        __func__,
+                        buf,
+                        inet_ntoa (area->area_id));
+             return;
+           }
+         
           SET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
           /* This will flood through area. */
         }
@@ -760,6 +773,18 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
       lsa = ospf_summary_lsa_originate ( (struct prefix_ipv4 *)p, cost, area);
           /* This will flood through area. */
       
+      if (!lsa)
+       {
+         char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+         
+         prefix2str ((struct prefix *)p, buf, sizeof(buf));
+         zlog_warn ("%s: Could not originate %s to %s",
+                    __func__,
+                    buf,
+                    inet_ntoa (area->area_id));
+         return;
+       }
+      
       SET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("ospf_abr_announce_network_to_area(): "
@@ -1117,10 +1142,22 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
        }
       else
        lsa = ospf_summary_asbr_lsa_originate (p, cost, area);
-
+      if (!lsa)
+        {
+          char buf[INET_ADDRSTRLEN + 3]; /* ipv4 and /XX */
+          
+          prefix2str ((struct prefix *)p, buf, sizeof(buf));
+          zlog_warn ("%s: Could not refresh/originate %s to %s",
+                     __func__,
+                     buf,
+                     inet_ntoa (area->area_id));
+          return;
+        }
+      
       if (IS_DEBUG_OSPF_EVENT)
        zlog_debug ("ospf_abr_announce_rtr_to_area(): "
                   "flooding new version of summary");
+
       /*
       zlog_info ("ospf_abr_announce_rtr_to_area(): creating new summary");
       lsa = ospf_summary_asbr_lsa (p, cost, area, old); */
index 31b9a4f19846a6e73464e920625164ad909ccf57..ff018fd4c9523ef61a0853ed6c1fc701b812764f 100644 (file)
@@ -830,7 +830,12 @@ ospf_router_lsa_new (struct ospf_area *area)
   lsah->length = htons (length);
 
   /* Now, create OSPF LSA instance. */
-  new = ospf_lsa_new ();
+  if ( (new = ospf_lsa_new ()) == NULL)
+    {
+      zlog_err ("%s: Unable to create new lsa", __func__);
+      return NULL;
+    }
+  
   new->area = area;
   SET_FLAG (new->flags, OSPF_LSA_SELF);
 
@@ -849,7 +854,11 @@ ospf_router_lsa_originate (struct ospf_area *area)
   struct ospf_lsa *new;
   
   /* Create new router-LSA instance. */
-  new = ospf_router_lsa_new (area);
+  if ( (new = ospf_router_lsa_new (area)) == NULL)
+    {
+      zlog_err ("%s: ospf_router_lsa_new returned NULL", __func__);
+      return NULL;
+    }
 
   /* Sanity check. */
   if (new->data->adv_router.s_addr == 0)
@@ -893,7 +902,12 @@ ospf_router_lsa_refresh (struct ospf_lsa *lsa)
   ospf_ls_retransmit_delete_nbr_area (area, lsa);
 
   /* Create new router-LSA instance. */
-  new = ospf_router_lsa_new (area);
+  if ( (new = ospf_router_lsa_new (area)) == NULL)
+    {
+      zlog_err ("%s: ospf_router_lsa_new returned NULL", __func__);
+      return NULL;
+    }
+  
   new->data->ls_seqnum = lsa_seqnum_increment (lsa);
 
   ospf_lsa_install (area->ospf, NULL, new);
@@ -1075,7 +1089,12 @@ ospf_network_lsa_new (struct ospf_interface *oi)
   lsah->length = htons (length);
 
   /* Create OSPF LSA instance. */
-  new = ospf_lsa_new ();
+  if ( (new = ospf_lsa_new ()) == NULL)
+    {
+      zlog_err ("%s: ospf_lsa_new returned NULL", __func__);
+      return NULL;
+    }
+  
   new->area = oi->area;
   SET_FLAG (new->flags, OSPF_LSA_SELF);
 
@@ -1242,6 +1261,15 @@ ospf_summary_lsa_new (struct ospf_area *area, struct prefix *p,
   struct lsa_header *lsah;
   int length;
 
+  if (id.s_addr == 0xffffffff)
+    {
+      /* Maybe Link State ID not available. */
+      if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
+        zlog_debug ("LSA[Type%d]: Link ID not available, can't originate",
+                    OSPF_SUMMARY_LSA);
+      return NULL;
+    }
+
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     zlog_debug ("LSA[Type3]: Create summary-LSA instance");
 
@@ -1282,8 +1310,18 @@ ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
   
   id = ospf_lsa_unique_id (area->ospf, area->lsdb, OSPF_SUMMARY_LSA, p);
 
+  if (id.s_addr == 0xffffffff)
+    {
+      /* Maybe Link State ID not available. */
+      if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
+        zlog_debug ("LSA[Type%d]: Link ID not available, can't originate",
+                    OSPF_SUMMARY_LSA);
+      return NULL;
+    }
+  
   /* Create new summary-LSA instance. */
-  new = ospf_summary_lsa_new (area, (struct prefix *) p, metric, id);
+  if ( !(new = ospf_summary_lsa_new (area, (struct prefix *) p, metric, id)))
+    return NULL;
 
   /* Instlal LSA to LSDB. */
   new = ospf_lsa_install (area->ospf, NULL, new);
@@ -1318,7 +1356,10 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
   p.prefixlen = ip_masklen (sl->mask);
   new = ospf_summary_lsa_new (lsa->area, &p, GET_METRIC (sl->metric),
                              sl->header.id);
-
+  
+  if (!new)
+    return NULL;
+  
   new->data->ls_seqnum = lsa_seqnum_increment (lsa);
   
   /* Re-calculate checksum. */
@@ -1369,6 +1410,15 @@ ospf_summary_asbr_lsa_new (struct ospf_area *area, struct prefix *p,
   struct lsa_header *lsah;
   int length;
 
+  if (id.s_addr == 0xffffffff)
+    {
+      /* Maybe Link State ID not available. */
+      if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
+        zlog_debug ("LSA[Type%d]: Link ID not available, can't originate",
+                    OSPF_ASBR_SUMMARY_LSA);
+      return NULL;
+    }
+
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     zlog_debug ("LSA[Type3]: Create summary-LSA instance");
 
@@ -1409,8 +1459,19 @@ ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
   
   id = ospf_lsa_unique_id (area->ospf, area->lsdb, OSPF_ASBR_SUMMARY_LSA, p);
 
+  if (id.s_addr == 0xffffffff)
+    {
+      /* Maybe Link State ID not available. */
+      if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
+        zlog_debug ("LSA[Type%d]: Link ID not available, can't originate",
+                    OSPF_ASBR_SUMMARY_LSA);
+      return NULL;
+    }
+  
   /* Create new summary-LSA instance. */
   new = ospf_summary_asbr_lsa_new (area, (struct prefix *) p, metric, id);
+  if (!new)
+    return NULL;
 
   /* Install LSA to LSDB. */
   new = ospf_lsa_install (area->ospf, NULL, new);
@@ -1445,6 +1506,8 @@ ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
   p.prefixlen = ip_masklen (sl->mask);
   new = ospf_summary_asbr_lsa_new (lsa->area, &p, GET_METRIC (sl->metric),
                                   sl->header.id);
+  if (!new)
+    return NULL;
   
   new->data->ls_seqnum = lsa_seqnum_increment (lsa);