Diff for /embedaddon/quagga/ospfd/ospf_lsa.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2012/10/09 09:22:29 version 1.1.1.3, 2013/07/21 23:54:40
Line 192  ospf_lsa_checksum (struct lsa_header *lsa) Line 192  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 *
Line 670  router_lsa_link_set (struct stream *s, struct ospf_are Line 682  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 704  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 1326  static void Line 1340  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 1852  ospf_translated_nssa_originate (struct ospf *ospf, str Line 1862  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 2723  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2733  ospf_lsa_install (struct ospf *ospf, struct ospf_inter
       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:
Line 2768  ospf_lsa_install (struct ospf *ospf, struct ospf_inter Line 2780  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);                     lsa);
      ospf_lsa_flush (ospf, lsa);      ospf_lsa_maxage (ospf, lsa);
     }      }
   
   return new;    return new;
Line 2814  ospf_maxage_lsa_remover (struct thread *thread) Line 2825  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 2836  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;
             }
   
         if (lsa->retransmit_counter > 0)          if (lsa->retransmit_counter > 0)
           {            {
             reschedule = 1;              reschedule = 1;
Line 2879  ospf_maxage_lsa_remover (struct thread *thread) Line 2895  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_ls lsa_prefix;
   
  if ((n = listnode_lookup (ospf->maxage_lsa, lsa)))  ls_prefix_set (&lsa_prefix, 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); /* route_node_lookup */
         }
           route_unlock_node (rn); /* route_node_lookup */
     }      }
 }  }
   
Line 2897  ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf Line 2922  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_ls 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))
Line 2907  ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *l Line 2935  ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *l
       return;        return;
     }      }
   
  listnode_add (ospf->maxage_lsa, ospf_lsa_lock (lsa));  ls_prefix_set (&lsa_prefix, lsa);
  SET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);  if ((rn = route_node_get (ospf->maxage_lsa,
                             (struct prefix *)&lsa_prefix)) != NULL)
     {
       if (rn->info != NULL)
         {
           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));

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


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