Diff for /embedaddon/quagga/ospf6d/ospf6_flood.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/07/21 23:54:39 version 1.1.1.3, 2016/11/02 10:09:12
Line 113  ospf6_lsa_originate (struct ospf6_lsa *lsa) Line 113  ospf6_lsa_originate (struct ospf6_lsa *lsa)
   ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self);    ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self);
   
   lsa->refresh = thread_add_timer (master, ospf6_lsa_refresh, lsa,    lsa->refresh = thread_add_timer (master, ospf6_lsa_refresh, lsa,
                                   LS_REFRESH_TIME);                                   OSPF_LS_REFRESH_TIME);
   
   if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||    if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||
       IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type))        IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type))
Line 122  ospf6_lsa_originate (struct ospf6_lsa *lsa) Line 122  ospf6_lsa_originate (struct ospf6_lsa *lsa)
       ospf6_lsa_header_print (lsa);        ospf6_lsa_header_print (lsa);
     }      }
   
   if (old)  
     ospf6_flood_clear (old);  
   ospf6_flood (NULL, lsa);  
   ospf6_install_lsa (lsa);    ospf6_install_lsa (lsa);
     ospf6_flood (NULL, lsa);
 }  }
   
 void  void
Line 208  ospf6_decrement_retrans_count (struct ospf6_lsa *lsa) Line 206  ospf6_decrement_retrans_count (struct ospf6_lsa *lsa)
 void  void
 ospf6_install_lsa (struct ospf6_lsa *lsa)  ospf6_install_lsa (struct ospf6_lsa *lsa)
 {  {
   struct ospf6_lsa *old;  
   struct timeval now;    struct timeval now;
     struct ospf6_lsa *old;
   
   if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||    if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||
       IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type))        IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type))
Line 222  ospf6_install_lsa (struct ospf6_lsa *lsa) Line 220  ospf6_install_lsa (struct ospf6_lsa *lsa)
   if (old)    if (old)
     {      {
       THREAD_OFF (old->expire);        THREAD_OFF (old->expire);
         THREAD_OFF (old->refresh);
       ospf6_flood_clear (old);        ospf6_flood_clear (old);
     }      }
   
   quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);    quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
   if (! OSPF6_LSA_IS_MAXAGE (lsa))    if (! OSPF6_LSA_IS_MAXAGE (lsa))
     lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa,      lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa,
                                    MAXAGE + lsa->birth.tv_sec - now.tv_sec);                                    OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec);
   else    else
     lsa->expire = NULL;      lsa->expire = NULL;
   
     if (OSPF6_LSA_IS_SEQWRAP(lsa) &&
         ! (CHECK_FLAG(lsa->flag,OSPF6_LSA_SEQWRAPPED) &&
            lsa->header->seqnum == htonl(OSPF_MAX_SEQUENCE_NUMBER)))
      {
        if (IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type))
          zlog_debug("lsa install wrapping: sequence 0x%x",
                     ntohl(lsa->header->seqnum));
        SET_FLAG(lsa->flag, OSPF6_LSA_SEQWRAPPED);
        /* in lieu of premature_aging, since we do not want to recreate this lsa
         * and/or mess with timers etc, we just want to wrap the sequence number
         * and reflood the lsa before continuing.
         * NOTE: Flood needs to be called right after this function call, by the
         * caller
         */
        lsa->header->seqnum = htonl (OSPF_MAX_SEQUENCE_NUMBER);
        lsa->header->age = htons (OSPF_LSA_MAXAGE);
        ospf6_lsa_checksum (lsa->header);
      }
   
   /* actually install */    /* actually install */
   lsa->installed = now;    lsa->installed = now;
   ospf6_lsdb_add (lsa, lsa->lsdb);    ospf6_lsdb_add (lsa, lsa->lsdb);
Line 292  ospf6_flood_interface (struct ospf6_neighbor *from, Line 310  ospf6_flood_interface (struct ospf6_neighbor *from,
               if (ospf6_lsa_compare (lsa, req) > 0)                if (ospf6_lsa_compare (lsa, req) > 0)
                 {                  {
                   if (is_debug)                    if (is_debug)
                    zlog_debug ("Requesting is newer, next neighbor");                    zlog_debug ("Requesting is older, next neighbor");
                   continue;                    continue;
                 }                  }
   
Line 300  ospf6_flood_interface (struct ospf6_neighbor *from, Line 318  ospf6_flood_interface (struct ospf6_neighbor *from,
                  examin next neighbor */                   examin next neighbor */
               if (ospf6_lsa_compare (lsa, req) == 0)                if (ospf6_lsa_compare (lsa, req) == 0)
                 {                  {
                  if (is_debug)                  if (is_debug)
                    zlog_debug ("Requesting the same, remove it, next neighbor");                    zlog_debug ("Requesting the same, remove it, next neighbor");
                   if (req == on->last_ls_req)
                     {
                       ospf6_lsa_unlock (req);
                       on->last_ls_req = NULL;
                     }
                   ospf6_lsdb_remove (req, on->request_list);                    ospf6_lsdb_remove (req, on->request_list);
                     ospf6_check_nbr_loading (on);
                   continue;                    continue;
                 }                  }
   
               /* If the new LSA is more recent, delete from request-list */                /* If the new LSA is more recent, delete from request-list */
               if (ospf6_lsa_compare (lsa, req) < 0)                if (ospf6_lsa_compare (lsa, req) < 0)
                 {                  {
                  if (is_debug)                  if (is_debug)
                    zlog_debug ("Received is newer, remove requesting");                    zlog_debug ("Received is newer, remove requesting");
                   if (req == on->last_ls_req)
                     {
                       ospf6_lsa_unlock (req);
                       on->last_ls_req = NULL;
                     }
                   ospf6_lsdb_remove (req, on->request_list);                    ospf6_lsdb_remove (req, on->request_list);
                     ospf6_check_nbr_loading (on);
                   /* fall through */                    /* fall through */
                 }                  }
             }              }
Line 358  ospf6_flood_interface (struct ospf6_neighbor *from, Line 388  ospf6_flood_interface (struct ospf6_neighbor *from,
   
   /* (4) If the new LSA was received on this interface,    /* (4) If the new LSA was received on this interface,
      and the interface state is BDR, examin next interface */       and the interface state is BDR, examin next interface */
  if (from && from->ospf6_if == oi && oi->state == OSPF6_INTERFACE_BDR)  if (from && from->ospf6_if == oi)
     {      {
      if (is_debug)      if (oi->state == OSPF6_INTERFACE_BDR)
        zlog_debug ("Received is from the I/F, itself BDR, next interface");        {
      return;          if (is_debug)
             zlog_debug ("Received is from the I/F, itself BDR, next interface");
           return;
         }
       SET_FLAG(lsa->flag, OSPF6_LSA_FLOODBACK);
     }      }
   
   /* (5) flood the LSA out the interface. */    /* (5) flood the LSA out the interface. */
   if (is_debug)    if (is_debug)
     zlog_debug ("Schedule flooding for the interface");      zlog_debug ("Schedule flooding for the interface");
  if (if_is_broadcast (oi->interface))  if ((oi->type == OSPF_IFTYPE_BROADCAST) ||
       (oi->type == OSPF_IFTYPE_POINTOPOINT))
     {      {
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsupdate_list);        ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsupdate_list);
       if (oi->thread_send_lsupdate == NULL)        if (oi->thread_send_lsupdate == NULL)
Line 530  ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa, Line 565  ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa,
   assert (from && from->ospf6_if);    assert (from && from->ospf6_if);
   oi = from->ospf6_if;    oi = from->ospf6_if;
   
   /* LSA has been flood back out receiving interface.  
      No acknowledgement sent. */  
   if (CHECK_FLAG (lsa->flag, OSPF6_LSA_FLOODBACK))  
     {  
       if (is_debug)  
         zlog_debug ("No acknowledgement (BDR & FloodBack)");  
       return;  
     }  
   
   /* LSA is more recent than database copy, but was not flooded    /* LSA is more recent than database copy, but was not flooded
      back out receiving interface. Delayed acknowledgement sent       back out receiving interface. Delayed acknowledgement sent
      if advertisement received from Designated Router,       if advertisement received from Designated Router,
Line 797  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 823  ospf6_receive_lsa (struct ospf6_neighbor *from,
     {      {
       /* log */        /* log */
       if (is_debug)        if (is_debug)
        zlog_debug ("Drop MaxAge LSA with direct acknowledgement.");        zlog_debug ("Drop MaxAge LSA with direct acknowledgement.");
   
       /* a) Acknowledge back to neighbor (Direct acknowledgement, 13.5) */        /* a) Acknowledge back to neighbor (Direct acknowledgement, 13.5) */
       ospf6_lsdb_add (ospf6_lsa_copy (new), from->lsack_list);        ospf6_lsdb_add (ospf6_lsa_copy (new), from->lsack_list);
Line 837  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 863  ospf6_receive_lsa (struct ospf6_neighbor *from,
           struct timeval now, res;            struct timeval now, res;
           quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);            quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
           timersub (&now, &old->installed, &res);            timersub (&now, &old->installed, &res);
          if (res.tv_sec < MIN_LS_ARRIVAL)          if (res.tv_sec < (OSPF_MIN_LS_ARRIVAL / 1000))
             {              {
               if (is_debug)                if (is_debug)
                 zlog_debug ("LSA can't be updated within MinLSArrival, discard");                  zlog_debug ("LSA can't be updated within MinLSArrival, discard");
Line 849  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 875  ospf6_receive_lsa (struct ospf6_neighbor *from,
       quagga_gettime (QUAGGA_CLK_MONOTONIC, &new->received);        quagga_gettime (QUAGGA_CLK_MONOTONIC, &new->received);
   
       if (is_debug)        if (is_debug)
        zlog_debug ("Flood, Install, Possibly acknowledge the received LSA");        zlog_debug ("Install, Flood, Possibly acknowledge the received LSA");
   
         /* Remove older copies of this LSA from retx lists */
         if (old)
           ospf6_flood_clear (old);
   
       /* (b) immediately flood and (c) remove from all retrans-list */        /* (b) immediately flood and (c) remove from all retrans-list */
       /* Prevent self-originated LSA to be flooded. this is to make        /* Prevent self-originated LSA to be flooded. this is to make
       reoriginated instance of the LSA not to be rejected by other routers        reoriginated instance of the LSA not to be rejected by other routers
Line 858  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 888  ospf6_receive_lsa (struct ospf6_neighbor *from,
       if (new->header->adv_router != from->ospf6_if->area->ospf6->router_id)        if (new->header->adv_router != from->ospf6_if->area->ospf6->router_id)
         ospf6_flood (from, new);          ospf6_flood (from, new);
   
       /* (c) Remove the current database copy from all neighbors' Link  
              state retransmission lists. */  
       /* XXX, flood_clear ? */  
   
       /* (d), installing lsdb, which may cause routing        /* (d), installing lsdb, which may cause routing
               table calculation (replacing database copy) */                table calculation (replacing database copy) */
       ospf6_install_lsa (new);        ospf6_install_lsa (new);
Line 944  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 970  ospf6_receive_lsa (struct ospf6_neighbor *from,
       /* If database copy is in 'Seqnumber Wrapping',        /* If database copy is in 'Seqnumber Wrapping',
          simply discard the received LSA */           simply discard the received LSA */
       if (OSPF6_LSA_IS_MAXAGE (old) &&        if (OSPF6_LSA_IS_MAXAGE (old) &&
          old->header->seqnum == htonl (MAX_SEQUENCE_NUMBER))          old->header->seqnum == htonl (OSPF_MAX_SEQUENCE_NUMBER))
         {          {
           if (is_debug)            if (is_debug)
             {              {
               zlog_debug ("The LSA is in Seqnumber Wrapping");                zlog_debug ("The LSA is in Seqnumber Wrapping");
               zlog_debug ("MaxAge & MaxSeqNum, discard");                zlog_debug ("MaxAge & MaxSeqNum, discard");
             }              }
          ospf6_lsa_delete (new);          ospf6_lsa_delete (new);
          return;          return;
         }          }
   
       /* Otherwise, Send database copy of this LSA to this neighbor */        /* Otherwise, Send database copy of this LSA to this neighbor */
Line 969  ospf6_receive_lsa (struct ospf6_neighbor *from, Line 995  ospf6_receive_lsa (struct ospf6_neighbor *from,
           if (from->thread_send_lsupdate == NULL)            if (from->thread_send_lsupdate == NULL)
             from->thread_send_lsupdate =              from->thread_send_lsupdate =
               thread_add_event (master, ospf6_lsupdate_send_neighbor, from, 0);                thread_add_event (master, ospf6_lsupdate_send_neighbor, from, 0);
          ospf6_lsa_delete (new);          ospf6_lsa_delete (new);
          return;          return;
         }          }
       return;        return;
     }      }

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


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