#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.78 2003-03-30 01:21:13 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.102 2003-10-28 19:10:15 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "ethertype.h"
#include "ether.h"
#include "extract.h"
+#include "gmpls.h"
#define NLPID_CLNS 129 /* 0x81 */
#define NLPID_ESIS 130 /* 0x82 */
#define TLV_ISNEIGH_VARLEN 7 /* iso10589 */
#define TLV_PADDING 8 /* iso10589 */
#define TLV_LSP 9 /* iso10589 */
-#define TLV_AUTH 10 /* iso10589, draft-ietf-isis-hmac-03 */
+#define TLV_AUTH 10 /* iso10589, rfc3567 */
#define TLV_CHECKSUM 12 /* rfc3358 */
#define TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
-#define TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-04 */
+#define TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
#define TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
#define TLV_DECNET_PHASE4 42
#define TLV_LUCENT_PRIVATE 66
#define TLV_IDRP_INFO 131 /* rfc1195 */
#define TLV_IPADDR 132 /* rfc1195 */
#define TLV_IPAUTH 133 /* rfc1195 */
-#define TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-04 */
-#define TLV_EXT_IP_REACH 135 /* draft-ietf-isis-traffic-04 */
+#define TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
+#define TLV_EXT_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
#define TLV_HOSTNAME 137 /* rfc2763 */
-#define TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions-14 */
+#define TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
#define TLV_NORTEL_PRIVATE1 176
#define TLV_NORTEL_PRIVATE2 177
#define TLV_HOLDTIME 198 /* ES-IS */
{ TLV_IS_ALIAS_ID, "IS Alias ID"},
{ TLV_DECNET_PHASE4, "DECnet Phase IV"},
{ TLV_LUCENT_PRIVATE, "Lucent Proprietary"},
- { TLV_IP_REACH, "IPv4 Internal reachability"},
+ { TLV_IP_REACH, "IPv4 Internal Reachability"},
{ TLV_PROTOCOLS, "Protocols supported"},
- { TLV_IP_REACH_EXT, "IPv4 External reachability"},
+ { TLV_IP_REACH_EXT, "IPv4 External Reachability"},
{ TLV_IDRP_INFO, "Inter-Domain Information Type"},
{ TLV_IPADDR, "IPv4 Interface address(es)"},
{ TLV_IPAUTH, "IPv4 authentication (deprecated)"},
{ TLV_TE_ROUTER_ID, "Traffic Engineering Router ID"},
- { TLV_EXT_IP_REACH, "Extended IPv4 reachability"},
+ { TLV_EXT_IP_REACH, "Extended IPv4 Reachability"},
{ TLV_HOSTNAME, "Hostname"},
{ TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
{ TLV_NORTEL_PRIVATE1, "Nortel Proprietary"},
{ TLV_MT_IS_REACH, "Multi Topology IS Reachability"},
{ TLV_MT_SUPPORTED, "Multi Topology"},
{ TLV_IP6ADDR, "IPv6 Interface address(es)"},
- { TLV_MT_IP_REACH, "Multi-Topology IPv4 reachability"},
+ { TLV_MT_IP_REACH, "Multi-Topology IPv4 Reachability"},
{ TLV_IP6_REACH, "IPv6 reachability"},
- { TLV_MT_IP6_REACH, "Multi-Topology IP6 reachability"},
+ { TLV_MT_IP6_REACH, "Multi-Topology IP6 Reachability"},
{ TLV_PTP_ADJ, "Point-to-point Adjacency State"},
{ TLV_IIH_SEQNR, "Hello PDU Sequence Number"},
{ TLV_VENDOR_PRIVATE, "Vendor Private"},
{ 0, NULL }
};
-#define SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3
-#define SUBTLV_EXT_IS_REACH_LINK_LOCAL_ID 4
-#define SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5
-#define SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6
-#define SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8
-#define SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9
-#define SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10
-#define SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11
-#define SUBTLV_EXT_IS_REACH_TE_METRIC 18
-#define SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20
-#define SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21
+#define SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* draft-ietf-isis-gmpls-extensions */
+#define SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* draft-ietf-isis-gmpls-extensions */
+#define SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* draft-ietf-isis-gmpls-extensions */
+
+static struct tok isis_ext_is_reach_subtlv_values[] = {
+ { SUBTLV_EXT_IS_REACH_ADMIN_GROUP, "Administrative groups" },
+ { SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID, "Link Local/Remote Identifier" },
+ { SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID, "Link Remote Identifier" },
+ { SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR, "IPv4 interface address" },
+ { SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR, "IPv4 neighbor address" },
+ { SUBTLV_EXT_IS_REACH_MAX_LINK_BW, "Maximum link bandwidth" },
+ { SUBTLV_EXT_IS_REACH_RESERVABLE_BW, "Reservable link bandwidth" },
+ { SUBTLV_EXT_IS_REACH_UNRESERVED_BW, "Unreserved bandwidth" },
+ { SUBTLV_EXT_IS_REACH_TE_METRIC, "Traffic Engineering Metric" },
+ { SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE, "Link Protection Type" },
+ { SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR, "Interface Switching Capability" },
+ { 250, "Reserved for cisco specific extensions" },
+ { 251, "Reserved for cisco specific extensions" },
+ { 252, "Reserved for cisco specific extensions" },
+ { 253, "Reserved for cisco specific extensions" },
+ { 254, "Reserved for cisco specific extensions" },
+ { 255, "Reserved for future expansion" },
+ { 0, NULL }
+};
#define SUBTLV_IP_REACH_ADMIN_TAG32 1
#define SUBTLV_IP_REACH_ADMIN_TAG64 2
+static struct tok isis_ext_ip_reach_subtlv_values[] = {
+ { SUBTLV_IP_REACH_ADMIN_TAG32, "32-Bit Administrative tag" },
+ { SUBTLV_IP_REACH_ADMIN_TAG64, "64-Bit Administrative tag" },
+ { 0, NULL }
+};
+
#define SUBTLV_AUTH_SIMPLE 1
#define SUBTLV_AUTH_MD5 54
#define SUBTLV_AUTH_MD5_LEN 16
#define ISIS_MASK_TLV_EXT_IP6_IE(x) ((x)&0x40)
#define ISIS_MASK_TLV_EXT_IP6_SUBTLV(x) ((x)&0x20)
-#define ISIS_MASK_TLV_RESTART_RR(x) ((x)&0x1)
-#define ISIS_MASK_TLV_RESTART_RA(x) ((x)&0x2)
-
#define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
#define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
#define ISIS_LSP_TLV_METRIC_UPDOWN(x) ((x)&0x80)
#define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
-static struct tok isis_gmpls_link_prot_values[] = {
- { 0x01, "Extra Traffic"},
- { 0x02, "Unprotected"},
- { 0x04, "Shared"},
- { 0x08, "Dedicated 1:1"},
- { 0x10, "Dedicated 1+1"},
- { 0x20, "Enhanced"},
- { 0x40, "Reserved"},
- { 0x80, "Reserved"},
- { 0, NULL }
-};
-
-static struct tok isis_gmpls_sw_cap_values[] = {
- { 1, "Packet-Switch Capable-1"},
- { 2, "Packet-Switch Capable-2"},
- { 3, "Packet-Switch Capable-3"},
- { 4, "Packet-Switch Capable-4"},
- { 51, "Layer-2 Switch Capable"},
- { 100, "Time-Division-Multiplex"},
- { 150, "Lambda-Switch Capable"},
- { 200, "Fiber-Switch Capable"},
- { 0, NULL }
-};
-
-static struct tok isis_gmpls_lsp_enc_values[] = {
- { 1, "Packet"},
- { 2, "Ethernet V2/DIX"},
- { 3, "ANSI PDH"},
- { 4, "ETSI PDH"},
- { 5, "SDH ITU-T G.707"},
- { 6, "SONET ANSI T1.105"},
- { 7, "Digital Wrapper"},
- { 8, "Lambda (photonic)"},
- { 9, "Fiber"},
- { 10, "Ethernet 802.3"},
- { 11, "FiberChannel"},
- { 0, NULL }
-};
-
static struct tok isis_mt_values[] = {
{ 0, "IPv4 unicast"},
{ 1, "In-Band Management"},
{ 0, NULL }
};
+static struct tok isis_restart_flag_values[] = {
+ { 0x1, "Restart Request"},
+ { 0x2, "Restart Acknowledgement"},
+ { 0, NULL }
+};
+
struct isis_common_header {
u_int8_t nlpid;
u_int8_t fixed_len;
/* allocate space for the following string
- * xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx
- * 32 bytes plus one termination byte */
+ * xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx
+ * 50 bytes plus one termination byte */
static char *
print_nsap(register const u_int8_t *pptr, register int nsap_length)
{
int nsap_idx;
- static char nsap_ascii_output[33];
+ static char nsap_ascii_output[51];
char *junk_buf = nsap_ascii_output;
- if (nsap_length < 1 || nsap_length > 13) {
- sprintf(junk_buf, "illegal length");
+ if (nsap_length < 1 || nsap_length > 20) {
+ snprintf(nsap_ascii_output, sizeof(nsap_ascii_output),
+ "illegal length");
return (nsap_ascii_output);
}
for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
if (!TTEST2(*pptr, 1))
return (0);
- sprintf(junk_buf, "%02x", *pptr++);
+ snprintf(junk_buf,
+ sizeof(nsap_ascii_output) - (junk_buf - nsap_ascii_output),
+ "%02x", *pptr++);
junk_buf += strlen(junk_buf);
if (((nsap_idx & 1) == 0) &&
(nsap_idx + 1 < nsap_length)) {
#define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
#define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
-void isoclns_print(const u_int8_t *p, u_int length, u_int caplen,
- const u_int8_t *esrc, const u_int8_t *edst)
+void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
{
u_int8_t pdu_type;
const struct isis_common_header *header;
header = (const struct isis_common_header *)p;
pdu_type = header->pdu_type & PDU_TYPE_MASK;
- printf("%sOSI ", caplen < 1 ? "|" : "");
- if (!eflag && esrc != NULL && edst != NULL)
- (void)printf("%s > %s, ",
- etheraddr_string(esrc),
- etheraddr_string(edst));
+ printf("%sOSI", caplen < 1 ? "|" : "");
if (caplen < 1) /* enough bytes on the wire ? */
return;
switch (*p) {
case NLPID_CLNS:
- (void)printf("CLNS, length: %u", length);
+ (void)printf(", CLNS, length %u", length);
break;
case NLPID_ESIS:
break;
case NLPID_NULLNS:
- (void)printf("ISO NULLNS, length: %u", length);
+ (void)printf(", ISO NULLNS, length: %u", length);
break;
default:
- (void)printf("Unknown NLPID 0x%02x, length: %u", p[0], length);
+ (void)printf(", Unknown NLPID 0x%02x, length: %u", p[0], length);
if (caplen > 1)
print_unknown_data(p,"\n\t",caplen);
break;
return;
}
- printf("ES-IS, %s, length: %u",
+ printf(", ES-IS, %s, length %u",
tok2str(esis_values,"unknown type: %u",eh->type & 0x1f),
length);
}
}
-/* allocate space for the following string
- * xxxx.xxxx.xxxx
- * 14 bytes plus one termination byte */
-static char *
-isis_print_sysid(const u_int8_t *cp, int sysid_len)
-{
- int i;
- static char sysid[15];
- char *pos = sysid;
-
- for (i = 1; i <= sysid_len; i++) {
- if (!TTEST2(*cp, 1))
- return (0);
- sprintf(pos, "%02x", *cp++);
- pos += strlen(pos);
- if ((i==2)^(i==4)) {
- *pos++ = '.';
- }
- }
- *(pos) = '\0';
- return (sysid);
-}
-
-
-/* allocate space for the following string
- * xxxx.xxxx.xxxx.yy
- * 17 bytes plus one termination byte */
-static char *
-isis_print_nodeid(const u_int8_t *cp)
-{
- int i;
- static char nodeid[18];
- char *pos = nodeid;
-
- for (i = 1; i <= 7; i++) {
- if (!TTEST2(*cp, 1))
- return (0);
- sprintf(pos, "%02x", *cp++);
- pos += strlen(pos);
- if ((i & 1) == 0) {
- *pos++ = '.';
- }
- }
- *(pos) = '\0';
- return (nodeid);
-}
-
-/* allocate space for the following string
+/* shared routine for printing system, node and lsp-ids
+ * allocate space for the worst-case string
* xxxx.xxxx.xxxx.yy-zz
* 20 bytes plus one termination byte */
static char *
-isis_print_lspid(const u_int8_t *cp)
+isis_print_id(const u_int8_t *cp, int id_len)
{
- int i;
- static char lspid[21];
- char *pos = lspid;
-
- for (i = 1; i <= 7; i++) {
- sprintf(pos, "%02x", *cp++);
- pos += strlen(pos);
- if ((i & 1) == 0)
- *pos++ = '.';
+ int i;
+ static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
+ char *pos = id;
+
+ for (i = 1; i <= SYSTEM_ID_LEN; i++) {
+ snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++);
+ pos += strlen(pos);
+ if (i == 2 || i == 4)
+ *pos++ = '.';
}
- sprintf(pos, "-%02x", *cp);
- return (lspid);
+ if (id_len >= NODE_ID_LEN) {
+ snprintf(pos, sizeof(id) - (pos - id), ".%02x", *cp++);
+ pos += strlen(pos);
+ }
+ if (id_len == LSP_ID_LEN)
+ snprintf(pos, sizeof(id) - (pos - id), "-%02x", *cp);
+ return (id);
}
/* print the 4-byte metric block which is common found in the old-style TLVs */
-
static int
isis_print_metric_block (const struct isis_metric_block *isis_metric_block)
{
while (length > 0) {
if ((size_t)length < sizeof(*tlv_ip_reach)) {
- printf("short IPv4 reachability (%d vs %lu)",
+ printf("short IPv4 Reachability (%d vs %lu)",
length,
(unsigned long)sizeof(*tlv_ip_reach));
return (0);
static int
isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
+ /* first lets see if we know the subTLVs name*/
+ printf("%s%s subTLV #%u, length: %u",
+ ident,
+ tok2str(isis_ext_ip_reach_subtlv_values,
+ "unknown",
+ subt),
+ subt,
+ subl);
+
+ if (!TTEST2(*tptr,subl))
+ goto trunctlv;
+
switch(subt) {
case SUBTLV_IP_REACH_ADMIN_TAG32:
while (subl >= 4) {
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%s32-Bit Administrative tag: 0x%08x (=%u)",
- ident,
+ printf(", 0x%08x (=%u)",
EXTRACT_32BITS(tptr),
EXTRACT_32BITS(tptr));
tptr+=4;
break;
case SUBTLV_IP_REACH_ADMIN_TAG64:
while (subl >= 8) {
- if (!TTEST2(*tptr,8))
- goto trunctlv;
- printf("%s64-Bit Administrative tag: 0x%08x%08x",
- ident,
+ printf(", 0x%08x%08x",
EXTRACT_32BITS(tptr),
EXTRACT_32BITS(tptr+4));
tptr+=8;
}
break;
default:
- printf("%sunknown subTLV, type %d, length %d",
- ident,
- subt,
- subl);
if(!print_unknown_data(tptr,"\n\t\t ",
subl))
return(0);
static int
isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
- int i;
+ int priority_level;
union { /* int to float conversion buffer for several subTLVs */
float f;
u_int32_t i;
} bw;
+ /* first lets see if we know the subTLVs name*/
+ printf("%s%s subTLV #%u, length: %u",
+ ident,
+ tok2str(isis_ext_is_reach_subtlv_values,
+ "unknown",
+ subt),
+ subt,
+ subl);
+
+ if (!TTEST2(*tptr,subl))
+ goto trunctlv;
+
switch(subt) {
- case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%sAdministrative groups: 0x%08x",
- ident,
- EXTRACT_32BITS(tptr));
- break;
- case SUBTLV_EXT_IS_REACH_LINK_LOCAL_ID:
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%sLink Local Identifier: 0x%08x",
- ident,
- EXTRACT_32BITS(tptr));
- break;
+ case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
+ case SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
case SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%sLink Remote Identifier: 0x%08x",
- ident,
- EXTRACT_32BITS(tptr));
+ printf(", 0x%08x", EXTRACT_32BITS(tptr));
+ if (subl == 8) /* draft-ietf-isis-gmpls-extensions */
+ printf(", 0x%08x", EXTRACT_32BITS(tptr+4));
+ break;
+ case SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
+ case SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
+ printf(", %s", ipaddr_string(tptr));
break;
case SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- bw.i = EXTRACT_32BITS(tptr);
- printf("%sMaximum link bandwidth : %.3f Mbps",
- ident,
- bw.f*8/1000000 );
- break;
- case SUBTLV_EXT_IS_REACH_RESERVABLE_BW :
- if (!TTEST2(*tptr,4))
- goto trunctlv;
+ case SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
bw.i = EXTRACT_32BITS(tptr);
- printf("%sReservable link bandwidth: %.3f Mbps",
- ident,
- bw.f*8/1000000 );
+ printf(", %.3f Mbps", bw.f*8/1000000 );
break;
case SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
- printf("%sUnreserved bandwidth:",ident);
- for (i = 0; i < 8; i++) {
- if (!TTEST2(*(tptr+i*4),4))
- goto trunctlv;
+ for (priority_level = 0; priority_level < 8; priority_level++) {
bw.i = EXTRACT_32BITS(tptr);
printf("%s priority level %d: %.3f Mbps",
ident,
- i,
+ priority_level,
bw.f*8/1000000 );
+ tptr+=4;
}
break;
case SUBTLV_EXT_IS_REACH_TE_METRIC:
- if (!TTEST2(*tptr,3))
- goto trunctlv;
- printf("%sTraffic Engineering Metric: %d",
- ident,
- EXTRACT_24BITS(tptr));
- break;
- case SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%sIPv4 interface address: %s",
- ident,
- ipaddr_string(tptr));
- break;
- case SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
- if (!TTEST2(*tptr,4))
- goto trunctlv;
- printf("%sIPv4 neighbor address: %s",
- ident,
- ipaddr_string(tptr));
+ printf(", %u", EXTRACT_24BITS(tptr));
break;
case SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
- if (!TTEST2(*tptr,2))
- goto trunctlv;
- printf("%sLink Protection Type: %s, Priority %u",
- ident,
- bittok2str(isis_gmpls_link_prot_values, "none", *tptr),
+ printf(", %s, Priority %u",
+ bittok2str(gmpls_link_prot_values, "none", *tptr),
*(tptr+1));
break;
case SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
- printf("%sInterface Switching Capability",ident);
-
- if (!TTEST2(*tptr,1))
- goto trunctlv;
printf("%s Interface Switching Capability:%s",
ident,
- tok2str(isis_gmpls_sw_cap_values, "Unknown", *(tptr)));
-
- if (!TTEST2(*(tptr+1),1))
- goto trunctlv;
+ tok2str(gmpls_switch_cap_values, "Unknown", *(tptr)));
printf(", LSP Encoding: %s",
- tok2str(isis_gmpls_lsp_enc_values, "Unknown", *(tptr+1)));
-
- if (!TTEST2(*(tptr+2),2)) /* skip 2 res. bytes */
- goto trunctlv;
-
+ tok2str(gmpls_encoding_values, "Unknown", *(tptr+1)));
+ tptr+=4;
printf("%s Max LSP Bandwidth:",ident);
- for (i = 0; i < 8; i++) {
- if (!TTEST2(*(tptr+(i*4)+4),4))
- goto trunctlv;
+ for (priority_level = 0; priority_level < 8; priority_level++) {
bw.i = EXTRACT_32BITS(tptr);
printf("%s priority level %d: %.3f Mbps",
ident,
- i,
+ priority_level,
bw.f*8/1000000 );
+ tptr+=4;
}
subl-=36;
/* there is some optional stuff left to decode but this is as of yet
not specified so just lets hexdump what is left */
if(subl>0){
if(!print_unknown_data(tptr,"\n\t\t ",
- subl-36))
+ subl-36))
return(0);
}
break;
- case 250:
- case 251:
- case 252:
- case 253:
- case 254:
- printf("%sReserved for cisco specific extensions, type %d, length %d",
- ident,
- subt,
- subl);
- break;
- case 255:
- printf("%sReserved for future expansion, type %d, length %d",
- ident,
- subt,
- subl);
- break;
default:
- printf("%sunknown subTLV, type %d, length %d",
- ident,
- subt,
- subl);
if(!print_unknown_data(tptr,"\n\t\t ",
- subl))
+ subl))
return(0);
break;
}
*/
static int
-isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident) {
+isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident, int tlv) {
char ident_buffer[20];
int subt,subl,tslen;
if (!TTEST2(*tptr, NODE_ID_LEN))
return(0);
- printf("%sIS Neighbor: %s", ident, isis_print_nodeid(tptr));
+ printf("%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN));
tptr+=(NODE_ID_LEN);
-
- if (!TTEST2(*tptr, 3))
- return(0);
- printf(", Metric: %d",EXTRACT_24BITS(tptr));
- tptr+=3;
+
+ if (tlv != TLV_IS_ALIAS_ID) {
+ if (!TTEST2(*tptr, 3))
+ return(0);
+ printf(", Metric: %d",EXTRACT_24BITS(tptr));
+ tptr+=3;
+ }
if (!TTEST2(*tptr, 1))
return(0);
bit_length);
#ifdef INET6
if (afi == IPV6)
- printf("%sIPv6 prefix: %39s/%u",
+ printf("%sIPv6 prefix: %s/%u",
ident,
ip6addr_string(prefix),
bit_length);
const struct isis_tlv_is_reach *tlv_is_reach;
const struct isis_tlv_es_reach *tlv_es_reach;
- u_int8_t pdu_type, max_area, id_length, type, len, tmp, alen, lan_alen, prefix_len;
+ u_int8_t pdu_type, max_area, id_length, tlv_type, tlv_len, tmp, alen, lan_alen, prefix_len;
u_int8_t ext_is_len, ext_ip_len, mt_len;
const u_int8_t *optr, *pptr, *tptr;
- u_short packet_len,pdu_len,time_remain;
- u_int i,ra,rr;
+ u_short packet_len,pdu_len;
+ u_int i;
packet_len=length;
optr = p; /* initialize the _o_riginal pointer to the packet start -
pdu_type=header->pdu_type;
- /* in non-verbose mode just lets print the basic PDU Type*/
+ /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
if (vflag < 1) {
- printf("IS-IS, %s, length: %u",
- tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type),
- length);
+ printf(", IS-IS, %s",
+ tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type));
+
+ switch (pdu_type) {
+
+ case L1_LAN_IIH:
+ case L2_LAN_IIH:
+ printf(", source-id %s",
+ isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN));
+ printf(", DIS lan-id %s",
+ isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN));
+ break;
+ case PTP_IIH:
+ printf(", source-id %s", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN));
+ break;
+ case L1_LSP:
+ case L2_LSP:
+ printf(", lsp-id %s, seq 0x%08x, lifetime %5us",
+ isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
+ EXTRACT_32BITS(header_lsp->sequence_number),
+ EXTRACT_16BITS(header_lsp->remaining_lifetime));
+ break;
+ case L1_CSNP:
+ case L2_CSNP:
+ printf(", source-id %s", isis_print_id(header_csnp->source_id,SYSTEM_ID_LEN));
+ break;
+ case L1_PSNP:
+ case L2_PSNP:
+ printf(", source-id %s", isis_print_id(header_psnp->source_id,SYSTEM_ID_LEN));
+ break;
+
+ }
+ printf(", length %u", length);
+
return(1);
}
/* ok they seem to want to know everything - lets fully decode it */
- printf("IS-IS, length: %u",length);
+ printf(", IS-IS, length: %u",length);
- printf("\n\thlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
+ printf("\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
+ tok2str(isis_pdu_values,
+ "unknown, type %u",
+ pdu_type),
header->fixed_len,
header->version,
header->pdu_version,
max_area,
header->max_area);
- /* first lets see if we know the PDU name*/
- printf(", pdu-type: %s",
- tok2str(isis_pdu_values,
- "unknown, type %u",
- pdu_type));
-
if (vflag > 1) {
if(!print_unknown_data(optr,"\n\t",8)) /* provide the _o_riginal pointer */
return(0); /* for optionally debugging the common header */
}
TCHECK(*header_iih_lan);
- printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
- isis_print_sysid(header_iih_lan->source_id,SYSTEM_ID_LEN),
+ printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
+ isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN),
EXTRACT_16BITS(header_iih_lan->holding_time),
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
header_iih_lan->circuit_type));
- printf("\n\t lan-id: %s, Priority: %u, PDU length: %u",
- isis_print_nodeid(header_iih_lan->lan_id),
+ printf("\n\t DIS lan-id: %s, Priority: %u, PDU length: %u",
+ isis_print_id(header_iih_lan->lan_id, NODE_ID_LEN),
(header_iih_lan->priority) & PRIORITY_MASK,
pdu_len);
}
TCHECK(*header_iih_ptp);
- printf("\n\t source-id: %s, holding time: %us, circuit-id: 0x%02x, %s, PDU length: %u",
- isis_print_sysid(header_iih_ptp->source_id,SYSTEM_ID_LEN),
+ printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
+ isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN),
EXTRACT_16BITS(header_iih_ptp->holding_time),
- header_iih_ptp->circuit_id,
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
- header_iih_ptp->circuit_type),
+ header_iih_ptp->circuit_type));
+
+ printf("\n\t circuit-id: 0x%02x, PDU length: %u",
+ header_iih_ptp->circuit_id,
pdu_len);
if (vflag > 1) {
TCHECK(*header_lsp);
printf("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us",
- isis_print_lspid(header_lsp->lsp_id),
+ isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
EXTRACT_32BITS(header_lsp->sequence_number),
EXTRACT_16BITS(header_lsp->remaining_lifetime));
/* verify the checksum -
TCHECK(*header_csnp);
printf("\n\t source-id: %s, PDU length: %u",
- isis_print_nodeid(header_csnp->source_id),
+ isis_print_id(header_csnp->source_id, NODE_ID_LEN),
pdu_len);
printf("\n\t start lsp-id: %s",
- isis_print_lspid(header_csnp->start_lsp_id));
+ isis_print_id(header_csnp->start_lsp_id, LSP_ID_LEN));
printf("\n\t end lsp-id: %s",
- isis_print_lspid(header_csnp->end_lsp_id));
+ isis_print_id(header_csnp->end_lsp_id, LSP_ID_LEN));
if (vflag > 1) {
if(!print_unknown_data(pptr,"\n\t ",ISIS_CSNP_HEADER_SIZE))
}
TCHECK(*header_psnp);
- printf("\n\t source-id: %s",
- isis_print_nodeid(header_psnp->source_id));
+ printf("\n\t source-id: %s, PDU length: %u",
+ isis_print_id(header_psnp->source_id, NODE_ID_LEN),
+ pdu_len);
if (vflag > 1) {
if(!print_unknown_data(pptr,"\n\t ",ISIS_PSNP_HEADER_SIZE))
(long)(pptr-snapend));
return (1);
}
- type = *pptr++;
- len = *pptr++;
- tmp =len; /* copy temporary len & pointer to packet data */
+ tlv_type = *pptr++;
+ tlv_len = *pptr++;
+ tmp =tlv_len; /* copy temporary len & pointer to packet data */
tptr = pptr;
packet_len -= 2;
- if (len > packet_len) {
+ if (tlv_len > packet_len) {
break;
}
printf("\n\t %s TLV #%u, length: %u",
tok2str(isis_tlv_values,
"unknown",
- type),
- type,
- len);
+ tlv_type),
+ tlv_type,
+ tlv_len);
/* now check if we have a decoder otherwise do a hexdump at the end*/
- switch (type) {
+ switch (tlv_type) {
case TLV_AREA_ADDR:
if (!TTEST2(*tptr, 1))
goto trunctlv;
while (tmp >= ETHER_ADDR_LEN) {
if (!TTEST2(*tptr, ETHER_ADDR_LEN))
goto trunctlv;
- printf("\n\t IS Neighbor: %s",isis_print_sysid(tptr,ETHER_ADDR_LEN));
+ printf("\n\t SNPA: %s",isis_print_id(tptr,ETHER_ADDR_LEN));
tmp -= ETHER_ADDR_LEN;
tptr += ETHER_ADDR_LEN;
}
while (tmp >= lan_alen) {
if (!TTEST2(*tptr, lan_alen))
goto trunctlv;
- printf("\n\t\tIS Neighbor: %s",isis_print_sysid(tptr,lan_alen));
+ printf("\n\t\tIS Neighbor: %s",isis_print_id(tptr,lan_alen));
tmp -= lan_alen;
tptr +=lan_alen;
}
tptr+=mt_len;
tmp-=mt_len;
- ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ");
+ ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
if (ext_is_len == 0) /* did something go wrong ? */
goto trunctlv;
break;
case TLV_IS_ALIAS_ID:
- while (tmp >= NODE_ID_LEN+3+1) { /* is it worth attempting a decode ? */
- ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ");
- if (ext_is_len == 0) /* did something go wrong ? */
- goto trunctlv;
- tmp-=ext_is_len;
- tptr+=ext_is_len;
- }
- break;
+ while (tmp >= NODE_ID_LEN+1) { /* is it worth attempting a decode ? */
+ ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
+ if (ext_is_len == 0) /* did something go wrong ? */
+ goto trunctlv;
+ tmp-=ext_is_len;
+ tptr+=ext_is_len;
+ }
+ break;
case TLV_EXT_IS_REACH:
while (tmp >= NODE_ID_LEN+3+1) { /* is it worth attempting a decode ? */
- ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ");
+ ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
if (ext_is_len == 0) /* did something go wrong ? */
goto trunctlv;
tmp-=ext_is_len;
while (tmp >= sizeof(struct isis_tlv_is_reach)) {
if (!TTEST(*tlv_is_reach))
goto trunctlv;
- printf("\n\t IS Neighbor: %s", isis_print_nodeid(tlv_is_reach->neighbor_nodeid));
+ printf("\n\t IS Neighbor: %s",
+ isis_print_id(tlv_is_reach->neighbor_nodeid, NODE_ID_LEN));
isis_print_metric_block(&tlv_is_reach->isis_metric_block);
tmp -= sizeof(struct isis_tlv_is_reach);
tlv_is_reach++;
if (!TTEST(*tlv_es_reach))
goto trunctlv;
printf("\n\t ES Neighbor: %s",
- isis_print_sysid(tlv_es_reach->neighbor_sysid,SYSTEM_ID_LEN));
+ isis_print_id(tlv_es_reach->neighbor_sysid,SYSTEM_ID_LEN));
isis_print_metric_block(&tlv_es_reach->isis_metric_block);
tmp -= sizeof(struct isis_tlv_es_reach);
tlv_es_reach++;
/* those two TLVs share the same format */
case TLV_IP_REACH:
case TLV_IP_REACH_EXT:
- if (!isis_print_tlv_ip_reach(pptr, "\n\t ", len))
+ if (!isis_print_tlv_ip_reach(pptr, "\n\t ", tlv_len))
return (1);
break;
switch (*tptr) {
case SUBTLV_AUTH_SIMPLE:
- for(i=1;i<len;i++) {
+ for(i=1;i<tlv_len;i++) {
if (!TTEST2(*(tptr+i), 1))
goto trunctlv;
printf("%c",*(tptr+i));
}
break;
case SUBTLV_AUTH_MD5:
- for(i=1;i<len;i++) {
+ for(i=1;i<tlv_len;i++) {
if (!TTEST2(*(tptr+i), 1))
goto trunctlv;
printf("%02x",*(tptr+i));
}
- if (len != SUBTLV_AUTH_MD5_LEN+1)
+ if (tlv_len != SUBTLV_AUTH_MD5_LEN+1)
printf(", (malformed subTLV) ");
break;
case SUBTLV_AUTH_PRIVATE:
default:
- if(!print_unknown_data(tptr+1,"\n\t\t ",len-1))
+ if(!print_unknown_data(tptr+1,"\n\t\t ",tlv_len-1))
return(0);
break;
}
if (!TTEST2(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN))
goto trunctlv;
printf("\n\t Neighbor SystemID: %s",
- isis_print_sysid(tlv_ptp_adj->neighbor_sysid,SYSTEM_ID_LEN));
+ isis_print_id(tlv_ptp_adj->neighbor_sysid,SYSTEM_ID_LEN));
tmp-=SYSTEM_ID_LEN;
}
if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
case TLV_SHARED_RISK_GROUP:
if (!TTEST2(*tptr, NODE_ID_LEN))
goto trunctlv;
- printf("\n\t IS Neighbor: %s", isis_print_nodeid(tptr));
+ printf("\n\t IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN));
tptr+=(NODE_ID_LEN);
- len-=(NODE_ID_LEN);
+ tmp-=(NODE_ID_LEN);
if (!TTEST2(*tptr, 1))
goto trunctlv;
- printf(", %s", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
- len--;
+ printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
+ tmp--;
if (!TTEST2(*tptr,4))
goto trunctlv;
printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr));
tptr+=4;
- len-=4;
+ tmp-=4;
if (!TTEST2(*tptr,4))
goto trunctlv;
printf("\n\t IPv4 neighbor address: %s", ipaddr_string(tptr));
tptr+=4;
- len-=4;
+ tmp-=4;
while (tmp>0) {
if (!TTEST2(*tptr, 4))
goto trunctlv;
printf("\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr));
tptr+=4;
- len-=4;
+ tmp-=4;
}
break;
case TLV_LSP:
tlv_lsp = (const struct isis_tlv_lsp *)tptr;
while(tmp>0) {
- printf("\n\t lsp-id: %s",
- isis_print_nodeid(tlv_lsp->lsp_id));
- if (!TTEST((tlv_lsp->lsp_id)[NODE_ID_LEN]))
+ if (!TTEST((tlv_lsp->lsp_id)[LSP_ID_LEN]))
goto trunctlv;
- printf("-%02x",(tlv_lsp->lsp_id)[NODE_ID_LEN]);
+ printf("\n\t lsp-id: %s",
+ isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN));
if (!TTEST2(tlv_lsp->sequence_number, 4))
goto trunctlv;
printf(", seq: 0x%08x",EXTRACT_32BITS(tlv_lsp->sequence_number));
case TLV_RESTART_SIGNALING:
if (!TTEST2(*tptr, 3))
goto trunctlv;
- rr = ISIS_MASK_TLV_RESTART_RR(*tptr);
- ra = ISIS_MASK_TLV_RESTART_RA(*tptr);
- tptr++;
- time_remain = EXTRACT_16BITS(tptr);
- printf("\n\t Restart Request bit %s, Restart Acknowledgement bit %s\n\t Remaining holding time: %us",
- rr ? "set" : "clear", ra ? "set" : "clear", time_remain);
+ printf("\n\t Flags [%s], Remaining holding time %us",
+ bittok2str(isis_restart_flag_values, "none", *tptr),
+ EXTRACT_16BITS(tptr+1));
+ tptr+=3;
break;
case TLV_IDRP_INFO:
case SUBTLV_IDRP_LOCAL:
case SUBTLV_IDRP_RES:
default:
- if(!print_unknown_data(tptr,"\n\t ",len-1))
+ if(!print_unknown_data(tptr,"\n\t ",tlv_len-1))
return(0);
break;
}
while (tmp >= SYSTEM_ID_LEN) {
if (!TTEST2(*tptr, SYSTEM_ID_LEN))
goto trunctlv;
- printf("\n\t %s",isis_print_sysid(tptr,SYSTEM_ID_LEN));
+ printf("\n\t %s",isis_print_id(tptr,SYSTEM_ID_LEN));
tptr+=SYSTEM_ID_LEN;
tmp-=SYSTEM_ID_LEN;
}
default:
if (vflag <= 1) {
- if(!print_unknown_data(pptr,"\n\t\t",len))
+ if(!print_unknown_data(pptr,"\n\t\t",tlv_len))
return(0);
}
break;
}
/* do we want to see an additionally hexdump ? */
if (vflag> 1) {
- if(!print_unknown_data(pptr,"\n\t ",len))
+ if(!print_unknown_data(pptr,"\n\t ",tlv_len))
return(0);
}
- pptr += len;
- packet_len -= len;
+ pptr += tlv_len;
+ packet_len -= tlv_len;
}
if (packet_len != 0) {