Example #1
0
void
isis_adj_state_change (struct isis_adjacency *adj, enum isis_adj_state state,
		       const char *reason)
{
  int old_state;
  int level = adj->level;
  struct isis_circuit *circuit;

  old_state = adj->adj_state;
  adj->adj_state = state;

  circuit = adj->circuit;

  Log(LOG_DEBUG, "DEBUG ( default/core/ISIS ): ISIS-Adj (%s): Adjacency state change %d->%d: %s\n",
		 circuit->area->area_tag, old_state, state, reason ? reason : "unspecified"); 

  if (state == ISIS_ADJ_UP)
    {
      /* update counter & timers for debugging purposes */
      adj->last_flap = time (NULL);
      adj->flaps++;

      /* 7.3.17 - going up on P2P -> send CSNP */
      send_csnp (circuit, 1);
      send_csnp (circuit, 2);
    }
  else if (state == ISIS_ADJ_DOWN)
    {				/* p2p interface */
      adj->circuit->u.p2p.neighbor = NULL;
      isis_delete_adj (adj, NULL);
    }
  return;
}
Example #2
0
void
isis_adj_state_change (struct isis_adjacency *adj, enum isis_adj_state state,
		       const char *reason)
{
  int old_state;
  int level = adj->level;
  struct isis_circuit *circuit;

  old_state = adj->adj_state;
  adj->adj_state = state;

  circuit = adj->circuit;

  if (isis->debugs & DEBUG_ADJ_PACKETS)
    {
      zlog_debug ("ISIS-Adj (%s): Adjacency state change %d->%d: %s",
		 circuit->area->area_tag,
		 old_state, state, reason ? reason : "unspecified");
    }

  if (circuit->circ_type == CIRCUIT_T_BROADCAST)
    {
      if (state == ISIS_ADJ_UP)
	circuit->upadjcount[level - 1]++;
      if (state == ISIS_ADJ_DOWN)
	{
	  isis_delete_adj (adj, adj->circuit->u.bc.adjdb[level - 1]);
	  circuit->upadjcount[level - 1]--;
	}

      list_delete_all_node (circuit->u.bc.lan_neighs[level - 1]);
      isis_adj_build_neigh_list (circuit->u.bc.adjdb[level - 1],
				 circuit->u.bc.lan_neighs[level - 1]);
    }
  else if (state == ISIS_ADJ_UP)
    {				/* p2p interface */
      if (adj->sys_type == ISIS_SYSTYPE_UNKNOWN)
	send_hello (circuit, 1);

      /* update counter & timers for debugging purposes */
      adj->last_flap = time (NULL);
      adj->flaps++;

      /* 7.3.17 - going up on P2P -> send CSNP */
      /* FIXME: yup, I know its wrong... but i will do it! (for now) */
      send_csnp (circuit, 1);
      send_csnp (circuit, 2);
    }
  else if (state == ISIS_ADJ_DOWN)
    {				/* p2p interface */
      adj->circuit->u.p2p.neighbor = NULL;
      isis_delete_adj (adj, NULL);
    }
  return;
}
Example #3
0
void
isis_adj_state_change (struct isis_adjacency *adj, enum isis_adj_state new_state,
		       const char *reason)
{
  int old_state;
  int level;
  struct isis_circuit *circuit;

  old_state = adj->adj_state;
  adj->adj_state = new_state;

  circuit = adj->circuit;

  if (isis->debugs & DEBUG_ADJ_PACKETS)
    {
      zlog_debug ("ISIS-Adj (%s): Adjacency state change %d->%d: %s",
		 circuit->area->area_tag,
		 old_state, new_state, reason ? reason : "unspecified");
    }

  if (circuit->area->log_adj_changes)
    {
      const char *adj_name;
      struct isis_dynhn *dyn;

      dyn = dynhn_find_by_id (adj->sysid);
      if (dyn)
	adj_name = (const char *)dyn->name.name;
      else
	adj_name = adj->sysid ? sysid_print (adj->sysid) : "unknown";

      zlog_info ("%%ADJCHANGE: Adjacency to %s (%s) changed from %s to %s, %s",
		 adj_name,
		 adj->circuit->interface->name,
		 adj_state2string (old_state),
		 adj_state2string (new_state),
		 reason ? reason : "unspecified");
    }

  if (circuit->circ_type == CIRCUIT_T_BROADCAST)
    {
      for (level = IS_LEVEL_1; level <= IS_LEVEL_2; level++)
      {
        if ((adj->level & level) == 0)
          continue;
        if (new_state == ISIS_ADJ_UP)
        {
          circuit->upadjcount[level - 1]++;
          isis_event_adjacency_state_change (adj, new_state);
          /* update counter & timers for debugging purposes */
          adj->last_flap = time (NULL);
          adj->flaps++;
        }
        else if (new_state == ISIS_ADJ_DOWN)
        {
          listnode_delete (circuit->u.bc.adjdb[level - 1], adj);
          circuit->upadjcount[level - 1]--;
          if (circuit->upadjcount[level - 1] == 0)
            {
              /* Clean lsp_queue when no adj is up. */
              if (circuit->lsp_queue)
                list_delete_all_node (circuit->lsp_queue);
            }
          isis_event_adjacency_state_change (adj, new_state);
          isis_delete_adj (adj);
        }

        if (circuit->u.bc.lan_neighs[level - 1])
          {
            list_delete_all_node (circuit->u.bc.lan_neighs[level - 1]);
            isis_adj_build_neigh_list (circuit->u.bc.adjdb[level - 1],
                                       circuit->u.bc.lan_neighs[level - 1]);
          }

        /* On adjacency state change send new pseudo LSP if we are the DR */
        if (circuit->u.bc.is_dr[level - 1])
          lsp_regenerate_schedule_pseudo (circuit, level);
      }
    }
  else if (circuit->circ_type == CIRCUIT_T_P2P)
    {
      for (level = IS_LEVEL_1; level <= IS_LEVEL_2; level++)
      {
        if ((adj->level & level) == 0)
          continue;
        if (new_state == ISIS_ADJ_UP)
        {
          circuit->upadjcount[level - 1]++;
          isis_event_adjacency_state_change (adj, new_state);

          if (adj->sys_type == ISIS_SYSTYPE_UNKNOWN)
            send_hello (circuit, level);

          /* update counter & timers for debugging purposes */
          adj->last_flap = time (NULL);
          adj->flaps++;

          /* 7.3.17 - going up on P2P -> send CSNP */
          /* FIXME: yup, I know its wrong... but i will do it! (for now) */
          send_csnp (circuit, level);
        }
        else if (new_state == ISIS_ADJ_DOWN)
        {
          if (adj->circuit->u.p2p.neighbor == adj)
            adj->circuit->u.p2p.neighbor = NULL;
          circuit->upadjcount[level - 1]--;
          if (circuit->upadjcount[level - 1] == 0)
            {
              /* Clean lsp_queue when no adj is up. */
              if (circuit->lsp_queue)
                list_delete_all_node (circuit->lsp_queue);
            }
          isis_event_adjacency_state_change (adj, new_state);
          isis_delete_adj (adj);
        }
      }
    }

  return;
}