Deleted Added
full compact
21c21
< * $FreeBSD: head/contrib/tcpdump/print-pim.c 127675 2004-03-31 14:57:24Z bms $
---
> * $FreeBSD: head/contrib/tcpdump/print-pim.c 146778 2005-05-29 19:09:28Z sam $
26c26
< "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.37.2.4 2004/03/24 02:52:37 guy Exp $ (LBL)";
---
> "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45 2005/04/06 21:32:42 mcr Exp $ (LBL)";
33a34
> #include "interface.h"
34a36,84
> #define PIMV2_TYPE_HELLO 0
> #define PIMV2_TYPE_REGISTER 1
> #define PIMV2_TYPE_REGISTER_STOP 2
> #define PIMV2_TYPE_JOIN_PRUNE 3
> #define PIMV2_TYPE_BOOTSTRAP 4
> #define PIMV2_TYPE_ASSERT 5
> #define PIMV2_TYPE_GRAFT 6
> #define PIMV2_TYPE_GRAFT_ACK 7
> #define PIMV2_TYPE_CANDIDATE_RP 8
> #define PIMV2_TYPE_PRUNE_REFRESH 9
>
> static struct tok pimv2_type_values[] = {
> { PIMV2_TYPE_HELLO, "Hello" },
> { PIMV2_TYPE_REGISTER, "Register" },
> { PIMV2_TYPE_REGISTER_STOP, "Register Stop" },
> { PIMV2_TYPE_JOIN_PRUNE, "Join / Prune" },
> { PIMV2_TYPE_BOOTSTRAP, "Bootstrap" },
> { PIMV2_TYPE_ASSERT, "Assert" },
> { PIMV2_TYPE_GRAFT, "Graft" },
> { PIMV2_TYPE_GRAFT_ACK, "Graft Acknowledgement" },
> { PIMV2_TYPE_CANDIDATE_RP, "Candidate RP Advertisement" },
> { PIMV2_TYPE_PRUNE_REFRESH, "Prune Refresh" },
> { 0, NULL}
> };
>
> #define PIMV2_HELLO_OPTION_HOLDTIME 1
> #define PIMV2_HELLO_OPTION_LANPRUNEDELAY 2
> #define PIMV2_HELLO_OPTION_DR_PRIORITY_OLD 18
> #define PIMV2_HELLO_OPTION_DR_PRIORITY 19
> #define PIMV2_HELLO_OPTION_GENID 20
> #define PIMV2_HELLO_OPTION_REFRESH_CAP 21
> #define PIMV2_HELLO_OPTION_BIDIR_CAP 22
> #define PIMV2_HELLO_OPTION_ADDRESS_LIST 24
> #define PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD 65001
>
> static struct tok pimv2_hello_option_values[] = {
> { PIMV2_HELLO_OPTION_HOLDTIME, "Hold Time" },
> { PIMV2_HELLO_OPTION_LANPRUNEDELAY, "LAN Prune Delay" },
> { PIMV2_HELLO_OPTION_DR_PRIORITY_OLD, "DR Priority (Old)" },
> { PIMV2_HELLO_OPTION_DR_PRIORITY, "DR Priority" },
> { PIMV2_HELLO_OPTION_GENID, "Generation ID" },
> { PIMV2_HELLO_OPTION_REFRESH_CAP, "State Refresh Capability" },
> { PIMV2_HELLO_OPTION_BIDIR_CAP, "Bi-Directional Capability" },
> { PIMV2_HELLO_OPTION_ADDRESS_LIST, "Address List" },
> { PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD, "Address List (Old)" },
> { 0, NULL}
> };
>
>
368,371c418,432
< case 2: /* avoid hardcoding? */
< (void)printf("pim v2");
< pimv2_print(bp, len);
< break;
---
> case 2:
> if (!vflag) {
> printf("PIMv%u, %s, length: %u",
> PIM_VER(pim->pim_typever),
> tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
> len);
> return;
> } else {
> printf("PIMv%u, length: %u\n\t%s",
> PIM_VER(pim->pim_typever),
> len,
> tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
> pimv2_print(bp, len);
> }
> break;
373c434,436
< (void)printf("pim v%d", PIM_VER(pim->pim_typever));
---
> printf("PIMv%u, length: %u",
> PIM_VER(pim->pim_typever),
> len);
566c629
< (void)printf("[RFC2117-encoding] ");
---
> (void)printf(", RFC2117-encoding");
569c632
< case 0:
---
> case PIMV2_TYPE_HELLO:
572d634
< (void)printf(" Hello");
578a641,647
>
> printf("\n\t %s Option (%u), length: %u, Value: ",
> tok2str( pimv2_hello_option_values,"Unknown",otype),
> otype,
> olen);
> bp += 4;
>
580,584c649,651
< case 1: /* Hold time */
< (void)printf(" (Hold-time ");
< relts_print(EXTRACT_16BITS(&bp[4]));
< (void)printf(")");
< break;
---
> case PIMV2_HELLO_OPTION_HOLDTIME:
> relts_print(EXTRACT_16BITS(bp));
> break;
586,587c653
< case 2: /* LAN Prune Delay */
< (void)printf(" (LAN-Prune-Delay: ");
---
> case PIMV2_HELLO_OPTION_LANPRUNEDELAY:
589c655
< (void)printf("!olen=%d!)", olen);
---
> (void)printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
593,594c659,660
< lan_delay = EXTRACT_16BITS(&bp[4]);
< override_interval = EXTRACT_16BITS(&bp[6]);
---
> lan_delay = EXTRACT_16BITS(bp);
> override_interval = EXTRACT_16BITS(bp+2);
597c663
< (void)printf("T-bit=%d lan-delay=%dms override-interval=%dms)",
---
> (void)printf("\n\t T-bit=%d, LAN delay %dms, Override interval %dms",
602,608c668,681
< case 18: /* Old DR-Priority */
< if (olen == 4)
< (void)printf(" (OLD-DR-Priority: %d)",
< EXTRACT_32BITS(&bp[4]));
< else
< goto unknown;
< break;
---
> case PIMV2_HELLO_OPTION_DR_PRIORITY_OLD:
> case PIMV2_HELLO_OPTION_DR_PRIORITY:
> switch (olen) {
> case 0:
> printf("Bi-Directional Capability (Old)");
> break;
> case 4:
> printf("%u", EXTRACT_32BITS(bp));
> break;
> default:
> printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
> break;
> }
> break;
610,621c683,684
<
< case 19: /* DR-Priority */
< if (olen == 0) {
< (void)printf(" (OLD-bidir-capable)");
< break;
< }
< (void)printf(" (DR-Priority: ");
< if (olen != 4) {
< (void)printf("!olen=%d!)", olen);
< } else {
< (void)printf("%d)", EXTRACT_32BITS(&bp[4]));
< }
---
> case PIMV2_HELLO_OPTION_GENID:
> (void)printf("0x%08x", EXTRACT_32BITS(bp));
624,632c687,691
< case 20:
< (void)printf(" (Genid: 0x%08x)", EXTRACT_32BITS(&bp[4]));
< break;
<
< case 21:
< (void)printf(" (State Refresh Capable; v%d", bp[4]);
< if (bp[5] != 0) {
< (void)printf(" interval ");
< relts_print(bp[5]);
---
> case PIMV2_HELLO_OPTION_REFRESH_CAP:
> (void)printf("v%d", *bp);
> if (*(bp+1) != 0) {
> (void)printf(", interval ");
> relts_print(*(bp+1));
634,635c693,694
< if (EXTRACT_16BITS(&bp[6]) != 0) {
< (void)printf(" ?0x%04x?", EXTRACT_16BITS(&bp[6]));
---
> if (EXTRACT_16BITS(bp+2) != 0) {
> (void)printf(" ?0x%04x?", EXTRACT_16BITS(bp+2));
637d695
< (void)printf(")");
640,641c698
< case 22: /* Bidir-Capable */
< (void)printf(" (bidir-capable)");
---
> case PIMV2_HELLO_OPTION_BIDIR_CAP:
644,647c701,702
< case 24: /* Address List */
< case 65001: /* Address List (old implementations) */
< (void)printf(" (%saddr-list",
< otype == 65001 ? "old" : "");
---
> case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD:
> case PIMV2_HELLO_OPTION_ADDRESS_LIST:
649,650c704,705
< const u_char *ptr = &bp[4];
< while (ptr < &bp[4 + olen]) {
---
> const u_char *ptr = bp;
> while (ptr < (bp+olen)) {
653c708
< printf(" ");
---
> printf("\n\t ");
662d716
< (void)printf(")");
665,667c719,721
< unknown:
< if (vflag)
< (void)printf(" [Hello option %d]", otype);
---
> if (vflag <= 1)
> print_unknown_data(bp,"\n\t ",olen);
> break;
669c723,726
< bp += 4 + olen;
---
> /* do we want to see an additionally hexdump ? */
> if (vflag> 1)
> print_unknown_data(bp,"\n\t ",olen);
> bp += olen;
674c731
< case 1:
---
> case PIMV2_TYPE_REGISTER:
678d734
< (void)printf(" Register");
692c748
< ip_print(bp, len);
---
> ip_print(gndo, bp, len);
707,708c763
< case 2:
< (void)printf(" Register-Stop");
---
> case PIMV2_TYPE_REGISTER_STOP:
728,730c783,822
< case 3:
< case 6:
< case 7:
---
> case PIMV2_TYPE_JOIN_PRUNE:
> case PIMV2_TYPE_GRAFT:
> case PIMV2_TYPE_GRAFT_ACK:
>
>
> /*
> * 0 1 2 3
> * 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
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * |PIM Ver| Type | Addr length | Checksum |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Unicast-Upstream Neighbor Address |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Reserved | Num groups | Holdtime |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Multicast Group Address-1 |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Number of Joined Sources | Number of Pruned Sources |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Joined Source Address-1 |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | . |
> * | . |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Joined Source Address-n |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Pruned Source Address-1 |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | . |
> * | . |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Pruned Source Address-n |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | . |
> * | . |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> * | Encoded-Multicast Group Address-n |
> * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> */
>
738,748d829
< switch (PIM_TYPE(pim->pim_typever)) {
< case 3:
< (void)printf(" Join/Prune");
< break;
< case 6:
< (void)printf(" Graft");
< break;
< case 7:
< (void)printf(" Graft-ACK");
< break;
< }
753c834
< (void)printf(" upstream-neighbor=");
---
> (void)printf(", upstream-neighbor: ");
764c845
< (void)printf(" groups=%u", ngroup);
---
> (void)printf("\n\t %u group(s)", ngroup);
766c847
< (void)printf(" holdtime=");
---
> (void)printf(", holdtime: ");
768c849
< (void)printf("infty");
---
> (void)printf("infinite");
776c857
< (void)printf(" (group%d: ", i);
---
> (void)printf("\n\t group #%u: ", i+1);
788c869
< (void)printf(" join=%u", njoin);
---
> (void)printf(", joined sources: %u, pruned sources: %u", njoin,nprune);
791c872
< (void)printf(" ");
---
> (void)printf("\n\t joined source #%u: ",j+1);
798d878
< (void)printf(" prune=%u", nprune);
800c880
< (void)printf(" ");
---
> (void)printf("\n\t pruned source #%u: ",j+1);
807d886
< (void)printf(")");
813c892
< case 4:
---
> case PIMV2_TYPE_BOOTSTRAP:
816,817d894
<
< (void)printf(" Bootstrap");
891,892c968
< case 5:
< (void)printf(" Assert");
---
> case PIMV2_TYPE_ASSERT:
918c994
< case 8:
---
> case PIMV2_TYPE_CANDIDATE_RP:
921,922d996
<
< (void)printf(" Candidate-RP-Advertisement");
958,959c1032
< case 9:
< (void)printf(" Prune-Refresh");
---
> case PIMV2_TYPE_PRUNE_REFRESH:
993a1067,1073
>
> /*
> * Local Variables:
> * c-style: whitesmith
> * c-basic-offset: 8
> * End:
> */