summaryrefslogtreecommitdiffstats
path: root/isisd/isis_adjacency.c
diff options
context:
space:
mode:
Diffstat (limited to 'isisd/isis_adjacency.c')
-rw-r--r--isisd/isis_adjacency.c79
1 files changed, 35 insertions, 44 deletions
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index d8cb32375..e13b3769e 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -69,11 +69,6 @@ struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa,
adj = adj_alloc(id); /* P2P kludge */
- if (adj == NULL) {
- zlog_err("Out of memory!");
- return NULL;
- }
-
if (snpa) {
memcpy(adj->snpa, snpa, ETH_ALEN);
} else {
@@ -137,12 +132,12 @@ void isis_delete_adj(void *arg)
/* remove from SPF trees */
spftree_area_adj_del(adj->circuit->area, adj);
- if (adj->area_addrs)
- list_delete(adj->area_addrs);
- if (adj->ipv4_addrs)
- list_delete(adj->ipv4_addrs);
- if (adj->ipv6_addrs)
- list_delete(adj->ipv6_addrs);
+ if (adj->area_addresses)
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->area_addresses);
+ if (adj->ipv4_addresses)
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv4_addresses);
+ if (adj->ipv6_addresses)
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv6_addresses);
adj_mt_finish(adj);
@@ -301,10 +296,6 @@ void isis_adj_state_change(struct isis_adjacency *adj,
void isis_adj_print(struct isis_adjacency *adj)
{
struct isis_dynhn *dyn;
- struct listnode *node;
- struct in_addr *ipv4_addr;
- struct in6_addr *ipv6_addr;
- u_char ip6[INET6_ADDRSTRLEN];
if (!adj)
return;
@@ -315,19 +306,19 @@ void isis_adj_print(struct isis_adjacency *adj)
zlog_debug("SystemId %20s SNPA %s, level %d\nHolding Time %d",
sysid_print(adj->sysid), snpa_print(adj->snpa), adj->level,
adj->hold_time);
- if (adj->ipv4_addrs && listcount(adj->ipv4_addrs) > 0) {
+ if (adj->ipv4_address_count) {
zlog_debug("IPv4 Address(es):");
-
- for (ALL_LIST_ELEMENTS_RO(adj->ipv4_addrs, node, ipv4_addr))
- zlog_debug("%s", inet_ntoa(*ipv4_addr));
+ for (unsigned int i = 0; i < adj->ipv4_address_count; i++)
+ zlog_debug("%s", inet_ntoa(adj->ipv4_addresses[i]));
}
- if (adj->ipv6_addrs && listcount(adj->ipv6_addrs) > 0) {
+ if (adj->ipv6_address_count) {
zlog_debug("IPv6 Address(es):");
- for (ALL_LIST_ELEMENTS_RO(adj->ipv6_addrs, node, ipv6_addr)) {
- inet_ntop(AF_INET6, ipv6_addr, (char *)ip6,
- INET6_ADDRSTRLEN);
- zlog_debug("%s", ip6);
+ for (unsigned int i = 0; i < adj->ipv6_address_count; i++) {
+ char buf[INET6_ADDRSTRLEN];
+ inet_ntop(AF_INET6, &adj->ipv6_addresses[i], buf,
+ sizeof(buf));
+ zlog_debug("%s", buf);
}
}
zlog_debug("Speaks: %s", nlpid2string(&adj->nlpids));
@@ -358,13 +349,9 @@ int isis_adj_expire(struct thread *thread)
void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
char detail)
{
- struct in6_addr *ipv6_addr;
- u_char ip6[INET6_ADDRSTRLEN];
- struct in_addr *ip_addr;
time_t now;
struct isis_dynhn *dyn;
int level;
- struct listnode *node;
dyn = dynhn_find_by_id(adj->sysid);
if (dyn)
@@ -452,28 +439,32 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
}
vty_out(vty, "\n");
- if (adj->area_addrs && listcount(adj->area_addrs) > 0) {
- struct area_addr *area_addr;
+ if (adj->area_address_count) {
vty_out(vty, " Area Address(es):\n");
- for (ALL_LIST_ELEMENTS_RO(adj->area_addrs, node,
- area_addr))
+ for (unsigned int i = 0; i < adj->area_address_count;
+ i++) {
vty_out(vty, " %s\n",
- isonet_print(area_addr->area_addr,
- area_addr->addr_len));
+ isonet_print(adj->area_addresses[i]
+ .area_addr,
+ adj->area_addresses[i]
+ .addr_len));
+ }
}
- if (adj->ipv4_addrs && listcount(adj->ipv4_addrs) > 0) {
+ if (adj->ipv4_address_count) {
vty_out(vty, " IPv4 Address(es):\n");
- for (ALL_LIST_ELEMENTS_RO(adj->ipv4_addrs, node,
- ip_addr))
- vty_out(vty, " %s\n", inet_ntoa(*ip_addr));
+ for (unsigned int i = 0; i < adj->ipv4_address_count;
+ i++)
+ vty_out(vty, " %s\n",
+ inet_ntoa(adj->ipv4_addresses[i]));
}
- if (adj->ipv6_addrs && listcount(adj->ipv6_addrs) > 0) {
+ if (adj->ipv6_address_count) {
vty_out(vty, " IPv6 Address(es):\n");
- for (ALL_LIST_ELEMENTS_RO(adj->ipv6_addrs, node,
- ipv6_addr)) {
- inet_ntop(AF_INET6, ipv6_addr, (char *)ip6,
- INET6_ADDRSTRLEN);
- vty_out(vty, " %s\n", ip6);
+ for (unsigned int i = 0; i < adj->ipv6_address_count;
+ i++) {
+ char buf[INET6_ADDRSTRLEN];
+ inet_ntop(AF_INET6, &adj->ipv6_addresses[i],
+ buf, sizeof(buf));
+ vty_out(vty, " %s\n", buf);
}
}
vty_out(vty, "\n");