print-isoclns.c (98527) | print-isoclns.c (111729) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 9 unchanged lines hidden (view full) --- 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Original code by Matt Thomas, Digital Equipment Corporation 22 * 23 * Extensively modified by Hannes Gredler (hannes@juniper.net) for more 24 * complete IS-IS support. 25 * | 1/* 2 * Copyright (c) 1992, 1993, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 9 unchanged lines hidden (view full) --- 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Original code by Matt Thomas, Digital Equipment Corporation 22 * 23 * Extensively modified by Hannes Gredler (hannes@juniper.net) for more 24 * complete IS-IS support. 25 * |
26 * $FreeBSD: head/contrib/tcpdump/print-isoclns.c 98527 2002-06-21 00:49:02Z fenner $ | 26 * $FreeBSD: head/contrib/tcpdump/print-isoclns.c 111729 2003-03-02 08:25:48Z fenner $ |
27 */ 28 29#ifndef lint 30static const char rcsid[] = | 27 */ 28 29#ifndef lint 30static const char rcsid[] = |
31 "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36 2002/01/10 09:33:23 guy Exp $ (LBL)"; | 31 "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36.2.2 2002/06/29 04:28:44 guy Exp $ (LBL)"; |
32#endif 33 34#ifdef HAVE_CONFIG_H 35#include "config.h" 36#endif 37 38#include <sys/types.h> 39#include <sys/time.h> --- 531 unchanged lines hidden (view full) --- 571 printf("."); 572 } 573 printf("-%02x", *cp); 574} 575 576static int 577isis_print_tlv_ip_reach (const u_char *cp, int length) 578{ | 32#endif 33 34#ifdef HAVE_CONFIG_H 35#include "config.h" 36#endif 37 38#include <sys/types.h> 39#include <sys/time.h> --- 531 unchanged lines hidden (view full) --- 571 printf("."); 572 } 573 printf("-%02x", *cp); 574} 575 576static int 577isis_print_tlv_ip_reach (const u_char *cp, int length) 578{ |
579 int bitmasks[33] = { | 579 u_int bitmasks[33] = { |
580 0x00000000, 581 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 582 0xf8000000, 0xfc000000, 0xfe000000, 0xff000000, 583 0xff800000, 0xffc00000, 0xffe00000, 0xfff00000, 584 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000, 585 0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000, 586 0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00, 587 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 588 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff 589 }; | 580 0x00000000, 581 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 582 0xf8000000, 0xfc000000, 0xfe000000, 0xff000000, 583 0xff800000, 0xffc00000, 0xffe00000, 0xfff00000, 584 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000, 585 0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000, 586 0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00, 587 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 588 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff 589 }; |
590 int mask, prefix_len; | 590 u_int mask; 591 int prefix_len; |
591 const struct isis_tlv_ip_reach *tlv_ip_reach; 592 593 tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp; 594 595 while (length > 0) { 596 if (length < sizeof(*tlv_ip_reach)) { 597 printf("short IP reachability (%d vs %lu)", length, 598 (unsigned long)sizeof(*tlv_ip_reach)); --- 74 unchanged lines hidden (view full) --- 673 const struct isis_psnp_header *header_psnp; 674 675 const struct isis_tlv_lsp *tlv_lsp; 676 const struct isis_tlv_ptp_adj *tlv_ptp_adj; 677 const struct isis_tlv_is_reach *tlv_is_reach; 678 679 u_char pdu_type, max_area, type, len, tmp, alen, subl, subt, tslen, ttslen; 680 const u_char *optr, *pptr, *tptr; | 592 const struct isis_tlv_ip_reach *tlv_ip_reach; 593 594 tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp; 595 596 while (length > 0) { 597 if (length < sizeof(*tlv_ip_reach)) { 598 printf("short IP reachability (%d vs %lu)", length, 599 (unsigned long)sizeof(*tlv_ip_reach)); --- 74 unchanged lines hidden (view full) --- 674 const struct isis_psnp_header *header_psnp; 675 676 const struct isis_tlv_lsp *tlv_lsp; 677 const struct isis_tlv_ptp_adj *tlv_ptp_adj; 678 const struct isis_tlv_is_reach *tlv_is_reach; 679 680 u_char pdu_type, max_area, type, len, tmp, alen, subl, subt, tslen, ttslen; 681 const u_char *optr, *pptr, *tptr; |
682 u_char subtlv_len; |
|
681 u_short packet_len,pdu_len; 682 u_int i,j,bit_length,byte_length,metric; 683 u_char prefix[4]; /* copy buffer for ipv4 prefixes */ 684#ifdef INET6 685 u_char prefix6[16]; /* copy buffer for ipv6 prefixes */ 686#endif 687 u_char off[2]; 688 float bw; /* copy buffer for several subTLVs of the extended IS reachability TLV */ --- 552 unchanged lines hidden (view full) --- 1241 metric, 1242 ISIS_MASK_TLV_EXT_IP_UPDOWN(j) ? "down" : "up"); 1243 1244 printf(", %ssub-TLVs present", 1245 ISIS_MASK_TLV_EXT_IP_SUBTLV(j) ? "" : "no "); 1246 1247 if (ISIS_MASK_TLV_EXT_IP_SUBTLV(j)) { 1248 if (!TTEST2(*tptr, 1)) | 683 u_short packet_len,pdu_len; 684 u_int i,j,bit_length,byte_length,metric; 685 u_char prefix[4]; /* copy buffer for ipv4 prefixes */ 686#ifdef INET6 687 u_char prefix6[16]; /* copy buffer for ipv6 prefixes */ 688#endif 689 u_char off[2]; 690 float bw; /* copy buffer for several subTLVs of the extended IS reachability TLV */ --- 552 unchanged lines hidden (view full) --- 1243 metric, 1244 ISIS_MASK_TLV_EXT_IP_UPDOWN(j) ? "down" : "up"); 1245 1246 printf(", %ssub-TLVs present", 1247 ISIS_MASK_TLV_EXT_IP_SUBTLV(j) ? "" : "no "); 1248 1249 if (ISIS_MASK_TLV_EXT_IP_SUBTLV(j)) { 1250 if (!TTEST2(*tptr, 1)) |
1249 return (1); 1250 printf(" (%u)",*tptr); /* no subTLV decoder supported - just print out subTLV length */ 1251 i-=*tptr; 1252 tptr+=*tptr++; | 1251 return (1); 1252 subtlv_len = *tptr; 1253 printf(" (%u)",subtlv_len); /* no subTLV decoder supported - just print out subTLV length */ 1254 i -= subtlv_len; 1255 tptr += subtlv_len + 1; |
1253 } 1254 1255 i-=(5+byte_length); 1256 tptr+=byte_length; 1257 } 1258 break; 1259 1260#ifdef INET6 --- 252 unchanged lines hidden (view full) --- 1513 case TLV_RESTART_SIGNALING: 1514 tptr=pptr; 1515 printf("Restart Signaling (%u)",len); 1516 if (!TTEST2(*tptr, 3)) 1517 goto trunctlv; 1518 1519 printf("\n\t\t\tRestart Request bit %s, Restart Acknowledgement bit %s\n\t\t\tRemaining holding time: %us", 1520 ISIS_MASK_RESTART_RR(*tptr) ? "set" : "clear", | 1256 } 1257 1258 i-=(5+byte_length); 1259 tptr+=byte_length; 1260 } 1261 break; 1262 1263#ifdef INET6 --- 252 unchanged lines hidden (view full) --- 1516 case TLV_RESTART_SIGNALING: 1517 tptr=pptr; 1518 printf("Restart Signaling (%u)",len); 1519 if (!TTEST2(*tptr, 3)) 1520 goto trunctlv; 1521 1522 printf("\n\t\t\tRestart Request bit %s, Restart Acknowledgement bit %s\n\t\t\tRemaining holding time: %us", 1523 ISIS_MASK_RESTART_RR(*tptr) ? "set" : "clear", |
1521 ISIS_MASK_RESTART_RA(*tptr++) ? "set" : "clear", 1522 EXTRACT_16BITS(tptr)); | 1524 ISIS_MASK_RESTART_RA(*tptr) ? "set" : "clear", 1525 EXTRACT_16BITS(tptr+1)); 1526 tptr += 3; |
1523 1524 break; 1525 1526 default: 1527 printf("unknown TLV, type %d, length %d\n\t\t\t", type, len); 1528 tptr=pptr; 1529 1530 for(i=0;i<len;i++) { --- 53 unchanged lines hidden --- | 1527 1528 break; 1529 1530 default: 1531 printf("unknown TLV, type %d, length %d\n\t\t\t", type, len); 1532 tptr=pptr; 1533 1534 for(i=0;i<len;i++) { --- 53 unchanged lines hidden --- |