From 2097cd8a7a1322b2853f1b9cbbe7f39c436f553e Mon Sep 17 00:00:00 2001 From: hasso Date: Tue, 23 Dec 2003 11:51:08 +0000 Subject: Some fixes to isisd done by me and Cougar in the spring of 2003. See changelog for details. --- isisd/ChangeLog | 16 ++++++++++++++++ isisd/isis_adjacency.c | 15 +++++++++++---- isisd/isis_circuit.c | 30 +----------------------------- isisd/isis_constants.h | 3 +++ isisd/isis_lsp.c | 39 +++++++++++++++++++++++++++++++++++++-- isisd/isis_misc.c | 11 ++++++++++- isisd/isis_spf.c | 4 +++- isisd/isis_tlv.c | 7 ++++--- isisd/isis_zebra.c | 4 ++++ isisd/isisd.c | 4 ++-- 10 files changed, 91 insertions(+), 42 deletions(-) (limited to 'isisd') diff --git a/isisd/ChangeLog b/isisd/ChangeLog index 78580ea1..5f4eabe2 100644 --- a/isisd/ChangeLog +++ b/isisd/ChangeLog @@ -1,3 +1,19 @@ +2003-12-23 Hasso Tepper + Some fixes done by me and Cougar . + * isis_adjacency.c: Two bugfixes by Cougar: + After down state neigbour was deleted but not removed from neighbours list. + Don't show random expire time during neighbour initialisation. + * isis_circuit.c: Don't show interface addresses in config by Cougar. + * isis_constants.h, isis_misc.c: Show other well-known NLPID names as well + by Cougar. + * isisd.c: Two tiny CLI fixes by me. + * isis_lsp.c: Bugfix in lsp_print_detail() by Cougar. + Show IPv4 external and IPv6 TLV's in "show isis database detail" by me. + * isis_misc.c: Net address format fix by Cougar. + * isis_spf.c: Dead loop fix in isis_spf_preload_tent() by Cougar + * isis_zebra.c: Ignore distance when adding route to zebra for now by me. + * isis_tlv.c: Parse external IPv4 TLV's correctly by me. + Version 0.0.7 to 0.0.8 ====================== diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 8079bd17..de747692 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -146,7 +146,7 @@ isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb) if (adj2 == adj) break; } - listnode_delete (adjdb, node); + listnode_delete (adjdb, adj); } if (adj->ipv4_addrs) @@ -336,7 +336,10 @@ isis_adj_print_vty2 (struct isis_adjacency *adj, struct vty *vty, char detail) vty_out (vty, "%-3u", adj->level); /* level */ vty_out (vty, "%-13s", adj_state2string (adj->adj_state)); now = time (NULL); - vty_out (vty, "%-9lu", adj->last_upd + adj->hold_time - now); + if (adj->last_upd) + vty_out (vty, "%-9lu", adj->last_upd + adj->hold_time - now); + else + vty_out (vty, "- "); vty_out (vty, "%-10s", snpa_print (adj->snpa)); vty_out (vty, "%s", VTY_NEWLINE); } @@ -352,8 +355,12 @@ isis_adj_print_vty2 (struct isis_adjacency *adj, struct vty *vty, char detail) vty_out (vty, ", Level: %u", adj->level); /* level */ vty_out (vty, ", State: %s", adj_state2string (adj->adj_state)); now = time (NULL); - vty_out (vty, ", Expires in %s", - time2string (adj->last_upd + adj->hold_time - now)); + if (adj->last_upd) + vty_out (vty, ", Expires in %s", + time2string (adj->last_upd + adj->hold_time - now)); + else + vty_out (vty, ", Expires in %s", + time2string (adj->hold_time)); vty_out (vty, "%s Adjacency flaps: %u", VTY_NEWLINE, adj->flaps); diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index f37c314e..53a341f7 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -553,35 +553,6 @@ isis_interface_config_write (struct vty *vty) write++; } #endif /* HAVE_IPV6 */ - /* ipv4 addresses - FIXME: those should be related to interface*/ - if (c->ip_addrs) {LIST_LOOP (c->ip_addrs,ip, node3) - { - vty_out (vty, " ip%s address %s/%d%s", - ip->family == AF_INET ? "" : "v6", - inet_ntop (ip->family, &ip->prefix, buf, BUFSIZ), ip->prefixlen, - VTY_NEWLINE); - write++; - }} - - /* ipv6 addresses - FIXME: those should be related to interface*/ -#ifdef HAVE_IPV6 - if (c->ipv6_link) {LIST_LOOP (c->ipv6_link, ipv6, node3) - { - vty_out (vty, " ip%s address %s/%d%s", - ipv6->family == AF_INET ? "" : "v6", - inet_ntop (ipv6->family, &ipv6->prefix, buf, BUFSIZ), - ipv6->prefixlen,VTY_NEWLINE); - write++; - }} - if (c->ipv6_non_link) {LIST_LOOP (c->ipv6_non_link, ipv6, node3) - { - vty_out (vty, " ip%s address %s/%d%s", - ipv6->family == AF_INET ? "" : "v6", - inet_ntop (ipv6->family, &ipv6->prefix, buf, BUFSIZ), - ipv6->prefixlen, VTY_NEWLINE); - write++; - }} -#endif /* HAVE_IPV6 */ /* ISIS - circuit type */ if (c->circuit_is_type == IS_LEVEL_1) { @@ -690,6 +661,7 @@ isis_interface_config_write (struct vty *vty) } } + vty_out (vty, "!%s",VTY_NEWLINE); } return write; diff --git a/isisd/isis_constants.h b/isisd/isis_constants.h index c5b59aa3..852b8a1f 100644 --- a/isisd/isis_constants.h +++ b/isisd/isis_constants.h @@ -82,6 +82,9 @@ */ #define NLPID_IP 204 #define NLPID_IPV6 142 +#define NLPID_SNAP 128 +#define NLPID_CLNP 129 +#define NLPID_ESIS 130 /* * Return values for functions diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index f797b9e6..3f6a57b9 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -764,7 +764,7 @@ lsp_print_detail (dnode_t *node, struct vty *vty, char dynhost) if (lsp->tlv_data.ipv4_addrs) { LIST_LOOP(lsp->tlv_data.ipv4_addrs, ipv4_addr, lnode) { - memcpy (ipv4_address, inet_ntoa (*ipv4_addr), sizeof (ipv4_addr)); + memcpy (ipv4_address, inet_ntoa (*ipv4_addr), sizeof (ipv4_address)); vty_out (vty, " IP: %s%s", ipv4_address, VTY_NEWLINE); @@ -776,7 +776,19 @@ lsp_print_detail (dnode_t *node, struct vty *vty, char dynhost) LIST_LOOP(lsp->tlv_data.ipv4_int_reachs, ipv4_reach, lnode) { memcpy (ipv4_reach_prefix, inet_ntoa (ipv4_reach->prefix), sizeof (ipv4_reach_prefix)); memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask), sizeof (ipv4_reach_mask)); - vty_out (vty, " Matric: %d IP %s %s%s", + vty_out (vty, " Metric: %d IP %s %s%s", + ipv4_reach->metrics.metric_default, + ipv4_reach_prefix, + ipv4_reach_mask, + VTY_NEWLINE); + } + + /* for the external reachable tlv */ + if (lsp->tlv_data.ipv4_ext_reachs) + LIST_LOOP(lsp->tlv_data.ipv4_ext_reachs, ipv4_reach, lnode) { + memcpy (ipv4_reach_prefix, inet_ntoa (ipv4_reach->prefix), sizeof (ipv4_reach_prefix)); + memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask), sizeof (ipv4_reach_mask)); + vty_out (vty, " Metric: %d IP-External %s %s%s", ipv4_reach->metrics.metric_default, ipv4_reach_prefix, ipv4_reach_mask, @@ -794,6 +806,29 @@ lsp_print_detail (dnode_t *node, struct vty *vty, char dynhost) } } + /* IPv6 tlv */ +#ifdef HAVE_IPV6 + if (lsp->tlv_data.ipv6_reachs) + LIST_LOOP(lsp->tlv_data.ipv6_reachs, ipv6_reach, lnode) { + memset(&in6, 0, sizeof(in6)); + memcpy (in6.s6_addr, ipv6_reach->prefix, PSIZE(ipv6_reach->prefix_len)); + inet_ntop (AF_INET6, &in6, buff, BUFSIZ); + if ((ipv6_reach->control_info && + CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL) + vty_out (vty, " Metric: %d IPv6-Intern %s/%d%s", + ntohl (ipv6_reach->metric), + buff, + ipv6_reach->prefix_len, + VTY_NEWLINE); + else + vty_out (vty, " Metric: %d IPv6-Extern %s/%d%s", + ntohl (ipv6_reach->metric), + buff, + ipv6_reach->prefix_len, + VTY_NEWLINE); + } +#endif + /* FIXME: Other tlvs such as te or external tlv will be added later */ #if 0 vty_out (vty, "%s %s %c%s", diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index cf558e83..1f19606c 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -63,7 +63,7 @@ char * isonet_print (u_char *from, int len) { sprintf ( pos, "%02x", *(from + i)); pos += 2; } else { - if (i == 0) { /* if the area addr is just one byte, eg. 47. */ + if (i == (len - 1)) { /* No dot at the end of address */ sprintf ( pos, "%02x", *(from + i)); pos += 2; } else { @@ -187,6 +187,15 @@ nlpid2string (struct nlpids *nlpids) { case NLPID_IPV6: pos += sprintf (pos, "IPv6"); break; + case NLPID_SNAP: + pos += sprintf (pos, "SNAP"); + break; + case NLPID_CLNP: + pos += sprintf (pos, "CLNP"); + break; + case NLPID_ESIS: + pos += sprintf (pos, "ES-IS"); + break; default: pos += sprintf (pos, "unknown"); break; diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index d6949817..37c435e0 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -743,8 +743,10 @@ isis_spf_preload_tent (struct isis_spftree *spftree, anode = listhead (adj_list); while (anode) { adj = getdata (anode); - if (!speaks (&adj->nlpids, family)) + if (!speaks (&adj->nlpids, family)) { + anode = nextnode (anode); continue; + } switch (adj->sys_type) { case ISIS_SYSTYPE_ES: isis_spf_add_local (spftree, VTYPE_ES, adj->sysid, adj, diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index b51cee91..eb673d9f 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -511,16 +511,17 @@ parse_tlvs (char *areatag, u_char *stream, int size, u_int32_t *expected, * +---------------------------------------------------------------+ * : : */ - *found |= TLVFLAG_TE_IPV4_REACHABILITY; + *found |= TLVFLAG_IPV4_EXT_REACHABILITY; #ifdef EXTREME_TLV_DEBUG zlog_info ("ISIS-TLV (%s): IPv4 external Reachability length %d", areatag, length); #endif /* EXTREME_TLV_DEBUG */ - if (*expected & TLVFLAG_TE_IPV4_REACHABILITY) { + if (*expected & TLVFLAG_IPV4_EXT_REACHABILITY) { while (length > value_len) { ipv4_reach = (struct ipv4_reachability*)pnt; - if (!tlvs->ipv4_ext_reachs) tlvs->ipv4_ext_reachs = list_new(); + if (!tlvs->ipv4_ext_reachs) + tlvs->ipv4_ext_reachs = list_new(); listnode_add (tlvs->ipv4_ext_reachs, ipv4_reach); value_len += 12; pnt += 12; diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index d9179f91..3b83e7a1 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -232,7 +232,9 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix, SET_FLAG (message, ZAPI_MESSAGE_NEXTHOP); SET_FLAG (message, ZAPI_MESSAGE_METRIC); +#if 0 SET_FLAG (message, ZAPI_MESSAGE_DISTANCE); +#endif stream = zclient->obuf; stream_reset (stream); @@ -265,8 +267,10 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix, stream_putl (stream, nexthop->ifindex); } } +#if 0 if (CHECK_FLAG (message, ZAPI_MESSAGE_DISTANCE)) stream_putc (stream, route_info->depth); +#endif if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC)) stream_putl (stream, route_info->cost); diff --git a/isisd/isisd.c b/isisd/isisd.c index 3b8a0a62..135acf0e 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1419,7 +1419,7 @@ DEFUN (no_dynamic_hostname, DEFUN (spf_interval, spf_interval_cmd, "spf-interval <1-120>", - "Minimum interval between SPF calculations" + "Minimum interval between SPF calculations\n" "Minimum interval between consecutive SPFs in seconds\n") { struct isis_area *area; @@ -1936,7 +1936,7 @@ isis_config_write (struct vty *vty) struct cmd_node isis_node = { ISIS_NODE, - "%s(config_router)# ", + "%s(config-router)# ", 1 }; -- cgit v1.2.1