Deleted Added
full compact
print-pim.c (57278) print-pim.c (75118)
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 57278 2000-02-17 03:30:04Z fenner $
21 * $FreeBSD: head/contrib/tcpdump/print-pim.c 75118 2001-04-03 07:50:46Z fenner $
22 */
23
24#ifndef lint
25static const char rcsid[] =
22 */
23
24#ifndef lint
25static const char rcsid[] =
26 "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.15.2.1 2000/01/25 18:29:05 itojun Exp $ (LBL)";
26 "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.23 2000/10/03 02:55:00 itojun Exp $ (LBL)";
27#endif
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include <sys/param.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36
37#include <netinet/in.h>
27#endif
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include <sys/param.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36
37#include <netinet/in.h>
38#include <netinet/in_systm.h>
39#include <netinet/ip.h>
40
41/*
42 * XXX: We consider a case where IPv6 is not ready yet for portability,
43 * but PIM dependent defintions should be independent of IPv6...
44 */
45
46struct pim {
47 u_int8_t pim_typever;

--- 13 unchanged lines hidden (view full) ---

61#include <stdio.h>
62#include <stdlib.h>
63#include <unistd.h>
64
65#include "interface.h"
66#include "addrtoname.h"
67#include "extract.h"
68
38
39/*
40 * XXX: We consider a case where IPv6 is not ready yet for portability,
41 * but PIM dependent defintions should be independent of IPv6...
42 */
43
44struct pim {
45 u_int8_t pim_typever;

--- 13 unchanged lines hidden (view full) ---

59#include <stdio.h>
60#include <stdlib.h>
61#include <unistd.h>
62
63#include "interface.h"
64#include "addrtoname.h"
65#include "extract.h"
66
67#include "ip.h"
68
69static void pimv2_print(register const u_char *bp, register u_int len);
70
71static void
72pimv1_join_prune_print(register const u_char *bp, register u_int len)
73{
74 int maddrlen, addrlen, ngroups, njoin, nprune;
75 int njp;
76

--- 236 unchanged lines hidden (view full) ---

313 */
314 while (numrps--) {
315 int nentries;
316 char s;
317
318 TCHECK2(bp[0], 4);
319 (void)printf(" RP %s", ipaddr_string(bp));
320 TCHECK(bp[4]);
69static void pimv2_print(register const u_char *bp, register u_int len);
70
71static void
72pimv1_join_prune_print(register const u_char *bp, register u_int len)
73{
74 int maddrlen, addrlen, ngroups, njoin, nprune;
75 int njp;
76

--- 236 unchanged lines hidden (view full) ---

313 */
314 while (numrps--) {
315 int nentries;
316 char s;
317
318 TCHECK2(bp[0], 4);
319 (void)printf(" RP %s", ipaddr_string(bp));
320 TCHECK(bp[4]);
321 switch(bp[4] & 0x3) {
321 switch (bp[4] & 0x3) {
322 case 0: printf(" PIMv?");
323 break;
324 case 1: printf(" PIMv1");
325 break;
326 case 2: printf(" PIMv2");
327 break;
328 case 3: printf(" PIMv1+2");
329 break;

--- 25 unchanged lines hidden (view full) ---

355
356 ep = (const u_char *)snapend;
357 if (bp >= ep)
358 return;
359#ifdef notyet /* currently we see only version and type */
360 TCHECK(pim->pim_rsv);
361#endif
362
322 case 0: printf(" PIMv?");
323 break;
324 case 1: printf(" PIMv1");
325 break;
326 case 2: printf(" PIMv2");
327 break;
328 case 3: printf(" PIMv1+2");
329 break;

--- 25 unchanged lines hidden (view full) ---

355
356 ep = (const u_char *)snapend;
357 if (bp >= ep)
358 return;
359#ifdef notyet /* currently we see only version and type */
360 TCHECK(pim->pim_rsv);
361#endif
362
363 switch(PIM_VER(pim->pim_typever)) {
363 switch (PIM_VER(pim->pim_typever)) {
364 case 2: /* avoid hardcoding? */
365 (void)printf("pim v2");
366 pimv2_print(bp, len);
367 break;
368 default:
369 (void)printf("pim v%d", PIM_VER(pim->pim_typever));
370 break;
371 }

--- 259 unchanged lines hidden (view full) ---

631 bp[4] & 0x40 ? "N" : "");
632 }
633 bp += 8; len -= 8;
634
635 /* encapsulated multicast packet */
636 if (bp >= ep)
637 break;
638 ip = (struct ip *)bp;
364 case 2: /* avoid hardcoding? */
365 (void)printf("pim v2");
366 pimv2_print(bp, len);
367 break;
368 default:
369 (void)printf("pim v%d", PIM_VER(pim->pim_typever));
370 break;
371 }

--- 259 unchanged lines hidden (view full) ---

631 bp[4] & 0x40 ? "N" : "");
632 }
633 bp += 8; len -= 8;
634
635 /* encapsulated multicast packet */
636 if (bp >= ep)
637 break;
638 ip = (struct ip *)bp;
639 switch(ip->ip_v) {
639 switch (IP_V(ip)) {
640 case 4: /* IPv4 */
641 printf(" ");
642 ip_print(bp, len);
643 break;
644#ifdef INET6
645 case 6: /* IPv6 */
646 printf(" ");
647 ip6_print(bp, len);
648 break;
649#endif
650 default:
640 case 4: /* IPv4 */
641 printf(" ");
642 ip_print(bp, len);
643 break;
644#ifdef INET6
645 case 6: /* IPv6 */
646 printf(" ");
647 ip6_print(bp, len);
648 break;
649#endif
650 default:
651 (void)printf(" IP ver %d", ip->ip_v);
651 (void)printf(" IP ver %d", IP_V(ip));
652 break;
653 }
654 break;
655 }
656
657 case 2:
658 (void)printf(" Register-Stop");
659 bp += 4; len -= 4;

--- 136 unchanged lines hidden (view full) ---

796 }
797 bp += advance;
798
799 /* RP-Count, Frag RP-Cnt, and rsvd */
800 if (bp >= ep) {
801 (void)printf("...)");
802 goto bs_done;
803 }
652 break;
653 }
654 break;
655 }
656
657 case 2:
658 (void)printf(" Register-Stop");
659 bp += 4; len -= 4;

--- 136 unchanged lines hidden (view full) ---

796 }
797 bp += advance;
798
799 /* RP-Count, Frag RP-Cnt, and rsvd */
800 if (bp >= ep) {
801 (void)printf("...)");
802 goto bs_done;
803 }
804 (void)printf(" RPcnt=%d", frpcnt = bp[0]);
804 (void)printf(" RPcnt=%d", bp[0]);
805 if (bp + 1 >= ep) {
806 (void)printf("...)");
807 goto bs_done;
808 }
805 if (bp + 1 >= ep) {
806 (void)printf("...)");
807 goto bs_done;
808 }
809 (void)printf(" FRPcnt=%d", bp[1]);
809 (void)printf(" FRPcnt=%d", frpcnt = bp[1]);
810 bp += 4;
811
812 for (j = 0; j < frpcnt && bp < ep; j++) {
813 /* each RP info */
814 (void)printf(" RP%d=", j);
815 if ((advance = pimv2_addr_print(bp,
816 pimv2_unicast,
817 0)) < 0) {

--- 126 unchanged lines hidden ---
810 bp += 4;
811
812 for (j = 0; j < frpcnt && bp < ep; j++) {
813 /* each RP info */
814 (void)printf(" RP%d=", j);
815 if ((advance = pimv2_addr_print(bp,
816 pimv2_unicast,
817 0)) < 0) {

--- 126 unchanged lines hidden ---