Diff for /embedaddon/quagga/isisd/isis_dr.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 17:26:11 version 1.1.1.2, 2012/10/09 09:22:28
Line 47 Line 47
 #include "isisd/isis_dr.h"  #include "isisd/isis_dr.h"
 #include "isisd/isis_events.h"  #include "isisd/isis_events.h"
   
 extern struct isis *isis;  
 extern struct thread_master *master;  
   
 const char *  const char *
 isis_disflag2string (int disflag)  isis_disflag2string (int disflag)
 {  {
Line 137  isis_dr_elect (struct isis_circuit *circuit, int level Line 134  isis_dr_elect (struct isis_circuit *circuit, int level
   int biggest_prio = -1;    int biggest_prio = -1;
   int cmp_res, retval = ISIS_OK;    int cmp_res, retval = ISIS_OK;
   
  own_prio = circuit->u.bc.priority[level - 1];  own_prio = circuit->priority[level - 1];
   adjdb = circuit->u.bc.adjdb[level - 1];    adjdb = circuit->u.bc.adjdb[level - 1];
   
   if (!adjdb)    if (!adjdb)
     {      {
       zlog_warn ("isis_dr_elect() adjdb == NULL");        zlog_warn ("isis_dr_elect() adjdb == NULL");
       retval = ISIS_WARNING;  
       list_delete (list);        list_delete (list);
      goto out;      return ISIS_WARNING;
     }      }
   isis_adj_build_up_list (adjdb, list);    isis_adj_build_up_list (adjdb, list);
   
Line 189  isis_dr_elect (struct isis_circuit *circuit, int level Line 185  isis_dr_elect (struct isis_circuit *circuit, int level
   if (!adj_dr)    if (!adj_dr)
     {      {
       /*        /*
       * Could not find the DR - means we are alone and thus the DR       * Could not find the DR - means we are alone. Resign if we were DR.
        */         */
      if (!circuit->u.bc.is_dr[level - 1])      if (circuit->u.bc.is_dr[level - 1])
        {        retval = isis_dr_resign (circuit, level);
          list_delete (list);      list_delete (list);
          list = NULL;      return retval;
          return isis_dr_commence (circuit, level); 
        } 
      goto out; 
     }      }
   
   /*    /*
    * Now we have the DR adjacency, compare it to self     * Now we have the DR adjacency, compare it to self
    */     */
  if (adj_dr->prio[level - 1] < own_prio  if (adj_dr->prio[level - 1] < own_prio ||
      || (adj_dr->prio[level - 1] == own_prio      (adj_dr->prio[level - 1] == own_prio &&
          && memcmp (adj_dr->snpa, circuit->u.bc.snpa, ETH_ALEN) < 0))       memcmp (adj_dr->snpa, circuit->u.bc.snpa, ETH_ALEN) < 0))
     {      {
      if (!circuit->u.bc.is_dr[level - 1])      adj_dr->dis_record[level - 1].dis = ISIS_IS_NOT_DIS;
        {      adj_dr->dis_record[level - 1].last_dis_change = time (NULL);
          /* 
           * We are the DR 
           */ 
   
          /* rotate the history log */      /* rotate the history log */
          for (ALL_LIST_ELEMENTS_RO (list, node, adj))      for (ALL_LIST_ELEMENTS_RO (list, node, adj))
            isis_check_dr_change (adj, level);        isis_check_dr_change (adj, level);
   
          /* commence */      /* We are the DR, commence DR */
          list_delete (list);      if (circuit->u.bc.is_dr[level - 1] == 0 && listcount (list) > 0)
          return isis_dr_commence (circuit, level);        retval = isis_dr_commence (circuit, level);
        } 
     }      }
   else    else
     {      {
   
       /* ok we have found the DIS - lets mark the adjacency */        /* ok we have found the DIS - lets mark the adjacency */
       /* set flag for show output */        /* set flag for show output */
       adj_dr->dis_record[level - 1].dis = ISIS_IS_DIS;        adj_dr->dis_record[level - 1].dis = ISIS_IS_DIS;
Line 240  isis_dr_elect (struct isis_circuit *circuit, int level Line 228  isis_dr_elect (struct isis_circuit *circuit, int level
       /*        /*
        * We are not DR - if we were -> resign         * We are not DR - if we were -> resign
        */         */
   
       if (circuit->u.bc.is_dr[level - 1])        if (circuit->u.bc.is_dr[level - 1])
        {        retval = isis_dr_resign (circuit, level);
          list_delete (list); 
          return isis_dr_resign (circuit, level); 
        } 
     }      }
out:  list_delete (list);
  if (list) 
    list_delete (list); 
   return retval;    return retval;
 }  }
   
Line 264  isis_dr_resign (struct isis_circuit *circuit, int leve Line 246  isis_dr_resign (struct isis_circuit *circuit, int leve
   circuit->u.bc.run_dr_elect[level - 1] = 0;    circuit->u.bc.run_dr_elect[level - 1] = 0;
   THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[level - 1]);    THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[level - 1]);
   THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);    THREAD_TIMER_OFF (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
     circuit->lsp_regenerate_pending[level - 1] = 0;
   
   memcpy (id, isis->sysid, ISIS_SYS_ID_LEN);    memcpy (id, isis->sysid, ISIS_SYS_ID_LEN);
   LSP_PSEUDO_ID (id) = circuit->circuit_id;    LSP_PSEUDO_ID (id) = circuit->circuit_id;
   LSP_FRAGMENT (id) = 0;    LSP_FRAGMENT (id) = 0;
  lsp_purge_dr (id, circuit, level);  lsp_purge_pseudo (id, circuit, level);
   
   if (level == 1)    if (level == 1)
     {      {
Line 327  isis_dr_commence (struct isis_circuit *circuit, int le Line 310  isis_dr_commence (struct isis_circuit *circuit, int le
       if (LSP_PSEUDO_ID (old_dr))        if (LSP_PSEUDO_ID (old_dr))
         {          {
           /* there was a dr elected, purge its LSPs from the db */            /* there was a dr elected, purge its LSPs from the db */
          lsp_purge_dr (old_dr, circuit, level);          lsp_purge_pseudo (old_dr, circuit, level);
         }          }
       memcpy (circuit->u.bc.l1_desig_is, isis->sysid, ISIS_SYS_ID_LEN);        memcpy (circuit->u.bc.l1_desig_is, isis->sysid, ISIS_SYS_ID_LEN);
       *(circuit->u.bc.l1_desig_is + ISIS_SYS_ID_LEN) = circuit->circuit_id;        *(circuit->u.bc.l1_desig_is + ISIS_SYS_ID_LEN) = circuit->circuit_id;
Line 335  isis_dr_commence (struct isis_circuit *circuit, int le Line 318  isis_dr_commence (struct isis_circuit *circuit, int le
       assert (circuit->circuit_id);     /* must be non-zero */        assert (circuit->circuit_id);     /* must be non-zero */
       /*    if (circuit->t_send_l1_psnp)        /*    if (circuit->t_send_l1_psnp)
          thread_cancel (circuit->t_send_l1_psnp); */           thread_cancel (circuit->t_send_l1_psnp); */
      lsp_l1_pseudo_generate (circuit);      lsp_generate_pseudo (circuit, 1);
   
       THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);        THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
       THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,        THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
Line 353  isis_dr_commence (struct isis_circuit *circuit, int le Line 336  isis_dr_commence (struct isis_circuit *circuit, int le
       if (LSP_PSEUDO_ID (old_dr))        if (LSP_PSEUDO_ID (old_dr))
         {          {
           /* there was a dr elected, purge its LSPs from the db */            /* there was a dr elected, purge its LSPs from the db */
          lsp_purge_dr (old_dr, circuit, level);          lsp_purge_pseudo (old_dr, circuit, level);
         }          }
       memcpy (circuit->u.bc.l2_desig_is, isis->sysid, ISIS_SYS_ID_LEN);        memcpy (circuit->u.bc.l2_desig_is, isis->sysid, ISIS_SYS_ID_LEN);
       *(circuit->u.bc.l2_desig_is + ISIS_SYS_ID_LEN) = circuit->circuit_id;        *(circuit->u.bc.l2_desig_is + ISIS_SYS_ID_LEN) = circuit->circuit_id;
Line 361  isis_dr_commence (struct isis_circuit *circuit, int le Line 344  isis_dr_commence (struct isis_circuit *circuit, int le
       assert (circuit->circuit_id);     /* must be non-zero */        assert (circuit->circuit_id);     /* must be non-zero */
       /*    if (circuit->t_send_l1_psnp)        /*    if (circuit->t_send_l1_psnp)
          thread_cancel (circuit->t_send_l1_psnp); */           thread_cancel (circuit->t_send_l1_psnp); */
      lsp_l2_pseudo_generate (circuit);      lsp_generate_pseudo (circuit, 2);
   
       THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);        THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
       THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,        THREAD_TIMER_ON (master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,

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


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