*/
#ifndef lint
-static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.102 2003-10-28 19:10:15 hannes Exp $ (LBL)";
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.108 2003-11-16 09:36:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#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_IP_REACH 128 /* rfc1195, rfc2966 */
+#define TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
#define TLV_PROTOCOLS 129 /* rfc1195 */
-#define TLV_IP_REACH_EXT 130 /* rfc1195, rfc2966 */
+#define TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
#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-05 */
-#define TLV_EXT_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
+#define TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
#define TLV_HOSTNAME 137 /* rfc2763 */
#define TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
#define TLV_NORTEL_PRIVATE1 176
{ 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_INT_IP_REACH, "IPv4 Internal Reachability"},
{ TLV_PROTOCOLS, "Protocols supported"},
- { TLV_IP_REACH_EXT, "IPv4 External Reachability"},
+ { TLV_EXT_IP_REACH, "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_EXTD_IP_REACH, "Extended IPv4 Reachability"},
{ TLV_HOSTNAME, "Hostname"},
{ TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
{ TLV_NORTEL_PRIVATE1, "Nortel Proprietary"},
{ 0, NULL }
};
-#define SUBTLV_IP_REACH_ADMIN_TAG32 1
-#define SUBTLV_IP_REACH_ADMIN_TAG64 2
+#define SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1
+#define SUBTLV_EXTD_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" },
+ { SUBTLV_EXTD_IP_REACH_ADMIN_TAG32, "32-Bit Administrative tag" },
+ { SUBTLV_EXTD_IP_REACH_ADMIN_TAG64, "64-Bit Administrative tag" },
{ 0, NULL }
};
{ 0, NULL}
};
-#define ISIS_MASK_TLV_EXT_IP_UPDOWN(x) ((x)&0x80)
-#define ISIS_MASK_TLV_EXT_IP_SUBTLV(x) ((x)&0x40)
+#define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
+#define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
-#define ISIS_MASK_TLV_EXT_IP6_IE(x) ((x)&0x40)
-#define ISIS_MASK_TLV_EXT_IP6_SUBTLV(x) ((x)&0x20)
+#define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
+#define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
#define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
#define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
u_int8_t checksum[2];
};
-
-/* allocate space for the following string
- * 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[51];
+ static char nsap_ascii_output[sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx")];
char *junk_buf = nsap_ascii_output;
if (nsap_length < 1 || nsap_length > 20) {
}
}
-/* 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 */
+/* shared routine for printing system, node and lsp-ids */
static char *
isis_print_id(const u_int8_t *cp, int id_len)
{
goto trunctlv;
switch(subt) {
- case SUBTLV_IP_REACH_ADMIN_TAG32:
+ case SUBTLV_EXTD_IP_REACH_ADMIN_TAG32:
while (subl >= 4) {
printf(", 0x%08x (=%u)",
EXTRACT_32BITS(tptr),
subl-=4;
}
break;
- case SUBTLV_IP_REACH_ADMIN_TAG64:
+ case SUBTLV_EXTD_IP_REACH_ADMIN_TAG64:
while (subl >= 8) {
printf(", 0x%08x%08x",
EXTRACT_32BITS(tptr),
*/
static int
-isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident, int tlv) {
+isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident, int tlv_type) {
char ident_buffer[20];
- int subt,subl,tslen;
+ int subtlv_type,subtlv_len,subtlv_sum_len;
int proc_bytes = 0; /* how many bytes did we process ? */
if (!TTEST2(*tptr, NODE_ID_LEN))
printf("%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN));
tptr+=(NODE_ID_LEN);
- if (tlv != TLV_IS_ALIAS_ID) {
- if (!TTEST2(*tptr, 3))
+ if (tlv_type != TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
+ if (!TTEST2(*tptr, 3)) /* and is therefore skipped */
return(0);
printf(", Metric: %d",EXTRACT_24BITS(tptr));
tptr+=3;
if (!TTEST2(*tptr, 1))
return(0);
- tslen=*(tptr++); /* read out subTLV length */
+ subtlv_sum_len=*(tptr++); /* read out subTLV length */
proc_bytes=NODE_ID_LEN+3+1;
- printf(", %ssub-TLVs present",tslen ? "" : "no ");
- if (tslen) {
- printf(" (%u)",tslen);
- while (tslen>0) {
+ printf(", %ssub-TLVs present",subtlv_sum_len ? "" : "no ");
+ if (subtlv_sum_len) {
+ printf(" (%u)",subtlv_sum_len);
+ while (subtlv_sum_len>0) {
if (!TTEST2(*tptr,2))
return(0);
- subt=*(tptr++);
- subl=*(tptr++);
+ subtlv_type=*(tptr++);
+ subtlv_len=*(tptr++);
/* prepend the ident string */
snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident);
- if(!isis_print_is_reach_subtlv(tptr,subt,subl,ident_buffer))
+ if(!isis_print_is_reach_subtlv(tptr,subtlv_type,subtlv_len,ident_buffer))
return(0);
- tptr+=subl;
- tslen-=(subl+2);
- proc_bytes+=(subl+2);
+ tptr+=subtlv_len;
+ subtlv_sum_len-=(subtlv_len+2);
+ proc_bytes+=(subtlv_len+2);
}
}
return(proc_bytes);
#endif
printf(", Distribution: %s, Metric: %u",
- ISIS_MASK_TLV_EXT_IP_UPDOWN(status_byte) ? "down" : "up",
+ ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte) ? "down" : "up",
metric);
- if (afi == IPV4 && ISIS_MASK_TLV_EXT_IP_SUBTLV(status_byte))
+ if (afi == IPV4 && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
printf(", sub-TLVs present");
#ifdef INET6
if (afi == IPV6)
printf(", %s%s",
- ISIS_MASK_TLV_EXT_IP6_IE(status_byte) ? "External" : "Internal",
- ISIS_MASK_TLV_EXT_IP6_SUBTLV(status_byte) ? ", sub-TLVs present" : "");
+ ISIS_MASK_TLV_EXTD_IP6_IE(status_byte) ? "External" : "Internal",
+ ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) ? ", sub-TLVs present" : "");
#endif
- if ((ISIS_MASK_TLV_EXT_IP_SUBTLV(status_byte) && afi == IPV4) ||
- (ISIS_MASK_TLV_EXT_IP6_SUBTLV(status_byte) && afi == IPV6)) {
+ if ((ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte) && afi == IPV4) ||
+ (ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) && afi == IPV6)) {
/* assume that one prefix can hold more
than one subTLV - therefore the first byte must reflect
the aggregate bytecount of the subTLVs for this prefix
case L1_LAN_IIH:
case L2_LAN_IIH:
- printf(", source-id %s",
+ printf(", src-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));
+ printf(", lan-id %s, prio %u",
+ isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN),
+ header_iih_lan->priority);
break;
case PTP_IIH:
- printf(", source-id %s", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN));
+ printf(", src-id %s", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN));
break;
case L1_LSP:
case L2_LSP:
break;
case L1_CSNP:
case L2_CSNP:
- printf(", source-id %s", isis_print_id(header_csnp->source_id,SYSTEM_ID_LEN));
+ printf(", src-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));
+ printf(", src-id %s", isis_print_id(header_psnp->source_id,SYSTEM_ID_LEN));
break;
}
}
TCHECK(*header_iih_lan);
- printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
+ 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 DIS lan-id: %s, Priority: %u, PDU length: %u",
+ printf("\n\t 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_lsp);
- printf("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us",
+ printf("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
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 -
- * checking starts at the lsp-id field
- * which is 12 bytes after the packet start*/
- printf("\n\t chksum: 0x%04x (%s), PDU length: %u",
- EXTRACT_16BITS(header_lsp->checksum),
- (osi_cksum(optr+12, length-12)) ? "incorrect" : "correct",
- pdu_len);
-
- printf(", %s", ISIS_MASK_LSP_OL_BIT(header_lsp->typeblock) ? "Overload bit set, " : "");
+ EXTRACT_16BITS(header_lsp->remaining_lifetime),
+ EXTRACT_16BITS(header_lsp->checksum));
+
+ /* if this is a purge do not attempt to verify the checksum */
+ if ( EXTRACT_16BITS(header_lsp->remaining_lifetime) == 0 &&
+ EXTRACT_16BITS(header_lsp->checksum) == 0)
+ printf(" (purged)");
+ else
+ /* verify the checksum -
+ * checking starts at the lsp-id field at byte position [12]
+ * hence the length needs to be reduced by 12 bytes */
+ printf(" (%s)", (osi_cksum((u_int8_t *)header_lsp->lsp_id, length-12)) ? "incorrect" : "correct");
+
+ printf(", PDU length: %u, Flags: [ %s",
+ pdu_len,
+ ISIS_MASK_LSP_OL_BIT(header_lsp->typeblock) ? "Overload bit set, " : "");
if (ISIS_MASK_LSP_ATT_BITS(header_lsp->typeblock)) {
printf("%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp->typeblock) ? "default " : "");
printf("ATT bit set, ");
}
printf("%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp->typeblock) ? "P bit set, " : "");
- printf("%s", tok2str(isis_lsp_istype_values,"Unknown(0x%x)",ISIS_MASK_LSP_ISTYPE_BITS(header_lsp->typeblock)));
+ printf("%s ]", tok2str(isis_lsp_istype_values,"Unknown(0x%x)",ISIS_MASK_LSP_ISTYPE_BITS(header_lsp->typeblock)));
if (vflag > 1) {
if(!print_unknown_data(pptr,"\n\t ",ISIS_LSP_HEADER_SIZE))
break;
/* those two TLVs share the same format */
- case TLV_IP_REACH:
- case TLV_IP_REACH_EXT:
+ case TLV_INT_IP_REACH:
+ case TLV_EXT_IP_REACH:
if (!isis_print_tlv_ip_reach(pptr, "\n\t ", tlv_len))
return (1);
break;
- case TLV_EXT_IP_REACH:
+ case TLV_EXTD_IP_REACH:
while (tmp>0) {
ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV4);
if (ext_ip_len == 0) /* did something go wrong ? */
if(tmp>=1) {
if (!TTEST2(*tptr, 1))
goto trunctlv;
- printf("\n\t Adjacency State: %s",
- tok2str(isis_ptp_adjancey_values, "0x%02x", *tptr));
+ printf("\n\t Adjacency State: %s (%u)",
+ tok2str(isis_ptp_adjancey_values, "unknown", *tptr),
+ *tptr);
tmp--;
}
if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) {
if (!TTEST2(tlv_ptp_adj->extd_local_circuit_id,
sizeof(tlv_ptp_adj->extd_local_circuit_id)))
goto trunctlv;
- printf("\n\t Extended Local circuit ID: 0x%08x",
+ printf("\n\t Extended Local circuit-ID: 0x%08x",
EXTRACT_32BITS(tlv_ptp_adj->extd_local_circuit_id));
tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id);
}
if(tmp>=SYSTEM_ID_LEN) {
if (!TTEST2(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN))
goto trunctlv;
- printf("\n\t Neighbor SystemID: %s",
+ printf("\n\t Neighbor System-ID: %s",
isis_print_id(tlv_ptp_adj->neighbor_sysid,SYSTEM_ID_LEN));
tmp-=SYSTEM_ID_LEN;
}
if (!TTEST2(tlv_ptp_adj->neighbor_extd_local_circuit_id,
sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)))
goto trunctlv;
- printf("\n\t Neighbor Extended Local circuit ID: 0x%08x",
+ printf("\n\t Neighbor Extended Local circuit-ID: 0x%08x",
EXTRACT_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id));
}
break;
while (tmp>0) {
if (!TTEST2(*(tptr), 1))
goto trunctlv;
- printf("%s",
+ printf("%s (0x%02x)",
tok2str(osi_nlpid_values,
- "Unknown 0x%02x",
- *tptr++));
+ "unknown",
+ *tptr),
+ *tptr);
if (tmp>1) /* further NPLIDs ? - put comma */
printf(", ");
+ tptr++;
tmp--;
}
break;
case TLV_CHECKSUM:
if (!TTEST2(*tptr, 2))
goto trunctlv;
- printf("\n\t checksum: 0x%04x (%s)",
- EXTRACT_16BITS(tptr),
- (osi_cksum(optr, length)) ? "incorrect" : "correct");
+ printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr));
+ /* do not attempt to verify the checksum if it is zero
+ * most likely a HMAC-MD5 TLV is also present and
+ * to avoid conflicts the checksum TLV is zeroed.
+ * see rfc3358 for details
+ */
+ if (EXTRACT_16BITS(tptr) == 0)
+ printf("(unverified)");
+ else printf("(%s)", osi_cksum(optr, length) ? "incorrect" : "correct");
break;
case TLV_MT_SUPPORTED: