summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isisd/ChangeLog7
-rw-r--r--isisd/isis_adjacency.c29
-rw-r--r--isisd/isis_circuit.c14
-rw-r--r--isisd/isis_dr.c8
-rw-r--r--isisd/isis_events.c4
-rw-r--r--isisd/isis_lsp.c61
-rw-r--r--isisd/isis_pdu.c44
-rw-r--r--isisd/isis_route.c41
-rw-r--r--isisd/isis_spf.c27
-rw-r--r--isisd/isis_tlv.c51
-rw-r--r--isisd/isisd.c69
11 files changed, 155 insertions, 200 deletions
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index f69364c4..41189d67 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,5 +1,12 @@
2005-09-28 Hasso Tepper <hasso at quagga.net>
+ * *.c: Massive cleanup of lists loops. Stop abusing ALL_LIST_ELEMENTS.
+ Replace XMALLOC + memset with XCALLOC. Fix some indentation issues.
+ The only really significant change is simplified isis_delete_adj
+ function in isis_adjacency.c.
+
+2005-09-28 Hasso Tepper <hasso at quagga.net>
+
* isis_dynh.c, isisd.h: Implement dynamic hostname cache cleanup.
* isis_lsp.c: Refresh dynamic hostname in the cache while refreshing
topology LSP.
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index 3d847732..a898f24b 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -109,7 +109,6 @@ isis_adj_lookup (u_char * sysid, struct list *adjdb)
return NULL;
}
-
struct isis_adjacency *
isis_adj_lookup_snpa (u_char * ssnpa, struct list *adjdb)
{
@@ -123,23 +122,14 @@ isis_adj_lookup_snpa (u_char * ssnpa, struct list *adjdb)
return NULL;
}
-/*
- * When we recieve a NULL list, we will know its p2p
- */
void
isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb)
{
- struct isis_adjacency *adj2 = NULL;
- struct listnode *node;
-
+ if (!adj)
+ return;
+ /* When we recieve a NULL list, we will know its p2p. */
if (adjdb)
- {
- for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj2))
- if (adj2 == adj)
- break;
-
- listnode_delete (adjdb, adj);
- }
+ listnode_delete (adjdb, adj);
if (adj->ipv4_addrs)
list_delete (adj->ipv4_addrs);
@@ -147,15 +137,8 @@ isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb)
if (adj->ipv6_addrs)
list_delete (adj->ipv6_addrs);
#endif
- if (adj)
- {
- XFREE (MTYPE_ISIS_ADJACENCY, adj);
- }
- else
- {
- zlog_warn ("tried to delete a non-existent adjacency");
- }
-
+
+ XFREE (MTYPE_ISIS_ADJACENCY, adj);
return;
}
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 23cb0ac7..ee73dc44 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -66,10 +66,9 @@ isis_circuit_new ()
struct isis_circuit *circuit;
int i;
- circuit = XMALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
+ circuit = XCALLOC (MTYPE_ISIS_CIRCUIT, sizeof (struct isis_circuit));
if (circuit)
{
- memset (circuit, 0, sizeof (struct isis_circuit));
/* set default metrics for circuit */
for (i = 0; i < 2; i++)
{
@@ -621,14 +620,13 @@ isis_interface_config_write (struct vty *vty)
{
int write = 0;
- struct listnode *node, *nnode;
- struct listnode *node2, *nnode2;
+ struct listnode *node, *node2;
struct interface *ifp;
struct isis_area *area;
struct isis_circuit *c;
int i;
- for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
/* IF name */
vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
@@ -640,7 +638,7 @@ isis_interface_config_write (struct vty *vty)
write++;
}
/* ISIS Circuit */
- for (ALL_LIST_ELEMENTS (isis->area_list, node2, nnode2, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node2, area))
{
c = circuit_lookup_by_ifp (ifp, area->circuit_list);
if (c)
@@ -892,7 +890,7 @@ DEFUN (no_ip_router_isis,
struct isis_circuit *circuit = NULL;
struct interface *ifp;
struct isis_area *area;
- struct listnode *node, *nnode;
+ struct listnode *node;
ifp = (struct interface *) vty->index;
assert (ifp);
@@ -903,7 +901,7 @@ DEFUN (no_ip_router_isis,
vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
return CMD_WARNING;
}
- for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
+ for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
if (circuit->interface == ifp)
break;
if (!circuit)
diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c
index 335946c8..8d306c8f 100644
--- a/isisd/isis_dr.c
+++ b/isisd/isis_dr.c
@@ -130,7 +130,7 @@ int
isis_dr_elect (struct isis_circuit *circuit, int level)
{
struct list *adjdb;
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_adjacency *adj, *adj_dr = NULL;
struct list *list = list_new ();
u_char own_prio;
@@ -152,7 +152,7 @@ isis_dr_elect (struct isis_circuit *circuit, int level)
/*
* Loop the adjacencies and find the one with the biggest priority
*/
- for (ALL_LIST_ELEMENTS (list, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (list, node, adj))
{
/* clear flag for show output */
adj->dis_record[level - 1].dis = ISIS_IS_NOT_DIS;
@@ -214,7 +214,7 @@ isis_dr_elect (struct isis_circuit *circuit, int level)
*/
/* rotate the history log */
- for (ALL_LIST_ELEMENTS (list, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (list, node, adj))
isis_check_dr_change (adj, level);
/* commence */
@@ -234,7 +234,7 @@ isis_dr_elect (struct isis_circuit *circuit, int level)
* if yes rotate the history log
*/
- for (ALL_LIST_ELEMENTS (list, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (list, node, adj))
isis_check_dr_change (adj, level);
/*
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index a8e60d6d..07736fd7 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -88,7 +88,7 @@ isis_event_circuit_state_change (struct isis_circuit *circuit, int up)
void
isis_event_system_type_change (struct isis_area *area, int newtype)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_circuit *circuit;
if (isis->debugs & DEBUG_EVENTS)
@@ -125,7 +125,7 @@ isis_event_system_type_change (struct isis_area *area, int newtype)
}
area->is_type = newtype;
- for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
+ for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
isis_event_circuit_type_change (circuit, newtype);
spftree_area_init (area);
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index f4a42a60..7b4491c2 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -329,14 +329,14 @@ static void
lsp_seqnum_update (struct isis_lsp *lsp0)
{
struct isis_lsp *lsp;
- struct listnode *node, *nnode;
+ struct listnode *node;
lsp_inc_seqnum (lsp0, 0);
if (!lsp0->lspu.frags)
return;
- for (ALL_LIST_ELEMENTS (lsp0->lspu.frags, node, nnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (lsp0->lspu.frags, node, lsp))
lsp_inc_seqnum (lsp, 0);
return;
@@ -720,7 +720,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
struct isis_lsp *lsp = dnode_get (node);
struct area_addr *area_addr;
int i;
- struct listnode *lnode, *lnnode;
+ struct listnode *lnode;
struct is_neigh *is_neigh;
struct te_is_neigh *te_is_neigh;
struct ipv4_reachability *ipv4_reach;
@@ -742,8 +742,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* for all area address */
if (lsp->tlv_data.area_addrs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.area_addrs, lnode,
- lnnode, area_addr))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.area_addrs, lnode, area_addr))
{
vty_out (vty, " Area Address: %s%s",
isonet_print (area_addr->area_addr, area_addr->addr_len),
@@ -779,8 +778,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
}
if (lsp->tlv_data.ipv4_addrs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.ipv4_addrs, lnode,
- lnnode, ipv4_addr))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_addrs, lnode, ipv4_addr))
{
memcpy (ipv4_address, inet_ntoa (*ipv4_addr), sizeof (ipv4_address));
vty_out (vty, " IP: %s%s", ipv4_address, VTY_NEWLINE);
@@ -796,7 +794,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* for the IS neighbor tlv */
if (lsp->tlv_data.is_neighs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.is_neighs, lnode, lnnode, is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.is_neighs, lnode, is_neigh))
{
lspid_print (is_neigh->neigh_id, LSPid, dynhost, 0);
vty_out (vty, " Metric: %-10d IS %s%s",
@@ -805,8 +803,8 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* for the internal reachable tlv */
if (lsp->tlv_data.ipv4_int_reachs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.ipv4_int_reachs, lnode,
- lnnode, ipv4_reach))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_int_reachs, lnode,
+ ipv4_reach))
{
memcpy (ipv4_reach_prefix, inet_ntoa (ipv4_reach->prefix),
sizeof (ipv4_reach_prefix));
@@ -819,8 +817,8 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* for the external reachable tlv */
if (lsp->tlv_data.ipv4_ext_reachs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.ipv4_ext_reachs, lnode,
- lnnode, ipv4_reach))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_ext_reachs, lnode,
+ ipv4_reach))
{
memcpy (ipv4_reach_prefix, inet_ntoa (ipv4_reach->prefix),
sizeof (ipv4_reach_prefix));
@@ -834,8 +832,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* IPv6 tlv */
#ifdef HAVE_IPV6
if (lsp->tlv_data.ipv6_reachs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.ipv6_reachs, lnode,
- lnnode, ipv6_reach))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv6_reachs, lnode, ipv6_reach))
{
memset (&in6, 0, sizeof (in6));
memcpy (in6.s6_addr, ipv6_reach->prefix,
@@ -855,8 +852,7 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* TE IS neighbor tlv */
if (lsp->tlv_data.te_is_neighs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.te_is_neighs, lnode,
- lnnode, te_is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.te_is_neighs, lnode, te_is_neigh))
{
uint32_t metric;
memcpy (&metric, te_is_neigh->te_metric, 3);
@@ -867,8 +863,8 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
/* TE IPv4 tlv */
if (lsp->tlv_data.te_ipv4_reachs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.te_ipv4_reachs, lnode,
- lnnode, te_ipv4_reach))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.te_ipv4_reachs, lnode,
+ te_ipv4_reach))
{
/* FIXME: There should be better way to output this stuff. */
vty_out (vty, " Metric: %-10d IP-Extended %s/%d%s",
@@ -1015,7 +1011,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
{
struct is_neigh *is_neigh;
struct te_is_neigh *te_is_neigh;
- struct listnode *node, *nnode, *ipnode, *ipnnode;
+ struct listnode *node, *ipnode;
int level = lsp->level;
struct isis_circuit *circuit;
struct prefix_ipv4 *ipv4;
@@ -1139,8 +1135,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
tlv_data.is_neighs = list_new ();
tlv_data.is_neighs->del = free_tlv;
}
- is_neigh = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
- memset (is_neigh, 0, sizeof (struct is_neigh));
+ is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
memcpy (&is_neigh->neigh_id, area->topology_baseis, ISIS_SYS_ID_LEN);
is_neigh->neigh_id[ISIS_SYS_ID_LEN - 1] = (1 & 0xFF);
@@ -1156,7 +1151,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
/*
* Then build lists of tlvs related to circuits
*/
- for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
+ for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
{
if (circuit->state != C_STATE_UP)
continue;
@@ -1174,7 +1169,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
tlv_data.ipv4_int_reachs = list_new ();
tlv_data.ipv4_int_reachs->del = free_tlv;
}
- for (ALL_LIST_ELEMENTS (circuit->ip_addrs, ipnode, ipnnode, ipv4))
+ for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, ipnode, ipv4))
{
ipreach =
XMALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv4_reachability));
@@ -1193,7 +1188,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
tlv_data.te_ipv4_reachs = list_new ();
tlv_data.te_ipv4_reachs->del = free_tlv;
}
- for (ALL_LIST_ELEMENTS (circuit->ip_addrs, ipnode, ipnnode, ipv4))
+ for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, ipnode, ipv4))
{
/* FIXME All this assumes that we have no sub TLVs. */
te_ipreach = XCALLOC (MTYPE_ISIS_TLV,
@@ -1225,8 +1220,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
tlv_data.ipv6_reachs = list_new ();
tlv_data.ipv6_reachs->del = free_tlv;
}
- for (ALL_LIST_ELEMENTS (circuit->ipv6_non_link, ipnode, ipnnode,
- ipv6))
+ for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, ipnode, ipv6))
{
ip6reach =
XCALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv6_reachability));
@@ -1698,7 +1692,7 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct isis_circuit *circuit,
struct te_is_neigh *te_is_neigh;
struct es_neigh *es_neigh;
struct list *adj_list;
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_passwd *passwd;
assert (circuit);
@@ -1744,7 +1738,7 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct isis_circuit *circuit,
adj_list = list_new ();
isis_adj_build_up_list (circuit->u.bc.adjdb[level - 1], adj_list);
- for (ALL_LIST_ELEMENTS (adj_list, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (adj_list, node, adj))
{
if (adj->circuit_t & level)
{
@@ -1993,7 +1987,7 @@ lsp_tick (struct thread *thread)
struct isis_circuit *circuit;
struct isis_lsp *lsp;
struct list *lsp_list;
- struct listnode *lspnode, *lspnnode, *cnode;
+ struct listnode *lspnode, *cnode;
dnode_t *dnode, *dnode_next;
int level;
@@ -2045,7 +2039,7 @@ lsp_tick (struct thread *thread)
{
for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
{
- for (ALL_LIST_ELEMENTS (lsp_list, lspnode, lspnnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (lsp_list, lspnode, lsp))
{
if (ISIS_CHECK_FLAG (lsp->SRMflags, circuit))
{
@@ -2246,7 +2240,7 @@ void
build_topology_lsp_data (struct isis_lsp *lsp, struct isis_area *area,
int lsp_top_num)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct arc *arc;
struct is_neigh *is_neigh;
struct te_is_neigh *te_is_neigh;
@@ -2292,8 +2286,7 @@ build_topology_lsp_data (struct isis_lsp *lsp, struct isis_area *area,
/* Add reachability for this IS for simulated 1. */
if (lsp_top_num == 1)
{
- is_neigh = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
- memset (is_neigh, 0, sizeof (struct is_neigh));
+ is_neigh = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct is_neigh));
memcpy (&is_neigh->neigh_id, isis->sysid, ISIS_SYS_ID_LEN);
LSP_PSEUDO_ID (is_neigh->neigh_id) = 0x00;
@@ -2306,7 +2299,7 @@ build_topology_lsp_data (struct isis_lsp *lsp, struct isis_area *area,
}
/* Add IS reachabilities. */
- for (ALL_LIST_ELEMENTS (area->topology, node, nnode, arc))
+ for (ALL_LIST_ELEMENTS_RO (area->topology, node, arc))
{
int to_lsp = 0;
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 591b4912..90a51a21 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -80,12 +80,11 @@ static int
area_match (struct list *left, struct list *right)
{
struct area_addr *addr1, *addr2;
- struct listnode *node1, *nnode1;
- struct listnode *node2, *nnode2;
+ struct listnode *node1, *node2;
- for (ALL_LIST_ELEMENTS (left, node1, nnode1, addr1))
+ for (ALL_LIST_ELEMENTS_RO (left, node1, addr1))
{
- for (ALL_LIST_ELEMENTS (right, node2, nnode2, addr2))
+ for (ALL_LIST_ELEMENTS_RO (right, node2, addr2))
{
if (addr1->addr_len == addr2->addr_len &&
!memcmp (addr1->area_addr, addr2->area_addr, (int) addr1->addr_len))
@@ -140,15 +139,14 @@ ip_match (struct list *left, struct list *right)
{
struct prefix_ipv4 *ip1;
struct in_addr *ip2;
- struct listnode *node1, *nnode1;
- struct listnode *node2, *nnode2;
+ struct listnode *node1, *node2;
if ((left == NULL) || (right == NULL))
return 0;
- for (ALL_LIST_ELEMENTS (left, node1, nnode1, ip1))
+ for (ALL_LIST_ELEMENTS_RO (left, node1, ip1))
{
- for (ALL_LIST_ELEMENTS (right, node2, nnode2, ip2))
+ for (ALL_LIST_ELEMENTS_RO (right, node2, ip2))
{
if (ip_same_subnet (ip1, ip2))
{
@@ -225,7 +223,7 @@ del_ip_addr (void *val)
static void
tlvs_to_adj_ipv4_addrs (struct tlvs *tlvs, struct isis_adjacency *adj)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct in_addr *ipv4_addr, *malloced;
if (adj->ipv4_addrs)
@@ -236,7 +234,7 @@ tlvs_to_adj_ipv4_addrs (struct tlvs *tlvs, struct isis_adjacency *adj)
adj->ipv4_addrs = list_new ();
if (tlvs->ipv4_addrs)
{
- for (ALL_LIST_ELEMENTS (tlvs->ipv4_addrs, node, nnode, ipv4_addr))
+ for (ALL_LIST_ELEMENTS_RO (tlvs->ipv4_addrs, node, ipv4_addr))
{
malloced = XMALLOC (MTYPE_ISIS_TMP, sizeof (struct in_addr));
memcpy (malloced, ipv4_addr, sizeof (struct in_addr));
@@ -249,7 +247,7 @@ tlvs_to_adj_ipv4_addrs (struct tlvs *tlvs, struct isis_adjacency *adj)
static void
tlvs_to_adj_ipv6_addrs (struct tlvs *tlvs, struct isis_adjacency *adj)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct in6_addr *ipv6_addr, *malloced;
if (adj->ipv6_addrs)
@@ -260,7 +258,7 @@ tlvs_to_adj_ipv6_addrs (struct tlvs *tlvs, struct isis_adjacency *adj)
adj->ipv6_addrs = list_new ();
if (tlvs->ipv6_addrs)
{
- for (ALL_LIST_ELEMENTS (tlvs->ipv6_addrs, node, nnode, ipv6_addr))
+ for (ALL_LIST_ELEMENTS_RO (tlvs->ipv6_addrs, node, ipv6_addr))
{
malloced = XMALLOC (MTYPE_ISIS_TMP, sizeof (struct in6_addr));
memcpy (malloced, ipv6_addr, sizeof (struct in6_addr));
@@ -663,7 +661,7 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
u_int32_t expected = 0, found;
struct tlvs tlvs;
u_char *snpa;
- struct listnode *node, *nnode;
+ struct listnode *node;
if ((stream_get_endp (circuit->rcv_stream) -
stream_get_getp (circuit->rcv_stream)) < ISIS_LANHELLO_HDRLEN)
@@ -886,7 +884,7 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
{
if (adj->adj_state != ISIS_ADJ_UP)
{
- for (ALL_LIST_ELEMENTS (tlvs.lan_neighs, node, nnode, snpa))
+ for (ALL_LIST_ELEMENTS_RO (tlvs.lan_neighs, node, snpa))
if (!memcmp (snpa, circuit->u.bc.snpa, ETH_ALEN))
{
isis_adj_state_change (adj, ISIS_ADJ_UP,
@@ -1436,7 +1434,7 @@ process_snp (int snp_type, int level, struct isis_circuit *circuit,
typechar, snpa_print (ssnpa), circuit->interface->name);
if (tlvs.lsp_entries)
{
- for (ALL_LIST_ELEMENTS (tlvs.lsp_entries, node, nnode, entry))
+ for (ALL_LIST_ELEMENTS_RO (tlvs.lsp_entries, node, entry))
{
zlog_debug ("ISIS-Snp (%s): %cSNP entry %s, seq 0x%08x,"
" cksum 0x%04x, lifetime %us",
@@ -1452,7 +1450,7 @@ process_snp (int snp_type, int level, struct isis_circuit *circuit,
/* 7.3.15.2 b) Actions on LSP_ENTRIES reported */
if (tlvs.lsp_entries)
{
- for (ALL_LIST_ELEMENTS (tlvs.lsp_entries, node, nnode, entry))
+ for (ALL_LIST_ELEMENTS_RO (tlvs.lsp_entries, node, entry))
{
lsp = lsp_search (entry->lsp_id, circuit->area->lspdb[level - 1]);
own_lsp = !memcmp (entry->lsp_id, isis->sysid, ISIS_SYS_ID_LEN);
@@ -1532,7 +1530,7 @@ process_snp (int snp_type, int level, struct isis_circuit *circuit,
}
}
/* on remaining LSPs we set SRM (neighbor knew not of) */
- for (ALL_LIST_ELEMENTS (lsp_list, node2, nnode2, lsp))
+ for (ALL_LIST_ELEMENTS_RO (lsp_list, node, lsp))
{
ISIS_SET_FLAG (lsp->SRMflags, circuit);
}
@@ -2192,7 +2190,7 @@ send_csnp (struct isis_circuit *circuit, int level)
u_char start[ISIS_SYS_ID_LEN + 2];
u_char stop[ISIS_SYS_ID_LEN + 2];
struct list *list = NULL;
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_lsp *lsp;
memset (start, 0x00, ISIS_SYS_ID_LEN + 2);
@@ -2217,7 +2215,7 @@ send_csnp (struct isis_circuit *circuit, int level)
circuit->area->area_tag, level, circuit->interface->name,
/* FIXME: use %z when we stop supporting old compilers. */
(unsigned long) STREAM_SIZE (circuit->snd_stream));
- for (ALL_LIST_ELEMENTS (list, node, nnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (list, node, lsp))
{
zlog_debug ("ISIS-Snp (%s): CSNP entry %s, seq 0x%08x,"
" cksum 0x%04x, lifetime %us",
@@ -2290,7 +2288,7 @@ build_psnp (int level, struct isis_circuit *circuit, struct list *lsps)
int retval = 0;
struct isis_lsp *lsp;
struct isis_passwd *passwd;
- struct listnode *node, *nnode;
+ struct listnode *node;
if (level == 1)
fill_fixed_hdr_andstream (&fixed_hdr, L1_PARTIAL_SEQ_NUM,
@@ -2328,7 +2326,7 @@ build_psnp (int level, struct isis_circuit *circuit, struct list *lsps)
if (isis->debugs & DEBUG_SNP_PACKETS)
{
- for (ALL_LIST_ELEMENTS (lsps, node, nnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (lsps, node, lsp))
{
zlog_debug ("ISIS-Snp (%s): PSNP entry %s, seq 0x%08x,"
" cksum 0x%04x, lifetime %us",
@@ -2358,7 +2356,7 @@ send_psnp (int level, struct isis_circuit *circuit)
int retval = ISIS_OK;
struct isis_lsp *lsp;
struct list *list = NULL;
- struct listnode *node, *nnode;
+ struct listnode *node;
if ((circuit->circ_type == CIRCUIT_T_BROADCAST &&
!circuit->u.bc.is_dr[level - 1]) ||
@@ -2397,7 +2395,7 @@ send_psnp (int level, struct isis_circuit *circuit)
* sending succeeded, we can clear SSN flags of this circuit
* for the LSPs in list
*/
- for (ALL_LIST_ELEMENTS (list, node, nnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (list, node, lsp))
ISIS_CLEAR_FLAG (lsp->SSNflags, circuit);
}
}
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index e4513125..b9b25e2c 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -70,13 +70,12 @@ isis_nexthop_create (struct in_addr *ip, unsigned int ifindex)
return nexthop;
}
- nexthop = XMALLOC (MTYPE_ISIS_NEXTHOP, sizeof (struct isis_nexthop));
+ nexthop = XCALLOC (MTYPE_ISIS_NEXTHOP, sizeof (struct isis_nexthop));
if (!nexthop)
{
zlog_err ("ISIS-Rte: isis_nexthop_create: out of memory!");
}
- memset (nexthop, 0, sizeof (struct isis_nexthop));
nexthop->ifindex = ifindex;
memcpy (&nexthop->ip, ip, sizeof (struct in_addr));
listnode_add (isis->nexthops, nexthop);
@@ -143,13 +142,12 @@ isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
struct isis_nexthop6 *nexthop6;
- nexthop6 = XMALLOC (MTYPE_ISIS_NEXTHOP6, sizeof (struct isis_nexthop6));
+ nexthop6 = XCALLOC (MTYPE_ISIS_NEXTHOP6, sizeof (struct isis_nexthop6));
if (!nexthop6)
{
zlog_err ("ISIS-Rte: isis_nexthop_create6: out of memory!");
}
- memset (nexthop6, 0, sizeof (struct isis_nexthop6));
nexthop6->ifindex = ifindex;
memcpy (&nexthop6->ip6, ip6, sizeof (struct in6_addr));
nexthop6->lock++;
@@ -236,13 +234,13 @@ static void
adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj)
{
struct isis_nexthop *nh;
- struct listnode *node, *nnode;
+ struct listnode *node;
struct in_addr *ipv4_addr;
if (adj->ipv4_addrs == NULL)
return;
- for (ALL_LIST_ELEMENTS (adj->ipv4_addrs, node, nnode, ipv4_addr))
+ for (ALL_LIST_ELEMENTS_RO (adj->ipv4_addrs, node, ipv4_addr))
{
if (!nexthoplookup (nexthops, ipv4_addr,
adj->circuit->interface->ifindex))
@@ -258,14 +256,14 @@ adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj)
static void
adjinfo2nexthop6 (struct list *nexthops6, struct isis_adjacency *adj)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct in6_addr *ipv6_addr;
struct isis_nexthop6 *nh6;
if (!adj->ipv6_addrs)
return;
- for (ALL_LIST_ELEMENTS (adj->ipv6_addrs, node, nnode, ipv6_addr))
+ for (ALL_LIST_ELEMENTS_RO (adj->ipv6_addrs, node, ipv6_addr))
{
if (!nexthop6lookup (nexthops6, ipv6_addr,
adj->circuit->interface->ifindex))
@@ -284,27 +282,26 @@ isis_route_info_new (uint32_t cost, uint32_t depth, u_char family,
{
struct isis_route_info *rinfo;
struct isis_adjacency *adj;
- struct listnode *node, *nnode;
+ struct listnode *node;
- rinfo = XMALLOC (MTYPE_ISIS_ROUTE_INFO, sizeof (struct isis_route_info));
+ rinfo = XCALLOC (MTYPE_ISIS_ROUTE_INFO, sizeof (struct isis_route_info));
if (!rinfo)
{
zlog_err ("ISIS-Rte: isis_route_info_new: out of memory!");
return NULL;
}
- memset (rinfo, 0, sizeof (struct isis_route_info));
if (family == AF_INET)
{
rinfo->nexthops = list_new ();
- for (ALL_LIST_ELEMENTS (adjacencies, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (adjacencies, node, adj))
adjinfo2nexthop (rinfo->nexthops, adj);
}
#ifdef HAVE_IPV6
if (family == AF_INET6)
{
rinfo->nexthops6 = list_new ();
- for (ALL_LIST_ELEMENTS (adjacencies, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (adjacencies, node, adj))
adjinfo2nexthop6 (rinfo->nexthops6, adj);
}
@@ -352,7 +349,7 @@ static int
isis_route_info_same (struct isis_route_info *new,
struct isis_route_info *old, u_char family)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_nexthop *nexthop;
#ifdef HAVE_IPV6
struct isis_nexthop6 *nexthop6;
@@ -362,12 +359,12 @@ isis_route_info_same (struct isis_route_info *new,
if (family == AF_INET)
{
- for (ALL_LIST_ELEMENTS (new->nexthops, node, nnode, nexthop))
+ for (ALL_LIST_ELEMENTS_RO (new->nexthops, node, nexthop))
if (nexthoplookup (old->nexthops, &nexthop->ip, nexthop->ifindex)
== 0)
return 0;
- for (ALL_LIST_ELEMENTS (old->nexthops, node, nnode, nexthop))
+ for (ALL_LIST_ELEMENTS_RO (old->nexthops, node, nexthop))
if (nexthoplookup (new->nexthops, &nexthop->ip, nexthop->ifindex)
== 0)
return 0;
@@ -375,12 +372,12 @@ isis_route_info_same (struct isis_route_info *new,
#ifdef HAVE_IPV6
else if (family == AF_INET6)
{
- for (ALL_LIST_ELEMENTS (new->nexthops6, node, nnode, nexthop6))
+ for (ALL_LIST_ELEMENTS_RO (new->nexthops6, node, nexthop6))
if (nexthop6lookup (old->nexthops6, &nexthop6->ip6,
nexthop6->ifindex) == 0)
return 0;
- for (ALL_LIST_ELEMENTS (old->nexthops6, node, nnode, nexthop6))
+ for (ALL_LIST_ELEMENTS_RO (old->nexthops6, node, nexthop6))
if (nexthop6lookup (new->nexthops6, &nexthop6->ip6,
nexthop6->ifindex) == 0)
return 0;
@@ -393,10 +390,10 @@ isis_route_info_same (struct isis_route_info *new,
static void
isis_nexthops_merge (struct list *new, struct list *old)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_nexthop *nexthop;
- for (ALL_LIST_ELEMENTS (new, node, nnode, nexthop))
+ for (ALL_LIST_ELEMENTS_RO (new, node, nexthop))
{
if (nexthoplookup (old, &nexthop->ip, nexthop->ifindex))
continue;
@@ -409,10 +406,10 @@ isis_nexthops_merge (struct list *new, struct list *old)
static void
isis_nexthops6_merge (struct list *new, struct list *old)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_nexthop6 *nexthop6;
- for (ALL_LIST_ELEMENTS (new, node, nnode, nexthop6))
+ for (ALL_LIST_ELEMENTS_RO (new, node, nexthop6))
{
if (nexthop6lookup (old, &nexthop6->ip6, nexthop6->ifindex))
continue;
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 4cbc2cd1..d9375496 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -62,11 +62,11 @@ int isis_run_spf_l2 (struct thread *thread);
static void
remove_excess_adjs (struct list *adjs)
{
- struct listnode *node, *nnode, *excess = NULL;
+ struct listnode *node, *excess = NULL;
struct isis_adjacency *adj, *candidate = NULL;
int comp;
- for (ALL_LIST_ELEMENTS (adjs, node, nnode, adj))
+ for (ALL_LIST_ELEMENTS_RO (adjs, node, adj))
{
if (excess == NULL)
excess = node;
@@ -195,13 +195,12 @@ isis_spftree_new ()
{
struct isis_spftree *tree;
- tree = XMALLOC (MTYPE_ISIS_SPFTREE, sizeof (struct isis_spftree));
+ tree = XCALLOC (MTYPE_ISIS_SPFTREE, sizeof (struct isis_spftree));
if (tree == NULL)
{
zlog_err ("ISIS-Spf: isis_spftree_new Out of memory!");
return NULL;
}
- memset (tree, 0, sizeof (struct isis_spftree));
tree->tents = list_new ();
tree->paths = list_new ();
@@ -266,14 +265,13 @@ isis_vertex_new (void *id, enum vertextype vtype)
{
struct isis_vertex *vertex;
- vertex = XMALLOC (MTYPE_ISIS_VERTEX, sizeof (struct isis_vertex));
+ vertex = XCALLOC (MTYPE_ISIS_VERTEX, sizeof (struct isis_vertex));
if (vertex == NULL)
{
zlog_err ("isis_vertex_new Out of memory!");
return NULL;
}
- memset (vertex, 0, sizeof (struct isis_vertex));
vertex->type = vtype;
switch (vtype)
{
@@ -697,7 +695,7 @@ isis_spf_process_pseudo_lsp (struct isis_spftree *spftree,
struct isis_lsp *lsp, uint16_t cost,
uint16_t depth, int family)
{
- struct listnode *node, *nnode, *fragnode = NULL;
+ struct listnode *node, *fragnode = NULL;
struct is_neigh *is_neigh;
struct te_is_neigh *te_is_neigh;
enum vertextype vtype;
@@ -712,7 +710,7 @@ pseudofragloop:
}
if (lsp->tlv_data.is_neighs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.is_neighs, node, nnode, is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.is_neighs, node, is_neigh))
{
vtype = LSP_PSEUDO_ID (is_neigh->neigh_id) ? VTYPE_PSEUDO_IS
: VTYPE_NONPSEUDO_IS;
@@ -730,7 +728,7 @@ pseudofragloop:
}
}
if (lsp->tlv_data.te_is_neighs)
- for (ALL_LIST_ELEMENTS (lsp->tlv_data.te_is_neighs, node, nnode, te_is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.te_is_neighs, node, te_is_neigh))
{
vtype = LSP_PSEUDO_ID (te_is_neigh->neigh_id) ? VTYPE_PSEUDO_TE_IS
: VTYPE_NONPSEUDO_TE_IS;
@@ -768,9 +766,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
{
struct isis_vertex *vertex;
struct isis_circuit *circuit;
- struct listnode *cnode, *cnnode;
- struct listnode *anode;
- struct listnode *ipnode, *ipnnode;
+ struct listnode *cnode, *anode, *ipnode;
struct isis_adjacency *adj;
struct isis_lsp *lsp;
struct list *adj_list;
@@ -783,7 +779,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
struct prefix_ipv6 *ipv6;
#endif /* HAVE_IPV6 */
- for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnnode, circuit))
+ for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
{
if (circuit->state != C_STATE_UP)
continue;
@@ -801,7 +797,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
if (family == AF_INET)
{
prefix.family = AF_INET;
- for (ALL_LIST_ELEMENTS (circuit->ip_addrs, ipnode, ipnnode, ipv4))
+ for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, ipnode, ipv4))
{
prefix.u.prefix4 = ipv4->prefix;
prefix.prefixlen = ipv4->prefixlen;
@@ -813,8 +809,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
if (family == AF_INET6)
{
prefix.family = AF_INET6;
- for (ALL_LIST_ELEMENTS (circuit->ipv6_non_link,
- ipnode, ipnnode, ipv6))
+ for (ALL_LIST_ELEMENTS_RO (circuit->ipv6_non_link, ipnode, ipv6))
{
prefix.prefixlen = ipv6->prefixlen;
prefix.u.prefix6 = ipv6->prefix;
diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c
index 4f8ab393..7b99ab5d 100644
--- a/isisd/isis_tlv.c
+++ b/isisd/isis_tlv.c
@@ -771,7 +771,7 @@ err:
int
tlv_add_is_neighs (struct list *is_neighs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct is_neigh *is_neigh;
u_char value[255];
u_char *pos = value;
@@ -780,7 +780,7 @@ tlv_add_is_neighs (struct list *is_neighs, struct stream *stream)
*pos = 0; /*is_neigh->virtual; */
pos++;
- for (ALL_LIST_ELEMENTS (is_neighs, node, nnode, is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (is_neighs, node, is_neigh))
{
if (pos - value + IS_NEIGHBOURS_LEN > 255)
{
@@ -807,13 +807,13 @@ tlv_add_is_neighs (struct list *is_neighs, struct stream *stream)
int
tlv_add_te_is_neighs (struct list *te_is_neighs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct te_is_neigh *te_is_neigh;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (te_is_neighs, node, nnode, te_is_neigh))
+ for (ALL_LIST_ELEMENTS_RO (te_is_neighs, node, te_is_neigh))
{
/* FIXME: This will be wrong if we are going to add TE sub TLVs. */
if (pos - value + IS_NEIGHBOURS_LEN > 255)
@@ -839,13 +839,13 @@ tlv_add_te_is_neighs (struct list *te_is_neighs, struct stream *stream)
int
tlv_add_lan_neighs (struct list *lan_neighs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
u_char *snpa;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (lan_neighs, node, nnode, snpa))
+ for (ALL_LIST_ELEMENTS_RO (lan_neighs, node, snpa))
{
if (pos - value + ETH_ALEN > 255)
{
@@ -861,24 +861,9 @@ tlv_add_lan_neighs (struct list *lan_neighs, struct stream *stream)
return add_tlv (LAN_NEIGHBOURS, pos - value, value, stream);
}
-/*
- u_char value[255];
- u_char *pos = value;
-
- if (circuit->ip_router) {
- *pos = (u_char)NLPID_IP;
- pos ++;
- }
- if (circuit->ipv6_router) {
- *pos = (u_char)NLPID_IPV6;
- pos ++;
- }
-*/
-
int
tlv_add_nlpid (struct nlpids *nlpids, struct stream *stream)
{
-
return add_tlv (PROTOCOLS_SUPPORTED, nlpids->count, nlpids->nlpids, stream);
}
@@ -905,13 +890,13 @@ tlv_add_checksum (struct checksum *checksum, struct stream *stream)
int
tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct prefix_ipv4 *ipv4;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (ip_addrs, node, nnode, ipv4))
+ for (ALL_LIST_ELEMENTS_RO (ip_addrs, node, ipv4))
{
if (pos - value + IPV4_MAX_BYTELEN > 255)
{
@@ -951,13 +936,13 @@ tlv_add_dynamic_hostname (struct hostname *hostname, struct stream *stream)
int
tlv_add_lsp_entries (struct list *lsps, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_lsp *lsp;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (lsps, node, nnode, lsp))
+ for (ALL_LIST_ELEMENTS_RO (lsps, node, lsp))
{
if (pos - value + LSP_ENTRIES_LEN > 255)
{
@@ -982,13 +967,13 @@ tlv_add_lsp_entries (struct list *lsps, struct stream *stream)
int
tlv_add_ipv4_reachs (struct list *ipv4_reachs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct ipv4_reachability *reach;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (ipv4_reachs, node, nnode, reach))
+ for (ALL_LIST_ELEMENTS_RO (ipv4_reachs, node, reach))
{
if (pos - value + IPV4_REACH_LEN > 255)
{
@@ -1019,14 +1004,14 @@ tlv_add_ipv4_reachs (struct list *ipv4_reachs, struct stream *stream)
int
tlv_add_te_ipv4_reachs (struct list *te_ipv4_reachs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct te_ipv4_reachability *te_reach;
u_char value[255];
u_char *pos = value;
u_char prefix_size;
int retval;
- for (ALL_LIST_ELEMENTS (te_ipv4_reachs, node, nnode, te_reach))
+ for (ALL_LIST_ELEMENTS_RO (te_ipv4_reachs, node, te_reach))
{
prefix_size = ((((te_reach->control & 0x3F) - 1) >> 3) + 1);
@@ -1053,13 +1038,13 @@ tlv_add_te_ipv4_reachs (struct list *te_ipv4_reachs, struct stream *stream)
int
tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct prefix_ipv6 *ipv6;
u_char value[255];
u_char *pos = value;
int retval;
- for (ALL_LIST_ELEMENTS (ipv6_addrs, node, nnode, ipv6))
+ for (ALL_LIST_ELEMENTS_RO (ipv6_addrs, node, ipv6))
{
if (pos - value + IPV6_MAX_BYTELEN > 255)
{
@@ -1078,13 +1063,13 @@ tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream)
int
tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream)
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct ipv6_reachability *ip6reach;
u_char value[255];
u_char *pos = value;
int retval, prefix_octets;
- for (ALL_LIST_ELEMENTS (ipv6_reachs, node, nnode, ip6reach))
+ for (ALL_LIST_ELEMENTS_RO (ipv6_reachs, node, ip6reach))
{
if (pos - value + IPV6_MAX_BYTELEN + 6 > 255)
{
diff --git a/isisd/isisd.c b/isisd/isisd.c
index dbaae8a8..84e1c889 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -144,9 +144,9 @@ struct isis_area *
isis_area_lookup (const char *area_tag)
{
struct isis_area *area;
- struct listnode *node, *nnode;
+ struct listnode *node;
- for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
if ((area->area_tag == NULL && area_tag == NULL) ||
(area->area_tag && area_tag
&& strcmp (area->area_tag, area_tag) == 0))
@@ -222,7 +222,7 @@ area_net_title (struct vty *vty, u_char *net_title)
struct isis_area *area;
struct area_addr *addr;
struct area_addr *addrp;
- struct listnode *node, *nnode;
+ struct listnode *node;
u_char buff[255];
area = vty->index;
@@ -282,17 +282,16 @@ area_net_title (struct vty *vty, u_char *net_title)
}
/* now we see that we don't already have this address */
- for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addrp))
- {
- if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == (addr->addr_len))
- {
- if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
- {
- XFREE (MTYPE_ISIS_AREA_ADDR, addr);
- return CMD_SUCCESS; /* silent fail */
- }
- }
- }
+ for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
+ {
+ if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))
+ continue;
+ if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
+ {
+ XFREE (MTYPE_ISIS_AREA_ADDR, addr);
+ return CMD_SUCCESS; /* silent fail */
+ }
+ }
}
/*
@@ -316,7 +315,7 @@ area_clear_net_title (struct vty *vty, u_char *net_title)
{
struct isis_area *area;
struct area_addr addr, *addrp = NULL;
- struct listnode *node, *nnode;
+ struct listnode *node;
u_char buff[255];
area = vty->index;
@@ -336,7 +335,7 @@ area_clear_net_title (struct vty *vty, u_char *net_title)
memcpy (addr.area_addr, buff, (int) addr.addr_len);
- for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addrp))
+ for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
if (addrp->addr_len == addr.addr_len &&
!memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
break;
@@ -360,7 +359,7 @@ area_clear_net_title (struct vty *vty, u_char *net_title)
int
show_clns_neigh (struct vty *vty, char detail)
{
- struct listnode *anode, *annode, *cnode, *cnnode;
+ struct listnode *anode, *cnode;
struct isis_area *area;
struct isis_circuit *circuit;
struct list *db;
@@ -372,7 +371,7 @@ show_clns_neigh (struct vty *vty, char detail)
return CMD_SUCCESS;
}
- for (ALL_LIST_ELEMENTS (isis->area_list, anode, annode, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
{
vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
@@ -380,7 +379,7 @@ show_clns_neigh (struct vty *vty, char detail)
vty_out (vty, " System Id Interface L State "
"Holdtime SNPA%s", VTY_NEWLINE);
- for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnnode, circuit))
+ for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
{
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
{
@@ -896,14 +895,14 @@ DEFUN (show_database,
"show isis database",
SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_area *area;
int level, lsp_count;
if (isis->area_list->count == 0)
return CMD_SUCCESS;
- for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
@@ -934,14 +933,14 @@ DEFUN (show_database_detail,
"IS-IS information\n"
"IS-IS link state database\n")
{
- struct listnode *node, *nnode;
+ struct listnode *node;
struct isis_area *area;
int level, lsp_count;
if (isis->area_list->count == 0)
return CMD_SUCCESS;
- for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
@@ -1874,10 +1873,9 @@ isis_config_write (struct vty *vty)
if (isis != NULL)
{
struct isis_area *area;
- struct listnode *node, *nnode;
- struct listnode *node2, *nnode2;
+ struct listnode *node, *node2;
- for (ALL_LIST_ELEMENTS (isis->area_list, node, nnode, area))
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
/* ISIS - Area name */
vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
@@ -1886,16 +1884,17 @@ isis_config_write (struct vty *vty)
if (listcount (area->area_addrs) > 0)
{
struct area_addr *area_addr;
- for (ALL_LIST_ELEMENTS (area->area_addrs, node2, nnode2, area_addr))
- {
- vty_out (vty, " net %s%s",
- isonet_print (area_addr->area_addr,
- area_addr->addr_len + ISIS_SYS_ID_LEN +
- 1), VTY_NEWLINE);
- write++;
- }
+ for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
+ {
+ vty_out (vty, " net %s%s",
+ isonet_print (area_addr->area_addr,
+ area_addr->addr_len + ISIS_SYS_ID_LEN +
+ 1), VTY_NEWLINE);
+ write++;
+ }
}
- /* ISIS - Dynamic hostname - Defaults to true so only display if false */
+ /* ISIS - Dynamic hostname - Defaults to true so only display if
+ * false. */
if (!area->dynhostname)
{
vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);