From f06834b80504497824ce50b533ba4fedb6abf2c7 Mon Sep 17 00:00:00 2001 From: hasso Date: Mon, 19 Sep 2005 10:44:04 +0000 Subject: * isis_lsp.c, isis_pdu.c, isis_spf.c: Remove some old unused code. --- isisd/isis_lsp.c | 307 ------------------------------------------------------- 1 file changed, 307 deletions(-) (limited to 'isisd/isis_lsp.c') 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 -- cgit v1.2.1