Diff for /embedaddon/quagga/ospfd/ospf_lsa.c between versions 1.1 and 1.1.1.4

version 1.1, 2012/02/21 17:26:12 version 1.1.1.4, 2016/11/02 10:09:12
Line 50 Line 50
 #include "ospfd/ospf_ase.h"  #include "ospfd/ospf_ase.h"
 #include "ospfd/ospf_zebra.h"  #include "ospfd/ospf_zebra.h"
   
 u_int32_t  u_int32_t
 get_metric (u_char *metric)  get_metric (u_char *metric)
 {  {
Line 61  get_metric (u_char *metric) Line 61  get_metric (u_char *metric)
   return m;    return m;
 }  }
   
 struct timeval  struct timeval
 tv_adjust (struct timeval a)  tv_adjust (struct timeval a)
 {  {
Line 108  int2tv (int a) Line 108  int2tv (int a)
 }  }
   
 struct timeval  struct timeval
   msec2tv (int a)
   {
     struct timeval ret;
   
     ret.tv_sec = 0;
     ret.tv_usec = a * 1000;
   
     return tv_adjust (ret);
   }
   
   struct timeval
 tv_add (struct timeval a, struct timeval b)  tv_add (struct timeval a, struct timeval b)
 {  {
   struct timeval ret;    struct timeval ret;
Line 145  ospf_lsa_refresh_delay (struct ospf_lsa *lsa) Line 156  ospf_lsa_refresh_delay (struct ospf_lsa *lsa)
   quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);    quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
   delta = tv_sub (now, lsa->tv_orig);    delta = tv_sub (now, lsa->tv_orig);
   
  if (tv_cmp (delta, int2tv (OSPF_MIN_LS_INTERVAL)) < 0)  if (tv_cmp (delta, msec2tv (OSPF_MIN_LS_INTERVAL)) < 0)
     {      {
      delay = tv_ceil (tv_sub (int2tv (OSPF_MIN_LS_INTERVAL), delta));      delay = tv_ceil (tv_sub (msec2tv (OSPF_MIN_LS_INTERVAL), delta));
   
       if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))        if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
         zlog_debug ("LSA[Type%d:%s]: Refresh timer delay %d seconds",          zlog_debug ("LSA[Type%d:%s]: Refresh timer delay %d seconds",
Line 159  ospf_lsa_refresh_delay (struct ospf_lsa *lsa) Line 170  ospf_lsa_refresh_delay (struct ospf_lsa *lsa)
   return delay;    return delay;
 }  }
   
 int  int
 get_age (struct ospf_lsa *lsa)  get_age (struct ospf_lsa *lsa)
 {  {
Line 171  get_age (struct ospf_lsa *lsa) Line 182  get_age (struct ospf_lsa *lsa)
   return age;    return age;
 }  }
   
 /* Fletcher Checksum -- Refer to RFC1008. */  /* Fletcher Checksum -- Refer to RFC1008. */
   
 /* All the offsets are zero-based. The offsets in the RFC1008 are   /* All the offsets are zero-based. The offsets in the RFC1008 are 
Line 192  ospf_lsa_checksum (struct lsa_header *lsa) Line 203  ospf_lsa_checksum (struct lsa_header *lsa)
   return fletcher_checksum(buffer, len, checksum_offset);    return fletcher_checksum(buffer, len, checksum_offset);
 }  }
   
   int
   ospf_lsa_checksum_valid (struct lsa_header *lsa)
   {
     u_char *buffer = (u_char *) &lsa->options;
     int options_offset = buffer - (u_char *) &lsa->ls_age; /* should be 2 */
   
  /* Skip the AGE field */
   u_int16_t len = ntohs(lsa->length) - options_offset;
 
   return(fletcher_checksum(buffer, len, FLETCHER_CHECKSUM_VALIDATE) == 0);
 }
 
 
 
 /* Create OSPF LSA. */  /* Create OSPF LSA. */
 struct ospf_lsa *  struct ospf_lsa *
 ospf_lsa_new ()  ospf_lsa_new ()
Line 236  ospf_lsa_dup (struct ospf_lsa *lsa) Line 259  ospf_lsa_dup (struct ospf_lsa *lsa)
   new->refresh_list = -1;    new->refresh_list = -1;
   
   if (IS_DEBUG_OSPF (lsa, LSA))    if (IS_DEBUG_OSPF (lsa, LSA))
    zlog_debug ("LSA: duplicated %p (new: %p)", lsa, new);    zlog_debug ("LSA: duplicated %p (new: %p)", (void *)lsa, (void *)new);
   
   return new;    return new;
 }  }
Line 248  ospf_lsa_free (struct ospf_lsa *lsa) Line 271  ospf_lsa_free (struct ospf_lsa *lsa)
   assert (lsa->lock == 0);    assert (lsa->lock == 0);
       
   if (IS_DEBUG_OSPF (lsa, LSA))    if (IS_DEBUG_OSPF (lsa, LSA))
    zlog_debug ("LSA: freed %p", lsa);    zlog_debug ("LSA: freed %p", (void *)lsa);
   
   /* Delete LSA data. */    /* Delete LSA data. */
   if (lsa->data != NULL)    if (lsa->data != NULL)
Line 324  ospf_lsa_data_free (struct lsa_header *lsah) Line 347  ospf_lsa_data_free (struct lsa_header *lsah)
 {  {
   if (IS_DEBUG_OSPF (lsa, LSA))    if (IS_DEBUG_OSPF (lsa, LSA))
     zlog_debug ("LSA[Type%d:%s]: data freed %p",      zlog_debug ("LSA[Type%d:%s]: data freed %p",
               lsah->type, inet_ntoa (lsah->id), lsah);               lsah->type, inet_ntoa (lsah->id), (void *)lsah);
   
   XFREE (MTYPE_OSPF_LSA_DATA, lsah);    XFREE (MTYPE_OSPF_LSA_DATA, lsah);
 }  }
   
 /* LSA general functions. */  /* LSA general functions. */
   
 const char *  const char *
Line 381  lsa_header_set (struct stream *s, u_char options, Line 404  lsa_header_set (struct stream *s, u_char options,
   
   stream_forward_endp (s, OSPF_LSA_HEADER_SIZE);    stream_forward_endp (s, OSPF_LSA_HEADER_SIZE);
 }  }
   
   
   
 /* router-LSA related functions. */  /* router-LSA related functions. */
 /* Get router-LSA flags. */  /* Get router-LSA flags. */
 static u_char  static u_char
Line 556  lsa_link_broadcast_set (struct stream *s, struct ospf_ Line 579  lsa_link_broadcast_set (struct stream *s, struct ospf_
   /* Describe Type 3 Link. */    /* Describe Type 3 Link. */
   if (oi->state == ISM_Waiting)    if (oi->state == ISM_Waiting)
     {      {
         if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
           zlog_debug ("LSA[Type1]: Interface %s is in state Waiting. "
                       "Adding stub interface", oi->ifp->name);
       masklen2ip (oi->address->prefixlen, &mask);        masklen2ip (oi->address->prefixlen, &mask);
       id.s_addr = oi->address->u.prefix4.s_addr & mask.s_addr;        id.s_addr = oi->address->u.prefix4.s_addr & mask.s_addr;
       return link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,        return link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,
Line 568  lsa_link_broadcast_set (struct stream *s, struct ospf_ Line 594  lsa_link_broadcast_set (struct stream *s, struct ospf_
              IPV4_ADDR_SAME (&oi->address->u.prefix4, &DR (oi))) &&               IPV4_ADDR_SAME (&oi->address->u.prefix4, &DR (oi))) &&
       ospf_nbr_count (oi, NSM_Full) > 0)        ospf_nbr_count (oi, NSM_Full) > 0)
     {      {
         if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
           zlog_debug ("LSA[Type1]: Interface %s has a DR. "
                       "Adding transit interface", oi->ifp->name);
       return link_info_set (s, DR (oi), oi->address->u.prefix4,        return link_info_set (s, DR (oi), oi->address->u.prefix4,
                             LSA_LINK_TYPE_TRANSIT, 0, cost);                              LSA_LINK_TYPE_TRANSIT, 0, cost);
     }      }
   /* Describe type 3 link. */    /* Describe type 3 link. */
   else    else
     {      {
         if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
           zlog_debug ("LSA[Type1]: Interface %s has no DR. "
                       "Adding stub interface", oi->ifp->name);
       masklen2ip (oi->address->prefixlen, &mask);        masklen2ip (oi->address->prefixlen, &mask);
       id.s_addr = oi->address->u.prefix4.s_addr & mask.s_addr;        id.s_addr = oi->address->u.prefix4.s_addr & mask.s_addr;
       return link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,        return link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,
Line 670  router_lsa_link_set (struct stream *s, struct ospf_are Line 702  router_lsa_link_set (struct stream *s, struct ospf_are
         {          {
           if (oi->state != ISM_Down)            if (oi->state != ISM_Down)
             {              {
                 oi->lsa_pos_beg = links;
               /* Describe each link. */                /* Describe each link. */
               switch (oi->type)                switch (oi->type)
                 {                  {
Line 691  router_lsa_link_set (struct stream *s, struct ospf_are Line 724  router_lsa_link_set (struct stream *s, struct ospf_are
                 case OSPF_IFTYPE_LOOPBACK:                  case OSPF_IFTYPE_LOOPBACK:
                   links += lsa_link_loopback_set (s, oi);                     links += lsa_link_loopback_set (s, oi); 
                 }                  }
                 oi->lsa_pos_end = links;
             }              }
         }          }
     }      }
Line 723  ospf_router_lsa_body_set (struct stream *s, struct osp Line 757  ospf_router_lsa_body_set (struct stream *s, struct osp
   /* Set # of links here. */    /* Set # of links here. */
   stream_putw_at (s, putp, cnt);    stream_putw_at (s, putp, cnt);
 }  }
 static int  static int
 ospf_stub_router_timer (struct thread *t)  ospf_stub_router_timer (struct thread *t)
 {  {
Line 746  ospf_stub_router_timer (struct thread *t) Line 780  ospf_stub_router_timer (struct thread *t)
   return 0;    return 0;
 }  }
   
inline static voidstatic void
 ospf_stub_router_check (struct ospf_area *area)  ospf_stub_router_check (struct ospf_area *area)
 {  {
   /* area must either be administratively configured to be stub    /* area must either be administratively configured to be stub
Line 780  ospf_stub_router_check (struct ospf_area *area) Line 814  ospf_stub_router_check (struct ospf_area *area)
   OSPF_AREA_TIMER_ON (area->t_stub_router, ospf_stub_router_timer,    OSPF_AREA_TIMER_ON (area->t_stub_router, ospf_stub_router_timer,
                       area->ospf->stub_router_startup_time);                        area->ospf->stub_router_startup_time);
 }  }
  
 /* Create new router-LSA. */  /* Create new router-LSA. */
 static struct ospf_lsa *  static struct ospf_lsa *
 ospf_router_lsa_new (struct ospf_area *area)  ospf_router_lsa_new (struct ospf_area *area)
Line 865  ospf_router_lsa_originate (struct ospf_area *area) Line 899  ospf_router_lsa_originate (struct ospf_area *area)
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))    if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {      {
       zlog_debug ("LSA[Type%d:%s]: Originate router-LSA %p",        zlog_debug ("LSA[Type%d:%s]: Originate router-LSA %p",
                 new->data->type, inet_ntoa (new->data->id), new);                 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);        ospf_lsa_header_dump (new->data);
     }      }
   
Line 982  ospf_router_lsa_update (struct ospf *ospf) Line 1016  ospf_router_lsa_update (struct ospf *ospf)
   return 0;    return 0;
 }  }
   
 /* network-LSA related functions. */  /* network-LSA related functions. */
 /* Originate Network-LSA. */  /* Originate Network-LSA. */
 static void  static void
Line 1100  ospf_network_lsa_update (struct ospf_interface *oi) Line 1134  ospf_network_lsa_update (struct ospf_interface *oi)
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))    if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {      {
       zlog_debug ("LSA[Type%d:%s]: Originate network-LSA %p",        zlog_debug ("LSA[Type%d:%s]: Originate network-LSA %p",
                 new->data->type, inet_ntoa (new->data->id), new);                 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);        ospf_lsa_header_dump (new->data);
     }      }
   
Line 1161  ospf_network_lsa_refresh (struct ospf_lsa *lsa) Line 1195  ospf_network_lsa_refresh (struct ospf_lsa *lsa)
   
   return new;    return new;
 }  }
 static void  static void
 stream_put_ospf_metric (struct stream *s, u_int32_t metric_value)  stream_put_ospf_metric (struct stream *s, u_int32_t metric_value)
 {  {
Line 1277  ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_i Line 1311  ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_i
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))    if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {      {
       zlog_debug ("LSA[Type%d:%s]: Originate summary-LSA %p",        zlog_debug ("LSA[Type%d:%s]: Originate summary-LSA %p",
                 new->data->type, inet_ntoa (new->data->id), new);                 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);        ospf_lsa_header_dump (new->data);
     }      }
   
Line 1320  ospf_summary_lsa_refresh (struct ospf *ospf, struct os Line 1354  ospf_summary_lsa_refresh (struct ospf *ospf, struct os
   return new;    return new;
 }  }
   
 /* summary-ASBR-LSA related functions. */  /* summary-ASBR-LSA related functions. */
 static void  static void
 ospf_summary_asbr_lsa_body_set (struct stream *s, struct prefix *p,  ospf_summary_asbr_lsa_body_set (struct stream *s, struct prefix *p,
                                 u_int32_t metric)                                  u_int32_t metric)
 {  {
   struct in_addr mask;  
   
   masklen2ip (p->prefixlen, &mask);  
   
   /* Put Network Mask. */    /* Put Network Mask. */
  stream_put_ipv4 (s, mask.s_addr);  stream_put_ipv4 (s, (u_int32_t) 0);
   
   /* Set # TOS. */    /* Set # TOS. */
   stream_putc (s, (u_char) 0);    stream_putc (s, (u_char) 0);
Line 1424  ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p Line 1454  ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))    if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {      {
       zlog_debug ("LSA[Type%d:%s]: Originate summary-ASBR-LSA %p",        zlog_debug ("LSA[Type%d:%s]: Originate summary-ASBR-LSA %p",
                 new->data->type, inet_ntoa (new->data->id), new);                 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);        ospf_lsa_header_dump (new->data);
     }      }
   
Line 1614  ospf_external_lsa_body_set (struct stream *s, struct e Line 1644  ospf_external_lsa_body_set (struct stream *s, struct e
   stream_put_ospf_metric (s, mvalue);    stream_put_ospf_metric (s, mvalue);
       
   /* Get forwarding address to nexthop if on the Connection List, else 0. */    /* Get forwarding address to nexthop if on the Connection List, else 0. */
  fwd_addr = ospf_external_lsa_nexthop_get (ospf, ei->nexthop);  fwd_addr = (ei->route_map_set.nexthop.s_addr != -1) ?
     ROUTEMAP_NEXTHOP (ei) : ospf_external_lsa_nexthop_get (ospf, ei->nexthop);
   
   /* Put forwarding address. */    /* Put forwarding address. */
   stream_put_ipv4 (s, fwd_addr.s_addr);    stream_put_ipv4 (s, fwd_addr.s_addr);
Line 1637  ospf_external_lsa_new (struct ospf *ospf, Line 1668  ospf_external_lsa_new (struct ospf *ospf,
   if (ei == NULL)    if (ei == NULL)
     {      {
       if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))        if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
        zlog_debug ("LSA[Type5]: External info is NULL, could not originated");        zlog_debug ("LSA[Type5]: External info is NULL, can't originate");
       return NULL;        return NULL;
     }      }
   
Line 1852  ospf_translated_nssa_originate (struct ospf *ospf, str Line 1883  ospf_translated_nssa_originate (struct ospf *ospf, str
       
   if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL)    if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL)
     {      {
      if (IS_DEBUG_OSPF_NSSA);      if (IS_DEBUG_OSPF_NSSA)
         zlog_debug ("ospf_lsa_translated_nssa_originate(): "          zlog_debug ("ospf_lsa_translated_nssa_originate(): "
                    "Could not install LSA "                     "Could not install LSA "
                    "id %s", inet_ntoa (type7->data->id));                     "id %s", inet_ntoa (type7->data->id));
Line 2056  ospf_external_lsa_originate (struct ospf *ospf, struct Line 2087  ospf_external_lsa_originate (struct ospf *ospf, struct
   if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))    if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
     {      {
       zlog_debug ("LSA[Type%d:%s]: Originate AS-external-LSA %p",        zlog_debug ("LSA[Type%d:%s]: Originate AS-external-LSA %p",
                 new->data->type, inet_ntoa (new->data->id), new);                 new->data->type, inet_ntoa (new->data->id), (void *)new);
       ospf_lsa_header_dump (new->data);        ospf_lsa_header_dump (new->data);
     }      }
   
Line 2176  ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ Line 2207  ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_
 void  void
 ospf_external_lsa_flush (struct ospf *ospf,  ospf_external_lsa_flush (struct ospf *ospf,
                          u_char type, struct prefix_ipv4 *p,                           u_char type, struct prefix_ipv4 *p,
                         unsigned int ifindex /*, struct in_addr nexthop */)                         ifindex_t ifindex /*, struct in_addr nexthop */)
 {  {
   struct ospf_lsa *lsa;    struct ospf_lsa *lsa;
   
Line 2241  ospf_external_lsa_refresh_default (struct ospf *ospf) Line 2272  ospf_external_lsa_refresh_default (struct ospf *ospf)
       if (lsa)        if (lsa)
         {          {
           if (IS_DEBUG_OSPF_EVENT)            if (IS_DEBUG_OSPF_EVENT)
            zlog_debug ("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p", lsa);            zlog_debug ("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p",
                        (void *)lsa);
           ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE);            ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE);
         }          }
       else        else
Line 2358  ospf_external_lsa_refresh (struct ospf *ospf, struct o Line 2390  ospf_external_lsa_refresh (struct ospf *ospf, struct o
   return new;    return new;
 }  }
   
 /* LSA installation functions. */  /* LSA installation functions. */
   
 /* Install router-LSA to an area. */  /* Install router-LSA to an area. */
Line 2390  ospf_router_lsa_install (struct ospf *ospf, struct osp Line 2422  ospf_router_lsa_install (struct ospf *ospf, struct osp
       ospf_refresher_register_lsa (ospf, new);        ospf_refresher_register_lsa (ospf, new);
     }      }
   if (rt_recalc)    if (rt_recalc)
    ospf_spf_calculate_schedule (ospf);    ospf_spf_calculate_schedule (ospf, SPF_FLAG_ROUTER_LSA_INSTALL);
 
   return new;    return new;
 }  }
   
Line 2425  ospf_network_lsa_install (struct ospf *ospf, Line 2456  ospf_network_lsa_install (struct ospf *ospf,
       ospf_refresher_register_lsa (ospf, new);        ospf_refresher_register_lsa (ospf, new);
     }      }
   if (rt_recalc)    if (rt_recalc)
    ospf_spf_calculate_schedule (ospf);    ospf_spf_calculate_schedule (ospf, SPF_FLAG_NETWORK_LSA_INSTALL);
   
   return new;    return new;
 }  }
Line 2448  ospf_summary_lsa_install (struct ospf *ospf, struct os Line 2479  ospf_summary_lsa_install (struct ospf *ospf, struct os
       /* This doesn't exist yet... */        /* This doesn't exist yet... */
       ospf_summary_incremental_update(new); */        ospf_summary_incremental_update(new); */
 #else /* #if 0 */  #else /* #if 0 */
      ospf_spf_calculate_schedule (ospf);      ospf_spf_calculate_schedule (ospf, SPF_FLAG_SUMMARY_LSA_INSTALL);
 #endif /* #if 0 */  #endif /* #if 0 */
     
       if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))  
         zlog_debug ("ospf_summary_lsa_install(): SPF scheduled");  
     }      }
   
   if (IS_LSA_SELF (new))    if (IS_LSA_SELF (new))
Line 2481  ospf_summary_asbr_lsa_install (struct ospf *ospf, stru Line 2510  ospf_summary_asbr_lsa_install (struct ospf *ospf, stru
          - RFC 2328 Section 16.5 implies it should be */           - RFC 2328 Section 16.5 implies it should be */
       /* ospf_ase_calculate_schedule(); */        /* ospf_ase_calculate_schedule(); */
 #else  /* #if 0 */  #else  /* #if 0 */
      ospf_spf_calculate_schedule (ospf);      ospf_spf_calculate_schedule (ospf, SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL);
 #endif /* #if 0 */  #endif /* #if 0 */
     }      }
   
Line 2566  ospf_discard_from_db (struct ospf *ospf, Line 2595  ospf_discard_from_db (struct ospf *ospf,
       ospf_ase_unregister_external_lsa (old, ospf);        ospf_ase_unregister_external_lsa (old, ospf);
       ospf_ls_retransmit_delete_nbr_as (ospf, old);        ospf_ls_retransmit_delete_nbr_as (ospf, old);
       break;        break;
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
       ospf_ls_retransmit_delete_nbr_as (ospf, old);        ospf_ls_retransmit_delete_nbr_as (ospf, old);
       break;        break;
 #endif /* HAVE_OPAQUE_LSA */  
     case OSPF_AS_NSSA_LSA:      case OSPF_AS_NSSA_LSA:
       ospf_ls_retransmit_delete_nbr_area (old->area, old);        ospf_ls_retransmit_delete_nbr_area (old->area, old);
       ospf_ase_unregister_external_lsa (old, ospf);        ospf_ase_unregister_external_lsa (old, ospf);
Line 2604  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2631  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
         lsdb = ospf->lsdb;          lsdb = ospf->lsdb;
       break;        break;
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
       lsdb = ospf->lsdb;        lsdb = ospf->lsdb;
       break;        break;
     default:      default:
Line 2671  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2696  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
             {              {
               zlog_debug ("ospf_lsa_install() Premature Aging "                zlog_debug ("ospf_lsa_install() Premature Aging "
                          "lsa 0x%p, seqnum 0x%x",                           "lsa 0x%p, seqnum 0x%x",
                         lsa, ntohl(lsa->data->ls_seqnum));                         (void *)lsa, ntohl(lsa->data->ls_seqnum));
               ospf_lsa_header_dump (lsa->data);                ospf_lsa_header_dump (lsa->data);
             }              }
         }          }
Line 2718  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2743  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
       new = ospf_external_lsa_install (ospf, lsa, rt_recalc);        new = ospf_external_lsa_install (ospf, lsa, rt_recalc);
       break;        break;
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_LINK_LSA:      case OSPF_OPAQUE_LINK_LSA:
       if (IS_LSA_SELF (lsa))        if (IS_LSA_SELF (lsa))
         lsa->oi = oi; /* Specify outgoing ospf-interface for this LSA. */          lsa->oi = oi; /* Specify outgoing ospf-interface for this LSA. */
       else        else
        ; /* Incoming "oi" for this LSA has set at LSUpd reception. */        {
           /* Incoming "oi" for this LSA has set at LSUpd reception. */
         }
       /* Fallthrough */        /* Fallthrough */
     case OSPF_OPAQUE_AREA_LSA:      case OSPF_OPAQUE_AREA_LSA:
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
       new = ospf_opaque_lsa_install (lsa, rt_recalc);        new = ospf_opaque_lsa_install (lsa, rt_recalc);
       break;        break;
 #endif /* HAVE_OPAQUE_LSA */  
     case OSPF_AS_NSSA_LSA:      case OSPF_AS_NSSA_LSA:
       new = ospf_external_lsa_install (ospf, lsa, rt_recalc);        new = ospf_external_lsa_install (ospf, lsa, rt_recalc);
     default: /* type-6,8,9....nothing special */      default: /* type-6,8,9....nothing special */
Line 2747  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2772  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
       switch (lsa->data->type)        switch (lsa->data->type)
         {          {
         case OSPF_AS_EXTERNAL_LSA:          case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
         case OSPF_OPAQUE_AS_LSA:          case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
         case OSPF_AS_NSSA_LSA:          case OSPF_AS_NSSA_LSA:
           zlog_debug ("LSA[%s]: Install %s",            zlog_debug ("LSA[%s]: Install %s",
                  dump_lsa_key (new),                   dump_lsa_key (new),
Line 2768  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2791  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
      If received LSA' ls_age is MaxAge, or lsa is being prematurely aged       If received LSA' ls_age is MaxAge, or lsa is being prematurely aged
      (it's getting flushed out of the area), set LSA on MaxAge LSA list.        (it's getting flushed out of the area), set LSA on MaxAge LSA list. 
    */     */
  if ((lsa->flags & OSPF_LSA_PREMATURE_AGE) ||  if (IS_LSA_MAXAGE (new))
      (IS_LSA_MAXAGE (new) && !IS_LSA_SELF (new))) 
     {      {
       if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))        if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
         zlog_debug ("LSA[Type%d:%s]: Install LSA 0x%p, MaxAge",          zlog_debug ("LSA[Type%d:%s]: Install LSA 0x%p, MaxAge",
                   new->data->type,                    new->data->type,
                   inet_ntoa (new->data->id),                    inet_ntoa (new->data->id),
                   lsa);                   (void *)lsa);
      ospf_lsa_flush (ospf, lsa);      ospf_lsa_maxage (ospf, lsa);
     }      }
   
   return new;    return new;
 }  }
   
static intint
 ospf_check_nbr_status (struct ospf *ospf)  ospf_check_nbr_status (struct ospf *ospf)
 {  {
   struct listnode *node, *nnode;    struct listnode *node, *nnode;
Line 2807  ospf_check_nbr_status (struct ospf *ospf) Line 2829  ospf_check_nbr_status (struct ospf *ospf)
   return 1;    return 1;
 }  }
   
   
   
   
 static int  static int
 ospf_maxage_lsa_remover (struct thread *thread)  ospf_maxage_lsa_remover (struct thread *thread)
 {  {
   struct ospf *ospf = THREAD_ARG (thread);    struct ospf *ospf = THREAD_ARG (thread);
   struct ospf_lsa *lsa;    struct ospf_lsa *lsa;
  struct listnode *node, *nnode;  struct route_node *rn;
   int reschedule = 0;    int reschedule = 0;
   
   ospf->t_maxage = NULL;    ospf->t_maxage = NULL;
Line 2825  ospf_maxage_lsa_remover (struct thread *thread) Line 2847  ospf_maxage_lsa_remover (struct thread *thread)
   reschedule = !ospf_check_nbr_status (ospf);    reschedule = !ospf_check_nbr_status (ospf);
   
   if (!reschedule)    if (!reschedule)
    for (ALL_LIST_ELEMENTS (ospf->maxage_lsa, node, nnode, lsa))    for (rn = route_top(ospf->maxage_lsa); rn; rn = route_next(rn))
       {        {
           if ((lsa = rn->info) == NULL)
             {
               continue;
             }
   
           /* There is at least one neighbor from which we still await an ack
            * for that LSA, so we are not allowed to remove it from our lsdb yet
            * as per RFC 2328 section 14 para 4 a) */
         if (lsa->retransmit_counter > 0)          if (lsa->retransmit_counter > 0)
           {            {
             reschedule = 1;              reschedule = 1;
Line 2835  ospf_maxage_lsa_remover (struct thread *thread) Line 2865  ospf_maxage_lsa_remover (struct thread *thread)
                   
         /* TODO: maybe convert this function to a work-queue */          /* TODO: maybe convert this function to a work-queue */
         if (thread_should_yield (thread))          if (thread_should_yield (thread))
          OSPF_TIMER_ON (ospf->t_maxage, ospf_maxage_lsa_remover, 0);          {
             OSPF_TIMER_ON (ospf->t_maxage, ospf_maxage_lsa_remover, 0);
             route_unlock_node(rn); /* route_top/route_next */
             return 0;
           }
                       
         /* Remove LSA from the LSDB */          /* Remove LSA from the LSDB */
        if (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF))        if (IS_LSA_SELF (lsa))
           if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))            if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
            zlog_debug ("LSA[Type%d:%s]: LSA 0x%lx is self-oririnated: ",            zlog_debug ("LSA[Type%d:%s]: LSA 0x%lx is self-originated: ",
                        lsa->data->type, inet_ntoa (lsa->data->id), (u_long)lsa);                         lsa->data->type, inet_ntoa (lsa->data->id), (u_long)lsa);
   
         if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))          if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
Line 2850  ospf_maxage_lsa_remover (struct thread *thread) Line 2884  ospf_maxage_lsa_remover (struct thread *thread)
         if (CHECK_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE))          if (CHECK_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE))
           {            {
             if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))              if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
              zlog_debug ("originating new lsa for lsa 0x%p\n", lsa);              zlog_debug ("originating new lsa for lsa 0x%p\n", (void *)lsa);
             ospf_lsa_refresh (ospf, lsa);              ospf_lsa_refresh (ospf, lsa);
           }            }
   
Line 2879  ospf_maxage_lsa_remover (struct thread *thread) Line 2913  ospf_maxage_lsa_remover (struct thread *thread)
 void  void
 ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf_lsa *lsa)  ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf_lsa *lsa)
 {  {
  struct listnode *n;  struct route_node *rn;
   struct prefix_ptr lsa_prefix;
   
  if ((n = listnode_lookup (ospf->maxage_lsa, lsa)))  lsa_prefix.family = 0;
   lsa_prefix.prefixlen = sizeof(lsa_prefix.prefix) * CHAR_BIT;
   lsa_prefix.prefix = (uintptr_t) lsa;
 
   if ((rn = route_node_lookup(ospf->maxage_lsa,
                               (struct prefix *)&lsa_prefix)))
     {      {
      list_delete_node (ospf->maxage_lsa, n);      if (rn->info == lsa)
      UNSET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);        {
      ospf_lsa_unlock (&lsa); /* maxage_lsa */          UNSET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);
           ospf_lsa_unlock (&lsa); /* maxage_lsa */
           rn->info = NULL;
           route_unlock_node (rn); /* unlock node because lsa is deleted */
         }
       route_unlock_node (rn); /* route_node_lookup */
     }      }
 }  }
   
Line 2897  ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf Line 2942  ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf
 void  void
 ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)  ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)
 {  {
     struct prefix_ptr lsa_prefix;
     struct route_node *rn;
   
   /* When we saw a MaxAge LSA flooded to us, we put it on the list    /* When we saw a MaxAge LSA flooded to us, we put it on the list
      and schedule the MaxAge LSA remover. */       and schedule the MaxAge LSA remover. */
   if (CHECK_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE))    if (CHECK_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE))
     {      {
       if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))        if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
         zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list",          zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list",
                   lsa->data->type, inet_ntoa (lsa->data->id), lsa);                   lsa->data->type, inet_ntoa (lsa->data->id), (void *)lsa);
       return;        return;
     }      }
   
  listnode_add (ospf->maxage_lsa, ospf_lsa_lock (lsa));  lsa_prefix.family = 0;
  SET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);  lsa_prefix.prefixlen = sizeof(lsa_prefix.prefix) * CHAR_BIT;
   lsa_prefix.prefix = (uintptr_t) lsa;
   
     if ((rn = route_node_get (ospf->maxage_lsa,
                               (struct prefix *)&lsa_prefix)) != NULL)
       {
         if (rn->info != NULL)
           {
             if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
               zlog_debug ("LSA[%s]: found LSA (%p) in table for LSA %p %d",
                           dump_lsa_key (lsa), rn->info, (void *)lsa,
                           lsa_prefix.prefixlen);
             route_unlock_node (rn);
           }
         else
           {
             rn->info = ospf_lsa_lock(lsa);
             SET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);
           }
       }
     else
       {
         zlog_err("Unable to allocate memory for maxage lsa\n");
         assert(0);
       }
   
   if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))    if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
     zlog_debug ("LSA[%s]: MaxAge LSA remover scheduled.", dump_lsa_key (lsa));      zlog_debug ("LSA[%s]: MaxAge LSA remover scheduled.", dump_lsa_key (lsa));
   
Line 2934  ospf_lsa_maxage_walker_remover (struct ospf *ospf, str Line 3006  ospf_lsa_maxage_walker_remover (struct ospf *ospf, str
   
         switch (lsa->data->type)          switch (lsa->data->type)
           {            {
 #ifdef HAVE_OPAQUE_LSA  
           case OSPF_OPAQUE_LINK_LSA:            case OSPF_OPAQUE_LINK_LSA:
           case OSPF_OPAQUE_AREA_LSA:            case OSPF_OPAQUE_AREA_LSA:
           case OSPF_OPAQUE_AS_LSA:            case OSPF_OPAQUE_AS_LSA:
Line 2947  ospf_lsa_maxage_walker_remover (struct ospf *ospf, str Line 3018  ospf_lsa_maxage_walker_remover (struct ospf *ospf, str
              * topology, and thus, routing recalculation is not needed here.               * topology, and thus, routing recalculation is not needed here.
              */               */
             break;              break;
 #endif /* HAVE_OPAQUE_LSA */  
           case OSPF_AS_EXTERNAL_LSA:            case OSPF_AS_EXTERNAL_LSA:
           case OSPF_AS_NSSA_LSA:            case OSPF_AS_NSSA_LSA:
             ospf_ase_incremental_update (ospf, lsa);              ospf_ase_incremental_update (ospf, lsa);
             break;              break;
           default:            default:
            ospf_spf_calculate_schedule (ospf);            ospf_spf_calculate_schedule (ospf, SPF_FLAG_MAXAGE);
             break;              break;
           }            }
         ospf_lsa_maxage (ospf, lsa);          ospf_lsa_maxage (ospf, lsa);
Line 2988  ospf_lsa_maxage_walker (struct thread *thread) Line 3058  ospf_lsa_maxage_walker (struct thread *thread)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
       LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)        LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
 #ifdef HAVE_OPAQUE_LSA  
       LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa)        LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
       LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa)        LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
 #endif /* HAVE_OPAQUE_LSA */  
       LSDB_LOOP (NSSA_LSDB (area), rn, lsa)        LSDB_LOOP (NSSA_LSDB (area), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
     }      }
Line 3003  ospf_lsa_maxage_walker (struct thread *thread) Line 3071  ospf_lsa_maxage_walker (struct thread *thread)
     {      {
       LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa)        LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
 #ifdef HAVE_OPAQUE_LSA  
       LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa)        LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa)
         ospf_lsa_maxage_walker_remover (ospf, lsa);          ospf_lsa_maxage_walker_remover (ospf, lsa);
 #endif /* HAVE_OPAQUE_LSA */  
     }      }
   
   OSPF_TIMER_ON (ospf->t_maxage_walker, ospf_lsa_maxage_walker,    OSPF_TIMER_ON (ospf->t_maxage_walker, ospf_lsa_maxage_walker,
Line 3059  ospf_lsa_lookup (struct ospf_area *area, u_int32_t typ Line 3125  ospf_lsa_lookup (struct ospf_area *area, u_int32_t typ
     case OSPF_SUMMARY_LSA:      case OSPF_SUMMARY_LSA:
     case OSPF_ASBR_SUMMARY_LSA:      case OSPF_ASBR_SUMMARY_LSA:
     case OSPF_AS_NSSA_LSA:      case OSPF_AS_NSSA_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_LINK_LSA:      case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:      case OSPF_OPAQUE_AREA_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
       return ospf_lsdb_lookup_by_id (area->lsdb, type, id, adv_router);        return ospf_lsdb_lookup_by_id (area->lsdb, type, id, adv_router);
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
 #endif /* HAVE_OPAQUE_LSA */  
       return ospf_lsdb_lookup_by_id (ospf->lsdb, type, id, adv_router);        return ospf_lsdb_lookup_by_id (ospf->lsdb, type, id, adv_router);
     default:      default:
       break;        break;
Line 3103  ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32 Line 3165  ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32
       return ospf_lsdb_lookup_by_id (area->lsdb, type, id, id);        return ospf_lsdb_lookup_by_id (area->lsdb, type, id, id);
     case OSPF_AS_EXTERNAL_LSA:      case OSPF_AS_EXTERNAL_LSA:
     case OSPF_AS_NSSA_LSA:      case OSPF_AS_NSSA_LSA:
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_LINK_LSA:      case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:      case OSPF_OPAQUE_AREA_LSA:
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
       /* Currently not used. */        /* Currently not used. */
       break;        break;
 #endif /* HAVE_OPAQUE_LSA */  
     default:      default:
       break;        break;
     }      }
Line 3122  ospf_lsa_lookup_by_header (struct ospf_area *area, str Line 3182  ospf_lsa_lookup_by_header (struct ospf_area *area, str
 {  {
   struct ospf_lsa *match;    struct ospf_lsa *match;
   
 #ifdef HAVE_OPAQUE_LSA  
   /*    /*
    * Strictly speaking, the LSA-ID field for Opaque-LSAs (type-9/10/11)     * Strictly speaking, the LSA-ID field for Opaque-LSAs (type-9/10/11)
    * is redefined to have two subfields; opaque-type and opaque-id.     * is redefined to have two subfields; opaque-type and opaque-id.
    * However, it is harmless to treat the two sub fields together, as if     * However, it is harmless to treat the two sub fields together, as if
    * they two were forming a unique LSA-ID.     * they two were forming a unique LSA-ID.
    */     */
 #endif /* HAVE_OPAQUE_LSA */  
   
   match = ospf_lsa_lookup (area, lsah->type, lsah->id, lsah->adv_router);    match = ospf_lsa_lookup (area, lsah->type, lsah->id, lsah->adv_router);
   
Line 3280  ospf_lsa_flush_schedule (struct ospf *ospf, struct osp Line 3338  ospf_lsa_flush_schedule (struct ospf *ospf, struct osp
   
   switch (lsa->data->type)    switch (lsa->data->type)
     {      {
 #ifdef HAVE_OPAQUE_LSA  
     /* Opaque wants to be notified of flushes */      /* Opaque wants to be notified of flushes */
     case OSPF_OPAQUE_LINK_LSA:      case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:      case OSPF_OPAQUE_AREA_LSA:
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
       ospf_opaque_lsa_refresh (lsa);        ospf_opaque_lsa_refresh (lsa);
       break;        break;
 #endif /* HAVE_OPAQUE_LSA */  
     default:      default:
       ospf_refresher_unregister_lsa (ospf, lsa);        ospf_refresher_unregister_lsa (ospf, lsa);
       ospf_lsa_flush (ospf, lsa);        ospf_lsa_flush (ospf, lsa);
Line 3347  ospf_flush_self_originated_lsas_now (struct ospf *ospf Line 3403  ospf_flush_self_originated_lsas_now (struct ospf *ospf
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
       LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)        LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
 #ifdef HAVE_OPAQUE_LSA  
       LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa)        LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa)
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
       LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa)        LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa)
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
 #endif /* HAVE_OPAQUE_LSA */  
     }      }
   
   if (need_to_flush_ase)    if (need_to_flush_ase)
     {      {
       LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa)        LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa)
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
 #ifdef HAVE_OPAQUE_LSA  
       LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa)        LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa)
         ospf_lsa_flush_schedule (ospf, lsa);          ospf_lsa_flush_schedule (ospf, lsa);
 #endif /* HAVE_OPAQUE_LSA */  
     }      }
   
   /*    /*
Line 3389  ospf_lsa_is_self_originated (struct ospf *ospf, struct Line 3441  ospf_lsa_is_self_originated (struct ospf *ospf, struct
   
   /* This LSA is already checked. */    /* This LSA is already checked. */
   if (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF_CHECKED))    if (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF_CHECKED))
    return CHECK_FLAG (lsa->flags, OSPF_LSA_SELF);    return IS_LSA_SELF (lsa);
   
   /* Make sure LSA is self-checked. */    /* Make sure LSA is self-checked. */
   SET_FLAG (lsa->flags, OSPF_LSA_SELF_CHECKED);    SET_FLAG (lsa->flags, OSPF_LSA_SELF_CHECKED);
Line 3414  ospf_lsa_is_self_originated (struct ospf *ospf, struct Line 3466  ospf_lsa_is_self_originated (struct ospf *ospf, struct
               {                {
                 /* to make it easier later */                  /* to make it easier later */
                 SET_FLAG (lsa->flags, OSPF_LSA_SELF);                  SET_FLAG (lsa->flags, OSPF_LSA_SELF);
                return CHECK_FLAG (lsa->flags, OSPF_LSA_SELF);                return IS_LSA_SELF (lsa);
               }                }
       }        }
   
  return CHECK_FLAG (lsa->flags, OSPF_LSA_SELF);  return IS_LSA_SELF (lsa);
 }  }
   
 /* Get unique Link State ID. */  /* Get unique Link State ID. */
Line 3470  ospf_lsa_unique_id (struct ospf *ospf, Line 3522  ospf_lsa_unique_id (struct ospf *ospf,
   return id;    return id;
 }  }
   
 #define LSA_ACTION_FLOOD_AREA 1  #define LSA_ACTION_FLOOD_AREA 1
 #define LSA_ACTION_FLUSH_AREA 2  #define LSA_ACTION_FLUSH_AREA 2
   
Line 3533  ospf_schedule_lsa_flush_area (struct ospf_area *area,  Line 3585  ospf_schedule_lsa_flush_area (struct ospf_area *area, 
   thread_add_event (master, ospf_lsa_action, data, 0);    thread_add_event (master, ospf_lsa_action, data, 0);
 }  }
   
 /* LSA Refreshment functions. */  /* LSA Refreshment functions. */
 struct ospf_lsa *  struct ospf_lsa *
 ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)  ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
Line 3541  ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa * Line 3593  ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *
   struct external_info *ei;    struct external_info *ei;
   struct ospf_lsa *new = NULL;    struct ospf_lsa *new = NULL;
   assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));    assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));
     assert (IS_LSA_SELF (lsa));
   assert (lsa->lock > 0);    assert (lsa->lock > 0);
   
   switch (lsa->data->type)    switch (lsa->data->type)
Line 3570  ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa * Line 3623  ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *
       else        else
         ospf_lsa_flush_as (ospf, lsa);          ospf_lsa_flush_as (ospf, lsa);
       break;        break;
 #ifdef HAVE_OPAQUE_LSA  
     case OSPF_OPAQUE_LINK_LSA:      case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:      case OSPF_OPAQUE_AREA_LSA:
     case OSPF_OPAQUE_AS_LSA:      case OSPF_OPAQUE_AS_LSA:
       new = ospf_opaque_lsa_refresh (lsa);        new = ospf_opaque_lsa_refresh (lsa);
       break;        break;
 #endif /* HAVE_OPAQUE_LSA */  
     default:      default:
       break;        break;
     }      }
Line 3589  ospf_refresher_register_lsa (struct ospf *ospf, struct Line 3640  ospf_refresher_register_lsa (struct ospf *ospf, struct
   u_int16_t index, current_index;    u_int16_t index, current_index;
       
   assert (lsa->lock > 0);    assert (lsa->lock > 0);
  assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));  assert (IS_LSA_SELF (lsa));
   
   if (lsa->refresh_list < 0)    if (lsa->refresh_list < 0)
     {      {
Line 3624  ospf_refresher_register_lsa (struct ospf *ospf, struct Line 3675  ospf_refresher_register_lsa (struct ospf *ospf, struct
       if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))        if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
         zlog_debug ("LSA[Refresh:%s]: ospf_refresher_register_lsa(): "          zlog_debug ("LSA[Refresh:%s]: ospf_refresher_register_lsa(): "
                    "setting refresh_list on lsa %p (slod %d)",                      "setting refresh_list on lsa %p (slod %d)", 
                   inet_ntoa (lsa->data->id), lsa, index);                   inet_ntoa (lsa->data->id), (void *)lsa, index);
     }      }
 }  }
   
Line 3632  void Line 3683  void
 ospf_refresher_unregister_lsa (struct ospf *ospf, struct ospf_lsa *lsa)  ospf_refresher_unregister_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
 {  {
   assert (lsa->lock > 0);    assert (lsa->lock > 0);
  assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));  assert (IS_LSA_SELF (lsa));
   if (lsa->refresh_list >= 0)    if (lsa->refresh_list >= 0)
     {      {
       struct list *refresh_list = ospf->lsa_refresh_queue.qs[lsa->refresh_list];        struct list *refresh_list = ospf->lsa_refresh_queue.qs[lsa->refresh_list];
Line 3695  ospf_lsa_refresh_walker (struct thread *t) Line 3746  ospf_lsa_refresh_walker (struct thread *t)
             {              {
               if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))                if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
                 zlog_debug ("LSA[Refresh:%s]: ospf_lsa_refresh_walker(): "                  zlog_debug ("LSA[Refresh:%s]: ospf_lsa_refresh_walker(): "
                           "refresh lsa %p (slot %d)",                            "refresh lsa %p (slot %d)",
                           inet_ntoa (lsa->data->id), lsa, i);                           inet_ntoa (lsa->data->id), (void *)lsa, i);
              
               assert (lsa->lock > 0);                assert (lsa->lock > 0);
               list_delete_node (refresh_list, node);                list_delete_node (refresh_list, node);
               lsa->refresh_list = -1;                lsa->refresh_list = -1;

Removed from v.1.1  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>