コード例 #1
0
ファイル: isis_spf.c プロジェクト: remfalc/vyt-pmacct
/*
 * Add this IS to the root of SPT
 */
static void
isis_spf_add_self (struct isis_spftree *spftree, struct isis_area *area,
		   int level)
{
  struct isis_vertex *vertex;
  struct isis_lsp *lsp;
  u_char lspid[ISIS_SYS_ID_LEN + 2];
  memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
  LSP_PSEUDO_ID (lspid) = 0;
  LSP_FRAGMENT (lspid) = 0;

  lsp = lsp_search (lspid, area->lspdb[level - 1]);

  if (lsp == NULL)
    Log(LOG_WARNING, "WARN ( default/core/ISIS ): ISIS-Spf: could not find own l%d LSP!\n", level);

  if (!area->oldmetric)
    vertex = isis_vertex_new (isis->sysid, VTYPE_NONPSEUDO_TE_IS);
  else 
    vertex = isis_vertex_new (isis->sysid, VTYPE_NONPSEUDO_IS);

  vertex->lsp = lsp;

  listnode_add (spftree->paths, vertex);

  return;
}
コード例 #2
0
ファイル: isis_spf.c プロジェクト: AT-Corp/quagga-atc
/*
 * Add this IS to the root of SPT
 */
static struct isis_vertex *
isis_spf_add_root (struct isis_spftree *spftree, int level, u_char *sysid)
{
  struct isis_vertex *vertex;
  struct isis_lsp *lsp;
#ifdef EXTREME_DEBUG
  u_char buff[BUFSIZ];
#endif /* EXTREME_DEBUG */

  lsp = isis_root_system_lsp (spftree->area, level, sysid);
  if (lsp == NULL)
    zlog_warn ("ISIS-Spf: could not find own l%d LSP!", level);

  if (!spftree->area->oldmetric)
    vertex = isis_vertex_new (sysid, VTYPE_NONPSEUDO_TE_IS);
  else
    vertex = isis_vertex_new (sysid, VTYPE_NONPSEUDO_IS);

  listnode_add (spftree->paths, vertex);

#ifdef EXTREME_DEBUG
  zlog_debug ("ISIS-Spf: added this IS  %s %s depth %d dist %d to PATHS",
	      vtype2string (vertex->type), vid2string (vertex, buff),
	      vertex->depth, vertex->d_N);
#endif /* EXTREME_DEBUG */

  return vertex;
}
コード例 #3
0
ファイル: isis_spf.c プロジェクト: AT-Corp/quagga-atc
/*
 * Add a vertex to TENT sorted by cost and by vertextype on tie break situation
 */
static struct isis_vertex *
isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
		   void *id, uint32_t cost, int depth, int family,
		   struct isis_adjacency *adj, struct isis_vertex *parent)
{
  struct isis_vertex *vertex, *v;
  struct listnode *node;
  struct isis_adjacency *parent_adj;
#ifdef EXTREME_DEBUG
  u_char buff[BUFSIZ];
#endif

  assert (isis_find_vertex (spftree->paths, id, vtype) == NULL);
  assert (isis_find_vertex (spftree->tents, id, vtype) == NULL);
  vertex = isis_vertex_new (id, vtype);
  vertex->d_N = cost;
  vertex->depth = depth;

  if (parent) {
    listnode_add (vertex->parents, parent);
    if (listnode_lookup (parent->children, vertex) == NULL)
      listnode_add (parent->children, vertex);
  }

  if (parent && parent->Adj_N && listcount(parent->Adj_N) > 0) {
    for (ALL_LIST_ELEMENTS_RO (parent->Adj_N, node, parent_adj))
      listnode_add (vertex->Adj_N, parent_adj);
  } else if (adj) {
コード例 #4
0
ファイル: isis_spf.c プロジェクト: kkcloudy/daemongroup
/*
 * Add this IS to the root of SPT
 */
static void
isis_spf_add_self (struct isis_spftree *spftree, struct isis_area *area,
		   int level)
{
  struct isis_vertex *vertex;
  struct isis_lsp *lsp;
  u_char lspid[ISIS_SYS_ID_LEN + 2];
#ifdef EXTREME_DEBUG
  u_char buff[BUFSIZ];
#endif /* EXTREME_DEBUG */
  memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
  LSP_PSEUDO_ID (lspid) = 0;
  LSP_FRAGMENT (lspid) = 0;

  lsp = lsp_search (lspid, area->lspdb[level - 1]);

  if (lsp == NULL)
    zlog_warn ("ISIS-Spf: could not find own l%d LSP!", level);

  if (!area->oldmetric)
    vertex = isis_vertex_new (isis->sysid, VTYPE_NONPSEUDO_TE_IS);
  else
    vertex = isis_vertex_new (isis->sysid, VTYPE_NONPSEUDO_IS);

  vertex->lsp = lsp;

  listnode_add (spftree->paths, vertex);

#ifdef EXTREME_DEBUG
  zlog_debug ("ISIS-Spf: added this IS  %s %s depth %d dist %d to PATHS",
	      vtype2string (vertex->type), vid2string (vertex, buff),
	      vertex->depth, vertex->d_N);
#endif /* EXTREME_DEBUG */

  return;
}
コード例 #5
0
ファイル: isis_spf.c プロジェクト: kkcloudy/daemongroup
/*
 * Add a vertex to TENT sorted by cost and by vertextype on tie break situation
 */
static struct isis_vertex *
isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
		   void *id, struct isis_adjacency *adj, u_int32_t cost,
		   int depth, int family)
{
  struct isis_vertex *vertex, *v;
  struct listnode *node;
#ifdef EXTREME_DEBUG
  u_char buff[BUFSIZ];
#endif

  vertex = isis_vertex_new (id, vtype);
  vertex->d_N = cost;
  vertex->depth = depth;

  if (adj)
    listnode_add (vertex->Adj_N, adj);
#ifdef EXTREME_DEBUG
  zlog_debug ("ISIS-Spf: add to TENT  %s %s depth %d dist %d",
	      vtype2string (vertex->type), vid2string (vertex, buff),
	      vertex->depth, vertex->d_N);
#endif /* EXTREME_DEBUG */
  listnode_add (spftree->tents, vertex);
  if (list_isempty (spftree->tents))
    {
      listnode_add (spftree->tents, vertex);
      return vertex;
    }
  
  /* XXX: This cant use the standard ALL_LIST_ELEMENT macro */
  for (node = listhead (spftree->tents); node; node = listnextnode (node))
    {
      v = listgetdata (node);
      if (v->d_N > vertex->d_N)
	{
	  list_add_node_prev (spftree->tents, node, vertex);
	  break;
	}
      else if (v->d_N == vertex->d_N)
	{
	  /*  Tie break, add according to type */
	  while (v && v->d_N == vertex->d_N && v->type > vertex->type)
	    {
	      if (v->type > vertex->type)
		{
		  break;
		}
              /* XXX: this seems dubious, node is the loop iterator */
	      node = listnextnode (node);
	      (node) ? (v = listgetdata (node)) : (v = NULL);
	    }
	  list_add_node_prev (spftree->tents, node, vertex);
	  break;
	}
      else if (node->next == NULL)
	{
	  list_add_node_next (spftree->tents, node, vertex);
	  break;
	}
    }
  return vertex;
}