print-pim.c (56894) | print-pim.c (57278) |
---|---|
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 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning 11 * features or use of this software display the following acknowledgement: 12 * ``This product includes software developed by the University of California, 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. | 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 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning 11 * features or use of this software display the following acknowledgement: 12 * ``This product includes software developed by the University of California, 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 $ |
|
20 */ 21 22#ifndef lint 23static const char rcsid[] = 24 "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.15.2.1 2000/01/25 18:29:05 itojun Exp $ (LBL)"; 25#endif 26 27#ifdef HAVE_CONFIG_H --- 10 unchanged lines hidden (view full) --- 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; | 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)"; 27#endif 28 29#ifdef HAVE_CONFIG_H --- 10 unchanged lines hidden (view full) --- 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; |
46 /* upper 4bit: the PIM message type, currently they are: | 48 /* upper 4bit: PIM version number; 2 for PIMv2 */ 49 /* lower 4bit: the PIM message type, currently they are: |
47 * Hello, Register, Register-Stop, Join/Prune, 48 * Bootstrap, Assert, Graft (PIM-DM only), 49 * Graft-Ack (PIM-DM only), C-RP-Adv 50 */ | 50 * Hello, Register, Register-Stop, Join/Prune, 51 * Bootstrap, Assert, Graft (PIM-DM only), 52 * Graft-Ack (PIM-DM only), C-RP-Adv 53 */ |
51 /* lower 4bit: PIM version number; 2 for PIMv2 */ 52#define PIM_TYPE(x) (((x) & 0xf0) >> 4) 53#define PIM_VER(x) ((x) & 0x0f) | 54#define PIM_VER(x) (((x) & 0xf0) >> 4) 55#define PIM_TYPE(x) ((x) & 0x0f) |
54 u_char pim_rsv; /* Reserved */ 55 u_short pim_cksum; /* IP style check sum */ 56}; 57 58 59#include <stdio.h> 60#include <stdlib.h> 61#include <unistd.h> --- 293 unchanged lines hidden (view full) --- 355 if (bp >= ep) 356 return; 357#ifdef notyet /* currently we see only version and type */ 358 TCHECK(pim->pim_rsv); 359#endif 360 361 switch(PIM_VER(pim->pim_typever)) { 362 case 2: /* avoid hardcoding? */ | 56 u_char pim_rsv; /* Reserved */ 57 u_short pim_cksum; /* IP style check sum */ 58}; 59 60 61#include <stdio.h> 62#include <stdlib.h> 63#include <unistd.h> --- 293 unchanged lines hidden (view full) --- 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)) { 364 case 2: /* avoid hardcoding? */ |
363 (void)printf("v2"); | 365 (void)printf("pim v2"); |
364 pimv2_print(bp, len); 365 break; 366 default: | 366 pimv2_print(bp, len); 367 break; 368 default: |
367 (void)printf("v%d", PIM_VER(pim->pim_typever)); | 369 (void)printf("pim v%d", PIM_VER(pim->pim_typever)); |
368 break; 369 } 370 return; 371} 372 373/* 374 * PIMv2 uses encoded address representations. 375 * --- 176 unchanged lines hidden (view full) --- 552{ 553 register const u_char *ep; 554 register struct pim *pim = (struct pim *)bp; 555 int advance; 556 557 ep = (const u_char *)snapend; 558 if (bp >= ep) 559 return; | 370 break; 371 } 372 return; 373} 374 375/* 376 * PIMv2 uses encoded address representations. 377 * --- 176 unchanged lines hidden (view full) --- 554{ 555 register const u_char *ep; 556 register struct pim *pim = (struct pim *)bp; 557 int advance; 558 559 ep = (const u_char *)snapend; 560 if (bp >= ep) 561 return; |
562 if (ep > bp + len) 563 ep = bp + len; |
|
560 TCHECK(pim->pim_rsv); 561 pimv2_addr_len = pim->pim_rsv; 562 if (pimv2_addr_len != 0) 563 (void)printf("[RFC2117-encoding] "); 564 565 switch (PIM_TYPE(pim->pim_typever)) { 566 case 0: 567 { --- 372 unchanged lines hidden --- | 564 TCHECK(pim->pim_rsv); 565 pimv2_addr_len = pim->pim_rsv; 566 if (pimv2_addr_len != 0) 567 (void)printf("[RFC2117-encoding] "); 568 569 switch (PIM_TYPE(pim->pim_typever)) { 570 case 0: 571 { --- 372 unchanged lines hidden --- |