print-pim.c (127675) | print-pim.c (146778) |
---|---|
1/* 2 * Copyright (c) 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 --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * | 1/* 2 * Copyright (c) 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 --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * |
21 * $FreeBSD: head/contrib/tcpdump/print-pim.c 127675 2004-03-31 14:57:24Z bms $ | 21 * $FreeBSD: head/contrib/tcpdump/print-pim.c 146778 2005-05-29 19:09:28Z sam $ |
22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = | 22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = |
26 "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.37.2.4 2004/03/24 02:52:37 guy Exp $ (LBL)"; | 26 "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45 2005/04/06 21:32:42 mcr Exp $ (LBL)"; |
27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> | 27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> |
34#include "interface.h" |
|
34 | 35 |
36#define PIMV2_TYPE_HELLO 0 37#define PIMV2_TYPE_REGISTER 1 38#define PIMV2_TYPE_REGISTER_STOP 2 39#define PIMV2_TYPE_JOIN_PRUNE 3 40#define PIMV2_TYPE_BOOTSTRAP 4 41#define PIMV2_TYPE_ASSERT 5 42#define PIMV2_TYPE_GRAFT 6 43#define PIMV2_TYPE_GRAFT_ACK 7 44#define PIMV2_TYPE_CANDIDATE_RP 8 45#define PIMV2_TYPE_PRUNE_REFRESH 9 46 47static struct tok pimv2_type_values[] = { 48 { PIMV2_TYPE_HELLO, "Hello" }, 49 { PIMV2_TYPE_REGISTER, "Register" }, 50 { PIMV2_TYPE_REGISTER_STOP, "Register Stop" }, 51 { PIMV2_TYPE_JOIN_PRUNE, "Join / Prune" }, 52 { PIMV2_TYPE_BOOTSTRAP, "Bootstrap" }, 53 { PIMV2_TYPE_ASSERT, "Assert" }, 54 { PIMV2_TYPE_GRAFT, "Graft" }, 55 { PIMV2_TYPE_GRAFT_ACK, "Graft Acknowledgement" }, 56 { PIMV2_TYPE_CANDIDATE_RP, "Candidate RP Advertisement" }, 57 { PIMV2_TYPE_PRUNE_REFRESH, "Prune Refresh" }, 58 { 0, NULL} 59}; 60 61#define PIMV2_HELLO_OPTION_HOLDTIME 1 62#define PIMV2_HELLO_OPTION_LANPRUNEDELAY 2 63#define PIMV2_HELLO_OPTION_DR_PRIORITY_OLD 18 64#define PIMV2_HELLO_OPTION_DR_PRIORITY 19 65#define PIMV2_HELLO_OPTION_GENID 20 66#define PIMV2_HELLO_OPTION_REFRESH_CAP 21 67#define PIMV2_HELLO_OPTION_BIDIR_CAP 22 68#define PIMV2_HELLO_OPTION_ADDRESS_LIST 24 69#define PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD 65001 70 71static struct tok pimv2_hello_option_values[] = { 72 { PIMV2_HELLO_OPTION_HOLDTIME, "Hold Time" }, 73 { PIMV2_HELLO_OPTION_LANPRUNEDELAY, "LAN Prune Delay" }, 74 { PIMV2_HELLO_OPTION_DR_PRIORITY_OLD, "DR Priority (Old)" }, 75 { PIMV2_HELLO_OPTION_DR_PRIORITY, "DR Priority" }, 76 { PIMV2_HELLO_OPTION_GENID, "Generation ID" }, 77 { PIMV2_HELLO_OPTION_REFRESH_CAP, "State Refresh Capability" }, 78 { PIMV2_HELLO_OPTION_BIDIR_CAP, "Bi-Directional Capability" }, 79 { PIMV2_HELLO_OPTION_ADDRESS_LIST, "Address List" }, 80 { PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD, "Address List (Old)" }, 81 { 0, NULL} 82}; 83 84 |
|
35/* 36 * XXX: We consider a case where IPv6 is not ready yet for portability, 37 * but PIM dependent defintions should be independent of IPv6... 38 */ 39 40struct pim { 41 u_int8_t pim_typever; 42 /* upper 4bit: PIM version number; 2 for PIMv2 */ --- 317 unchanged lines hidden (view full) --- 360 ep = (const u_char *)snapend; 361 if (bp >= ep) 362 return; 363#ifdef notyet /* currently we see only version and type */ 364 TCHECK(pim->pim_rsv); 365#endif 366 367 switch (PIM_VER(pim->pim_typever)) { | 85/* 86 * XXX: We consider a case where IPv6 is not ready yet for portability, 87 * but PIM dependent defintions should be independent of IPv6... 88 */ 89 90struct pim { 91 u_int8_t pim_typever; 92 /* upper 4bit: PIM version number; 2 for PIMv2 */ --- 317 unchanged lines hidden (view full) --- 410 ep = (const u_char *)snapend; 411 if (bp >= ep) 412 return; 413#ifdef notyet /* currently we see only version and type */ 414 TCHECK(pim->pim_rsv); 415#endif 416 417 switch (PIM_VER(pim->pim_typever)) { |
368 case 2: /* avoid hardcoding? */ 369 (void)printf("pim v2"); 370 pimv2_print(bp, len); 371 break; | 418 case 2: 419 if (!vflag) { 420 printf("PIMv%u, %s, length: %u", 421 PIM_VER(pim->pim_typever), 422 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)), 423 len); 424 return; 425 } else { 426 printf("PIMv%u, length: %u\n\t%s", 427 PIM_VER(pim->pim_typever), 428 len, 429 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever))); 430 pimv2_print(bp, len); 431 } 432 break; |
372 default: | 433 default: |
373 (void)printf("pim v%d", PIM_VER(pim->pim_typever)); | 434 printf("PIMv%u, length: %u", 435 PIM_VER(pim->pim_typever), 436 len); |
374 break; 375 } 376 return; 377} 378 379/* 380 * PIMv2 uses encoded address representations. 381 * --- 176 unchanged lines hidden (view full) --- 558 ep = (const u_char *)snapend; 559 if (bp >= ep) 560 return; 561 if (ep > bp + len) 562 ep = bp + len; 563 TCHECK(pim->pim_rsv); 564 pimv2_addr_len = pim->pim_rsv; 565 if (pimv2_addr_len != 0) | 437 break; 438 } 439 return; 440} 441 442/* 443 * PIMv2 uses encoded address representations. 444 * --- 176 unchanged lines hidden (view full) --- 621 ep = (const u_char *)snapend; 622 if (bp >= ep) 623 return; 624 if (ep > bp + len) 625 ep = bp + len; 626 TCHECK(pim->pim_rsv); 627 pimv2_addr_len = pim->pim_rsv; 628 if (pimv2_addr_len != 0) |
566 (void)printf("[RFC2117-encoding] "); | 629 (void)printf(", RFC2117-encoding"); |
567 568 switch (PIM_TYPE(pim->pim_typever)) { | 630 631 switch (PIM_TYPE(pim->pim_typever)) { |
569 case 0: | 632 case PIMV2_TYPE_HELLO: |
570 { 571 u_int16_t otype, olen; | 633 { 634 u_int16_t otype, olen; |
572 (void)printf(" Hello"); | |
573 bp += 4; 574 while (bp < ep) { 575 TCHECK2(bp[0], 4); 576 otype = EXTRACT_16BITS(&bp[0]); 577 olen = EXTRACT_16BITS(&bp[2]); 578 TCHECK2(bp[0], 4 + olen); | 635 bp += 4; 636 while (bp < ep) { 637 TCHECK2(bp[0], 4); 638 otype = EXTRACT_16BITS(&bp[0]); 639 olen = EXTRACT_16BITS(&bp[2]); 640 TCHECK2(bp[0], 4 + olen); |
641 642 printf("\n\t %s Option (%u), length: %u, Value: ", 643 tok2str( pimv2_hello_option_values,"Unknown",otype), 644 otype, 645 olen); 646 bp += 4; 647 |
|
579 switch (otype) { | 648 switch (otype) { |
580 case 1: /* Hold time */ 581 (void)printf(" (Hold-time "); 582 relts_print(EXTRACT_16BITS(&bp[4])); 583 (void)printf(")"); 584 break; | 649 case PIMV2_HELLO_OPTION_HOLDTIME: 650 relts_print(EXTRACT_16BITS(bp)); 651 break; |
585 | 652 |
586 case 2: /* LAN Prune Delay */ 587 (void)printf(" (LAN-Prune-Delay: "); | 653 case PIMV2_HELLO_OPTION_LANPRUNEDELAY: |
588 if (olen != 4) { | 654 if (olen != 4) { |
589 (void)printf("!olen=%d!)", olen); | 655 (void)printf("ERROR: Option Lenght != 4 Bytes (%u)", olen); |
590 } else { 591 char t_bit; 592 u_int16_t lan_delay, override_interval; | 656 } else { 657 char t_bit; 658 u_int16_t lan_delay, override_interval; |
593 lan_delay = EXTRACT_16BITS(&bp[4]); 594 override_interval = EXTRACT_16BITS(&bp[6]); | 659 lan_delay = EXTRACT_16BITS(bp); 660 override_interval = EXTRACT_16BITS(bp+2); |
595 t_bit = (lan_delay & 0x8000)? 1 : 0; 596 lan_delay &= ~0x8000; | 661 t_bit = (lan_delay & 0x8000)? 1 : 0; 662 lan_delay &= ~0x8000; |
597 (void)printf("T-bit=%d lan-delay=%dms override-interval=%dms)", | 663 (void)printf("\n\t T-bit=%d, LAN delay %dms, Override interval %dms", |
598 t_bit, lan_delay, override_interval); 599 } 600 break; 601 | 664 t_bit, lan_delay, override_interval); 665 } 666 break; 667 |
602 case 18: /* Old DR-Priority */ 603 if (olen == 4) 604 (void)printf(" (OLD-DR-Priority: %d)", 605 EXTRACT_32BITS(&bp[4])); 606 else 607 goto unknown; 608 break; | 668 case PIMV2_HELLO_OPTION_DR_PRIORITY_OLD: 669 case PIMV2_HELLO_OPTION_DR_PRIORITY: 670 switch (olen) { 671 case 0: 672 printf("Bi-Directional Capability (Old)"); 673 break; 674 case 4: 675 printf("%u", EXTRACT_32BITS(bp)); 676 break; 677 default: 678 printf("ERROR: Option Lenght != 4 Bytes (%u)", olen); 679 break; 680 } 681 break; |
609 | 682 |
610 611 case 19: /* DR-Priority */ 612 if (olen == 0) { 613 (void)printf(" (OLD-bidir-capable)"); 614 break; 615 } 616 (void)printf(" (DR-Priority: "); 617 if (olen != 4) { 618 (void)printf("!olen=%d!)", olen); 619 } else { 620 (void)printf("%d)", EXTRACT_32BITS(&bp[4])); 621 } | 683 case PIMV2_HELLO_OPTION_GENID: 684 (void)printf("0x%08x", EXTRACT_32BITS(bp)); |
622 break; 623 | 685 break; 686 |
624 case 20: 625 (void)printf(" (Genid: 0x%08x)", EXTRACT_32BITS(&bp[4])); 626 break; 627 628 case 21: 629 (void)printf(" (State Refresh Capable; v%d", bp[4]); 630 if (bp[5] != 0) { 631 (void)printf(" interval "); 632 relts_print(bp[5]); | 687 case PIMV2_HELLO_OPTION_REFRESH_CAP: 688 (void)printf("v%d", *bp); 689 if (*(bp+1) != 0) { 690 (void)printf(", interval "); 691 relts_print(*(bp+1)); |
633 } | 692 } |
634 if (EXTRACT_16BITS(&bp[6]) != 0) { 635 (void)printf(" ?0x%04x?", EXTRACT_16BITS(&bp[6])); | 693 if (EXTRACT_16BITS(bp+2) != 0) { 694 (void)printf(" ?0x%04x?", EXTRACT_16BITS(bp+2)); |
636 } | 695 } |
637 (void)printf(")"); | |
638 break; 639 | 696 break; 697 |
640 case 22: /* Bidir-Capable */ 641 (void)printf(" (bidir-capable)"); | 698 case PIMV2_HELLO_OPTION_BIDIR_CAP: |
642 break; 643 | 699 break; 700 |
644 case 24: /* Address List */ 645 case 65001: /* Address List (old implementations) */ 646 (void)printf(" (%saddr-list", 647 otype == 65001 ? "old" : ""); | 701 case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD: 702 case PIMV2_HELLO_OPTION_ADDRESS_LIST: |
648 if (vflag > 1) { | 703 if (vflag > 1) { |
649 const u_char *ptr = &bp[4]; 650 while (ptr < &bp[4 + olen]) { | 704 const u_char *ptr = bp; 705 while (ptr < (bp+olen)) { |
651 int advance; 652 | 706 int advance; 707 |
653 printf(" "); | 708 printf("\n\t "); |
654 advance = pimv2_addr_print(ptr, pimv2_unicast, 0); 655 if (advance < 0) { 656 printf("..."); 657 break; 658 } 659 ptr += advance; 660 } 661 } | 709 advance = pimv2_addr_print(ptr, pimv2_unicast, 0); 710 if (advance < 0) { 711 printf("..."); 712 break; 713 } 714 ptr += advance; 715 } 716 } |
662 (void)printf(")"); | |
663 break; 664 default: | 717 break; 718 default: |
665 unknown: 666 if (vflag) 667 (void)printf(" [Hello option %d]", otype); | 719 if (vflag <= 1) 720 print_unknown_data(bp,"\n\t ",olen); 721 break; |
668 } | 722 } |
669 bp += 4 + olen; | 723 /* do we want to see an additionally hexdump ? */ 724 if (vflag> 1) 725 print_unknown_data(bp,"\n\t ",olen); 726 bp += olen; |
670 } 671 break; 672 } 673 | 727 } 728 break; 729 } 730 |
674 case 1: | 731 case PIMV2_TYPE_REGISTER: |
675 { 676 struct ip *ip; 677 | 732 { 733 struct ip *ip; 734 |
678 (void)printf(" Register"); | |
679 if (vflag && bp + 8 <= ep) { 680 (void)printf(" %s%s", bp[4] & 0x80 ? "B" : "", 681 bp[4] & 0x40 ? "N" : ""); 682 } 683 bp += 8; len -= 8; 684 685 /* encapsulated multicast packet */ 686 if (bp >= ep) 687 break; 688 ip = (struct ip *)bp; 689 switch (IP_V(ip)) { 690 case 4: /* IPv4 */ 691 printf(" "); | 735 if (vflag && bp + 8 <= ep) { 736 (void)printf(" %s%s", bp[4] & 0x80 ? "B" : "", 737 bp[4] & 0x40 ? "N" : ""); 738 } 739 bp += 8; len -= 8; 740 741 /* encapsulated multicast packet */ 742 if (bp >= ep) 743 break; 744 ip = (struct ip *)bp; 745 switch (IP_V(ip)) { 746 case 4: /* IPv4 */ 747 printf(" "); |
692 ip_print(bp, len); | 748 ip_print(gndo, bp, len); |
693 break; 694#ifdef INET6 695 case 6: /* IPv6 */ 696 printf(" "); 697 ip6_print(bp, len); 698 break; 699#endif 700 default: 701 (void)printf(" IP ver %d", IP_V(ip)); 702 break; 703 } 704 break; 705 } 706 | 749 break; 750#ifdef INET6 751 case 6: /* IPv6 */ 752 printf(" "); 753 ip6_print(bp, len); 754 break; 755#endif 756 default: 757 (void)printf(" IP ver %d", IP_V(ip)); 758 break; 759 } 760 break; 761 } 762 |
707 case 2: 708 (void)printf(" Register-Stop"); | 763 case PIMV2_TYPE_REGISTER_STOP: |
709 bp += 4; len -= 4; 710 if (bp >= ep) 711 break; 712 (void)printf(" group="); 713 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 714 (void)printf("..."); 715 break; 716 } 717 bp += advance; len -= advance; 718 if (bp >= ep) 719 break; 720 (void)printf(" source="); 721 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 722 (void)printf("..."); 723 break; 724 } 725 bp += advance; len -= advance; 726 break; 727 | 764 bp += 4; len -= 4; 765 if (bp >= ep) 766 break; 767 (void)printf(" group="); 768 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 769 (void)printf("..."); 770 break; 771 } 772 bp += advance; len -= advance; 773 if (bp >= ep) 774 break; 775 (void)printf(" source="); 776 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 777 (void)printf("..."); 778 break; 779 } 780 bp += advance; len -= advance; 781 break; 782 |
728 case 3: 729 case 6: 730 case 7: | 783 case PIMV2_TYPE_JOIN_PRUNE: 784 case PIMV2_TYPE_GRAFT: 785 case PIMV2_TYPE_GRAFT_ACK: 786 787 788 /* 789 * 0 1 2 3 790 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 791 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 792 * |PIM Ver| Type | Addr length | Checksum | 793 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 794 * | Unicast-Upstream Neighbor Address | 795 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 796 * | Reserved | Num groups | Holdtime | 797 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 798 * | Encoded-Multicast Group Address-1 | 799 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 800 * | Number of Joined Sources | Number of Pruned Sources | 801 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 802 * | Encoded-Joined Source Address-1 | 803 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 804 * | . | 805 * | . | 806 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 807 * | Encoded-Joined Source Address-n | 808 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 809 * | Encoded-Pruned Source Address-1 | 810 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 811 * | . | 812 * | . | 813 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 814 * | Encoded-Pruned Source Address-n | 815 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 816 * | . | 817 * | . | 818 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 819 * | Encoded-Multicast Group Address-n | 820 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 821 */ 822 |
731 { 732 u_int8_t ngroup; 733 u_int16_t holdtime; 734 u_int16_t njoin; 735 u_int16_t nprune; 736 int i, j; 737 | 823 { 824 u_int8_t ngroup; 825 u_int16_t holdtime; 826 u_int16_t njoin; 827 u_int16_t nprune; 828 int i, j; 829 |
738 switch (PIM_TYPE(pim->pim_typever)) { 739 case 3: 740 (void)printf(" Join/Prune"); 741 break; 742 case 6: 743 (void)printf(" Graft"); 744 break; 745 case 7: 746 (void)printf(" Graft-ACK"); 747 break; 748 } | |
749 bp += 4; len -= 4; 750 if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/ 751 if (bp >= ep) 752 break; | 830 bp += 4; len -= 4; 831 if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/ 832 if (bp >= ep) 833 break; |
753 (void)printf(" upstream-neighbor="); | 834 (void)printf(", upstream-neighbor: "); |
754 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 755 (void)printf("..."); 756 break; 757 } 758 bp += advance; len -= advance; 759 } 760 if (bp + 4 > ep) 761 break; 762 ngroup = bp[1]; 763 holdtime = EXTRACT_16BITS(&bp[2]); | 835 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 836 (void)printf("..."); 837 break; 838 } 839 bp += advance; len -= advance; 840 } 841 if (bp + 4 > ep) 842 break; 843 ngroup = bp[1]; 844 holdtime = EXTRACT_16BITS(&bp[2]); |
764 (void)printf(" groups=%u", ngroup); | 845 (void)printf("\n\t %u group(s)", ngroup); |
765 if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/ | 846 if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/ |
766 (void)printf(" holdtime="); | 847 (void)printf(", holdtime: "); |
767 if (holdtime == 0xffff) | 848 if (holdtime == 0xffff) |
768 (void)printf("infty"); | 849 (void)printf("infinite"); |
769 else 770 relts_print(holdtime); 771 } 772 bp += 4; len -= 4; 773 for (i = 0; i < ngroup; i++) { 774 if (bp >= ep) 775 goto jp_done; | 850 else 851 relts_print(holdtime); 852 } 853 bp += 4; len -= 4; 854 for (i = 0; i < ngroup; i++) { 855 if (bp >= ep) 856 goto jp_done; |
776 (void)printf(" (group%d: ", i); | 857 (void)printf("\n\t group #%u: ", i+1); |
777 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 778 (void)printf("...)"); 779 goto jp_done; 780 } 781 bp += advance; len -= advance; 782 if (bp + 4 > ep) { 783 (void)printf("...)"); 784 goto jp_done; 785 } 786 njoin = EXTRACT_16BITS(&bp[0]); 787 nprune = EXTRACT_16BITS(&bp[2]); | 858 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 859 (void)printf("...)"); 860 goto jp_done; 861 } 862 bp += advance; len -= advance; 863 if (bp + 4 > ep) { 864 (void)printf("...)"); 865 goto jp_done; 866 } 867 njoin = EXTRACT_16BITS(&bp[0]); 868 nprune = EXTRACT_16BITS(&bp[2]); |
788 (void)printf(" join=%u", njoin); | 869 (void)printf(", joined sources: %u, pruned sources: %u", njoin,nprune); |
789 bp += 4; len -= 4; 790 for (j = 0; j < njoin; j++) { | 870 bp += 4; len -= 4; 871 for (j = 0; j < njoin; j++) { |
791 (void)printf(" "); | 872 (void)printf("\n\t joined source #%u: ",j+1); |
792 if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) { 793 (void)printf("...)"); 794 goto jp_done; 795 } 796 bp += advance; len -= advance; 797 } | 873 if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) { 874 (void)printf("...)"); 875 goto jp_done; 876 } 877 bp += advance; len -= advance; 878 } |
798 (void)printf(" prune=%u", nprune); | |
799 for (j = 0; j < nprune; j++) { | 879 for (j = 0; j < nprune; j++) { |
800 (void)printf(" "); | 880 (void)printf("\n\t pruned source #%u: ",j+1); |
801 if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) { 802 (void)printf("...)"); 803 goto jp_done; 804 } 805 bp += advance; len -= advance; 806 } | 881 if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) { 882 (void)printf("...)"); 883 goto jp_done; 884 } 885 bp += advance; len -= advance; 886 } |
807 (void)printf(")"); | |
808 } 809 jp_done: 810 break; 811 } 812 | 887 } 888 jp_done: 889 break; 890 } 891 |
813 case 4: | 892 case PIMV2_TYPE_BOOTSTRAP: |
814 { 815 int i, j, frpcnt; | 893 { 894 int i, j, frpcnt; |
816 817 (void)printf(" Bootstrap"); | |
818 bp += 4; 819 820 /* Fragment Tag, Hash Mask len, and BSR-priority */ 821 if (bp + sizeof(u_int16_t) >= ep) break; 822 (void)printf(" tag=%x", EXTRACT_16BITS(bp)); 823 bp += sizeof(u_int16_t); 824 if (bp >= ep) break; 825 (void)printf(" hashmlen=%d", bp[0]); --- 57 unchanged lines hidden (view full) --- 883 (void)printf(",prio=%d", bp[2]); 884 bp += 4; 885 } 886 (void)printf(")"); 887 } 888 bs_done: 889 break; 890 } | 895 bp += 4; 896 897 /* Fragment Tag, Hash Mask len, and BSR-priority */ 898 if (bp + sizeof(u_int16_t) >= ep) break; 899 (void)printf(" tag=%x", EXTRACT_16BITS(bp)); 900 bp += sizeof(u_int16_t); 901 if (bp >= ep) break; 902 (void)printf(" hashmlen=%d", bp[0]); --- 57 unchanged lines hidden (view full) --- 960 (void)printf(",prio=%d", bp[2]); 961 bp += 4; 962 } 963 (void)printf(")"); 964 } 965 bs_done: 966 break; 967 } |
891 case 5: 892 (void)printf(" Assert"); | 968 case PIMV2_TYPE_ASSERT: |
893 bp += 4; len -= 4; 894 if (bp >= ep) 895 break; 896 (void)printf(" group="); 897 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 898 (void)printf("..."); 899 break; 900 } --- 9 unchanged lines hidden (view full) --- 910 if (bp + 8 > ep) 911 break; 912 if (bp[0] & 0x80) 913 (void)printf(" RPT"); 914 (void)printf(" pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff); 915 (void)printf(" metric=%u", EXTRACT_32BITS(&bp[4])); 916 break; 917 | 969 bp += 4; len -= 4; 970 if (bp >= ep) 971 break; 972 (void)printf(" group="); 973 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { 974 (void)printf("..."); 975 break; 976 } --- 9 unchanged lines hidden (view full) --- 986 if (bp + 8 > ep) 987 break; 988 if (bp[0] & 0x80) 989 (void)printf(" RPT"); 990 (void)printf(" pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff); 991 (void)printf(" metric=%u", EXTRACT_32BITS(&bp[4])); 992 break; 993 |
918 case 8: | 994 case PIMV2_TYPE_CANDIDATE_RP: |
919 { 920 int i, pfxcnt; | 995 { 996 int i, pfxcnt; |
921 922 (void)printf(" Candidate-RP-Advertisement"); | |
923 bp += 4; 924 925 /* Prefix-Cnt, Priority, and Holdtime */ 926 if (bp >= ep) break; 927 (void)printf(" prefix-cnt=%d", bp[0]); 928 pfxcnt = bp[0]; 929 if (bp + 1 >= ep) break; 930 (void)printf(" prio=%d", bp[1]); --- 19 unchanged lines hidden (view full) --- 950 (void)printf("..."); 951 break; 952 } 953 bp += advance; 954 } 955 break; 956 } 957 | 997 bp += 4; 998 999 /* Prefix-Cnt, Priority, and Holdtime */ 1000 if (bp >= ep) break; 1001 (void)printf(" prefix-cnt=%d", bp[0]); 1002 pfxcnt = bp[0]; 1003 if (bp + 1 >= ep) break; 1004 (void)printf(" prio=%d", bp[1]); --- 19 unchanged lines hidden (view full) --- 1024 (void)printf("..."); 1025 break; 1026 } 1027 bp += advance; 1028 } 1029 break; 1030 } 1031 |
958 case 9: 959 (void)printf(" Prune-Refresh"); | 1032 case PIMV2_TYPE_PRUNE_REFRESH: |
960 (void)printf(" src="); 961 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 962 (void)printf("..."); 963 break; 964 } 965 bp += advance; 966 (void)printf(" grp="); 967 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { --- 18 unchanged lines hidden (view full) --- 986 break; 987 } 988 989 return; 990 991trunc: 992 (void)printf("[|pim]"); 993} | 1033 (void)printf(" src="); 1034 if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) { 1035 (void)printf("..."); 1036 break; 1037 } 1038 bp += advance; 1039 (void)printf(" grp="); 1040 if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) { --- 18 unchanged lines hidden (view full) --- 1059 break; 1060 } 1061 1062 return; 1063 1064trunc: 1065 (void)printf("[|pim]"); 1066} |
1067 1068/* 1069 * Local Variables: 1070 * c-style: whitesmith 1071 * c-basic-offset: 8 1072 * End: 1073 */ |
|