summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isisd/ChangeLog4
-rw-r--r--isisd/isis_lsp.c307
-rw-r--r--isisd/isis_pdu.c101
-rw-r--r--isisd/isis_spf.c22
4 files changed, 4 insertions, 430 deletions
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 3735b4fc..36098d17 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,5 +1,9 @@
2005-09-19 Hasso Tepper <hasso at quagga.net>
+ * isis_lsp.c, isis_pdu.c, isis_spf.c: Remove some old unused code.
+
+2005-09-19 Hasso Tepper <hasso at quagga.net>
+
* isis_lsp.c: Better output of detailed LSP printout and fixed TE IPv4
reachibility metric display.
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index d02f3833..b7ddfd9d 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -915,246 +915,6 @@ lsp_print_all (struct vty *vty, dict_t * lspdb, char detail, char dynhost)
return lsp_count;
}
-#if 0
-/* this function reallocate memory to an lsp pdu, with an additional
- * size of memory, it scans the lsp and moves all pointers the
- * way they should */
-static u_char *
-lsppdu_realloc (struct isis_lsp * lsp, int memorytype, int size)
-{
- u_char *retval;
-
- retval = STREAM_DATA (lsp->pdu) + ntohs (lsp->lsp_header->pdu_len);
-#ifdef LSP_MEMORY_PREASSIGN
- lsp->lsp_header->pdu_len = htons (ntohs (lsp->lsp_header->pdu_len) + size);
- return retval;
-#else /* otherwise we have to move all pointers */
- u_char *newpdu;
- newpdu = stream_new (ntohs (lsp->lsp_header->pdu_len) + size);
- stream_put (newpdu, STREAM_DATA(lsp->pdu), ntohs (lsp->lsp_header->pdu_len));
- XFREE (memorytype, lsp->pdu);
- lsp->pdu = newpdu;
- lsp->isis_header = (struct isis_fixed_hdr *) STREAM_DATA (lsp->pdu);
- lsp->lsp_header = (struct isis_link_state_hdr *)
- (STREAM_DATA (lsp->pdu) + ISIS_FIXED_HDR_LEN);
- htons (ntohs (lsp->lsp_header->pdu_len) += size);
- return STREAM_DATA (lsp->pdu) + (lsp->lsp_header->pdu_len - size);
-#endif /* LSP_MEMORY_PREASSIGN */
-}
-#endif
-
-#if 0 /* Saving the old one just in case :) */
-/*
- * Builds the lsp->tlv_data
- * and writes the tlvs into lsp->pdu
- */
-void
-lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
-{
- struct is_neigh *is_neigh;
- struct listnode *node, *nnode, *ipnode, *ipnnode;
- int level = lsp->level;
- struct isis_circuit *circuit;
- struct prefix_ipv4 *ipv4;
- struct ipv4_reachability *ipreach;
- struct isis_adjacency *nei;
-#ifdef HAVE_IPV6
- struct prefix_ipv6 *ipv6;
- struct ipv6_reachability *ip6reach;
-#endif /* HAVE_IPV6 */
-
- /*
- * First add the tlvs related to area
- */
-
- /* Area addresses */
- if (lsp->tlv_data.area_addrs == NULL)
- lsp->tlv_data.area_addrs = list_new ();
- list_add_list (lsp->tlv_data.area_addrs, area->area_addrs);
- /* Protocols Supported */
- if (area->ip_circuits > 0
-#ifdef HAVE_IPV6
- || area->ipv6_circuits > 0
-#endif /* HAVE_IPV6 */
- )
- {
- lsp->tlv_data.nlpids = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct nlpids));
- lsp->tlv_data.nlpids->count = 0;
- if (area->ip_circuits > 0)
- {
- lsp->tlv_data.nlpids->count++;
- lsp->tlv_data.nlpids->nlpids[0] = NLPID_IP;
- }
-#ifdef HAVE_IPV6
- if (area->ipv6_circuits > 0)
- {
- lsp->tlv_data.nlpids->count++;
- lsp->tlv_data.nlpids->nlpids[lsp->tlv_data.nlpids->count - 1] =
- NLPID_IPV6;
- }
-#endif /* HAVE_IPV6 */
- }
- /* Dynamic Hostname */
- if (area->dynhostname)
- {
- lsp->tlv_data.hostname = XMALLOC (MTYPE_ISIS_TLV,
- sizeof (struct hostname));
- memcpy (&lsp->tlv_data.hostname->name, unix_hostname (),
- strlen (unix_hostname ()));
- lsp->tlv_data.hostname->namelen = strlen (unix_hostname ());
- }
-#ifdef TOPOLOGY_GENERATE
- /*
- * If we have a topology in this area, we need to connect this lsp to
- * the first topology lsp
- */
- if ((area->topology) && (level == 1))
- {
- if (lsp->tlv_data.is_neighs == NULL)
- lsp->tlv_data.is_neighs = list_new ();
- is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
- memcpy (&is_neigh->neigh_id, area->topology_baseis, ISIS_SYS_ID_LEN);
- /* connected to the first */
- is_neigh->neigh_id[ISIS_SYS_ID_LEN - 1] = (0x01);
- /* this is actually the same system, why mess the SPT */
- is_neigh->metrics.metric_default = 0;
- is_neigh->metrics.metric_delay = METRICS_UNSUPPORTED;
- is_neigh->metrics.metric_expense = METRICS_UNSUPPORTED;
- is_neigh->metrics.metric_error = METRICS_UNSUPPORTED;
- listnode_add (lsp->tlv_data.is_neighs, is_neigh);
-
- }
-#endif
-
- /*
- * Then add tlvs related to circuits
- */
- for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
- {
- if (circuit->state != C_STATE_UP)
- continue;
-
- /*
- * Add IPv4 internal reachability of this circuit
- */
- if (circuit->ip_router && circuit->ip_addrs &&
- circuit->ip_addrs->count > 0)
- {
- if (lsp->tlv_data.ipv4_int_reachs == NULL)
- {
- lsp->tlv_data.ipv4_int_reachs = list_new ();
- lsp->tlv_data.ipv4_int_reachs->del = free_tlv;
- }
- for (ALL_LIST_ELEMENTS (circuit->ip_addrs, ipnode, ipnnode, ipv4))
- {
- ipreach =
- XCALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv4_reachability));
- ipreach->metrics = circuit->metrics[level - 1];
- ipreach->prefix = ipv4->prefix;
- masklen2ip (ipv4->prefixlen, &ipreach->mask);
- listnode_add (lsp->tlv_data.ipv4_int_reachs, ipreach);
- }
- }
-#ifdef HAVE_IPV6
- /*
- * Add IPv6 reachability of this circuit
- */
- if (circuit->ipv6_router && circuit->ipv6_non_link &&
- circuit->ipv6_non_link->count > 0)
- {
- if (lsp->tlv_data.ipv6_reachs == NULL)
- {
- lsp->tlv_data.ipv6_reachs = list_new ();
- lsp->tlv_data.ipv6_reachs->del = free_tlv;
- }
- for (ALL_LIST_ELEMENTS (circuit->ipv6_non_link, ipnode,
- ipnnode, ipv6))
- {
- ip6reach =
- XCALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv6_reachability));
- ip6reach->metric =
- htonl (circuit->metrics[level - 1].metric_default);
- ip6reach->control_info = 0;
- ip6reach->prefix_len = ipv6->prefixlen;
- memcpy (&ip6reach->prefix, ipv6->prefix.s6_addr,
- (ipv6->prefixlen + 7) / 8);
- listnode_add (lsp->tlv_data.ipv6_reachs, ip6reach);
- }
- }
-#endif /* HAVE_IPV6 */
-
- switch (circuit->circ_type)
- {
- case CIRCUIT_T_BROADCAST:
- if (level & circuit->circuit_is_type)
- {
- if (lsp->tlv_data.is_neighs == NULL)
- {
- lsp->tlv_data.is_neighs = list_new ();
- lsp->tlv_data.is_neighs->del = free_tlv;
- }
- is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
- if (level == 1)
- memcpy (&is_neigh->neigh_id,
- circuit->u.bc.l1_desig_is, ISIS_SYS_ID_LEN + 1);
- else
- memcpy (&is_neigh->neigh_id,
- circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1);
- is_neigh->metrics = circuit->metrics[level - 1];
- listnode_add (lsp->tlv_data.is_neighs, is_neigh);
- }
- break;
- case CIRCUIT_T_P2P:
- nei = circuit->u.p2p.neighbor;
- if (nei && (level & nei->circuit_t))
- {
- if (lsp->tlv_data.is_neighs == NULL)
- {
- lsp->tlv_data.is_neighs = list_new ();
- lsp->tlv_data.is_neighs->del = free_tlv;
- }
- is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
- memcpy (&is_neigh->neigh_id, nei->sysid, ISIS_SYS_ID_LEN);
- is_neigh->metrics = circuit->metrics[level - 1];
- listnode_add (lsp->tlv_data.is_neighs, is_neigh);
- }
- break;
- case CIRCUIT_T_STATIC_IN:
- zlog_warn ("lsp_area_create: unsupported circuit type");
- break;
- case CIRCUIT_T_STATIC_OUT:
- zlog_warn ("lsp_area_create: unsupported circuit type");
- break;
- case CIRCUIT_T_DA:
- zlog_warn ("lsp_area_create: unsupported circuit type");
- break;
- default:
- zlog_warn ("lsp_area_create: unknown circuit type");
- }
- }
-
- if (lsp->tlv_data.nlpids)
- tlv_add_nlpid (lsp->tlv_data.nlpids, lsp->pdu);
- if (lsp->tlv_data.hostname)
- tlv_add_dynamic_hostname (lsp->tlv_data.hostname, lsp->pdu);
- if (lsp->tlv_data.area_addrs && listcount (lsp->tlv_data.area_addrs) > 0)
- tlv_add_area_addrs (lsp->tlv_data.area_addrs, lsp->pdu);
- if (lsp->tlv_data.is_neighs && listcount (lsp->tlv_data.is_neighs) > 0)
- tlv_add_is_neighs (lsp->tlv_data.is_neighs, lsp->pdu);
- if (lsp->tlv_data.ipv4_int_reachs &&
- listcount (lsp->tlv_data.ipv4_int_reachs) > 0)
- tlv_add_ipv4_reachs (lsp->tlv_data.ipv4_int_reachs, lsp->pdu);
-#ifdef HAVE_IPV6
- if (lsp->tlv_data.ipv6_reachs && listcount (lsp->tlv_data.ipv6_reachs) > 0)
- tlv_add_ipv6_reachs (lsp->tlv_data.ipv6_reachs, lsp->pdu);
-#endif /* HAVE_IPV6 */
-
- lsp->lsp_header->pdu_len = htons (stream_get_endp (lsp->pdu));
-
- return;
-}
-#endif
-
#define FRAG_THOLD(S,T) \
((STREAM_SIZE(S)*T)/100)
@@ -1244,7 +1004,6 @@ lsp_next_frag (u_char frag_num, struct isis_lsp *lsp0, struct isis_area *area,
* Builds the LSP data part. This func creates a new frag whenever
* area->lsp_frag_threshold is exceeded.
*/
-#if 1
static void
lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
{
@@ -1536,72 +1295,6 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
return;
}
-#endif
-
-#if 0 /* Old code? */
-static void
-build_lsp_data (struct isis_lsp *lsp, struct isis_area *area)
-{
- struct list *circuit_list = area->circuit_list;
- struct isis_circuit *circuit;
- u_char *tlv_ptr;
- struct is_neigh *is_neigh;
-
-
- /* add our nlpids */
- /* the 2 is for the TL plus 1 for the nlpid */
- tlv_ptr = lsppdu_realloc (lsp, MTYPE_ISIS_TLV, 3);
- *tlv_ptr = PROTOCOLS_SUPPORTED; /* Type */
- *(tlv_ptr + 1) = 1; /* one protocol */
-#ifdef HAVE_IPV6 /*dunno if its right */
- *(tlv_ptr + 2) = NLPID_IPV6;
-#else
- *(tlv_ptr + 2) = NLPID_IP;
-#endif /* HAVE_IPV6 */
-
- /* we should add our areas here
- * FIXME: we need to figure out which should be added? Adj? All? First? */
-
- /* first, lets add ourselves to the IS neighbours info */
- /* the 2 is for the TL plus 1 for the virtual field */
- tlv_ptr = lsppdu_realloc (lsp, MTYPE_ISIS_TLV, 3);
- *tlv_ptr = IS_NEIGHBOURS; /* Type */
- *(tlv_ptr + 2) = 0; /* virtual is zero */
- lsp->tlv_data.is_neighs = list_new (); /* new list of is_neighbours */
- /* assign space for the is_neigh at the pdu end */
- is_neigh = (struct is_neigh *) lsppdu_realloc (lsp, MTYPE_ISIS_TLV,
- sizeof (struct is_neigh));
- /* add this node to our list */
- listnode_add (lsp->tlv_data.is_neighs, is_neigh);
- /* FIXME: Do we need our designated address here? */
- memcpy (&is_neigh->neigh_id, isis->sysid, ISIS_SYS_ID_LEN + 1);
- /* FIXME: Where should we really get our own LSPs metrics from? */
- circuit = (struct isis_circuit *) listhead (circuit_list);
- /* is_neigh->metrics = circuit->metrics[lsp->level -1]; */
- /* Length */
- *(tlv_ptr + 1) =
- (lsp->tlv_data.is_neighs->count * sizeof (struct is_neigh) + 1);
-
- /* FIXME: scan for adjencecies and add them */
-
- /* FIXME: add reachability info */
-
- /* adding dynamic hostname if needed */
- if (area->dynhostname)
- {
- tlv_ptr = lsppdu_realloc (lsp, MTYPE_ISIS_TLV, 2); /* the 2 is for the TL */
- *tlv_ptr = DYNAMIC_HOSTNAME; /* Type */
- *(tlv_ptr + 1) = strlen (unix_hostname ()); /* Length */
- lsp->tlv_data.hostname = (struct hostname *)
- (lsppdu_realloc (lsp, MTYPE_ISIS_TLV,
- /* the -1 is to fit the length in the struct */
- strlen (unix_hostname ())) - 1);
- memcpy (lsp->tlv_data.hostname->name, unix_hostname (),
- strlen (unix_hostname ()));
- }
-
-}
-#endif /* 0 */
/*
* 7.3.7 Generation on non-pseudonode LSPs
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 87f37901..591b4912 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -2452,19 +2452,6 @@ send_l2_psnp (struct thread *thread)
return retval;
}
-/* FIXME: Not used any more? */
-/* static void
-build_link_state (struct isis_lsp *lsp, struct isis_circuit *circuit,
- struct stream *stream)
-{
- unsigned long length;
-
- stream_put (stream, lsp->pdu, ntohs (lsp->lsp_header->pdu_len));
- length = stream_get_endp (stream);
-
- return;
-} */
-
/*
* ISO 10589 - 7.3.14.3
*/
@@ -2606,91 +2593,3 @@ ack_lsp (struct isis_link_state_hdr *hdr, struct isis_circuit *circuit,
return retval;
}
-#if 0
-/*
- * ISH PDU Processing
- */
-
- /*
- * Let's first check if the local and remote system have any common area
- * addresses
- */
-if (area_match (tlvs.area_addrs, isis->man_area_addrs) == 0)
- {
- if (circuit->circuit_t == IS_LEVEL_2)
- {
- /* do as in table 8 (p. 40) */
- switch (circuit_type)
- {
- case IS_LEVEL_1:
- if (adj->adj_state != ISIS_ADJ_UP)
- {
- /* Reject */
- zlog_warn ("areaMismatch");
- retval = ISIS_WARNING;
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL1)
- {
- isis_adj_state_change (adj, ISIS_ADJ_DOWN, "Area Mismatch",
- circuit->adjdb);
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL1AND2 ||
- adj->adj_usage == ISIS_ADJ_LEVEL2)
- {
- isis_adj_state_change (adj, ISIS_ADJ_DOWN, "Wrong System",
- circuit->adjdb);
- }
- break;
- case IS_LEVEL_2:
- if (adj->adj_state != ISIS_ADJ_UP)
- {
- isis_adj_state_change (adj, ISIS_ADJ_UP, NULL,
- circuit->adjdb);
- adj->adj_usage = ISIS_ADJ_LEVEL2;
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL1 ||
- adj->adj_usage == ISIS_ADJ_LEVEL1AND2)
- {
- isis_adj_state_change (adj, ISIS_ADJ_DOWN, "Wrong System",
- circuit->adjdb);
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL2)
- {
- ; /* Accept */
- }
- break;
- case IS_LEVEL_1_AND_2:
- if (adj->adj_state != ISIS_ADJ_UP)
- {
- isis_adj_state_change (adj, ISIS_ADJ_UP, NULL,
- circuit->adjdb);
- adj->adj_usage = ISIS_ADJ_LEVEL2;
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL1)
- {
- isis_adj_state_change (adj, ISIS_ADJ_DOWN, "Wrong System",
- circuit->adjdb);
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL1AND2)
- {
- isis_adj_state_change (adj, ISIS_ADJ_DOWN, "Area Mismatch",
- circuit->adjdb);
- }
- else if (adj->adj_usage == ISIS_ADJ_LEVEL2)
- {
- ; /* Accept */
- }
- break;
- }
- goto mismatch;
- }
- else
- {
- isis_delete_adj (adj, circuit->adjdb);
- zlog_warn ("areaMismatch");
- return ISIS_WARNING;
- }
- }
-
-mismatch:
-#endif
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index ba7acbfb..1a5a2db0 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -58,28 +58,6 @@ extern struct host host;
int isis_run_spf_l1 (struct thread *thread);
int isis_run_spf_l2 (struct thread *thread);
-#if 0
-/* performace issue ???? HT: Old or new code? */
-static void
-union_adjlist (struct list *target, struct list *source)
-{
- struct isis_adjacency *adj, *adj2;
- struct listnode *node, *node2;
-
- zlog_debug ("Union adjlist!");
- for (ALL_LIST_ELEMENTS_RO (source, node, adj))
- {
- /* lookup adjacency in the source list */
- for (ALL_LIST_ELEMENTS_RO (target, node2, adj2))
- if (adj == adj2)
- break;
-
- if (!node2)
- listnode_add (target, adj);
- }
-}
-#endif
-
/* 7.2.7 */
static void
remove_excess_adjs (struct list *adjs)