]>
The Tcpdump Group git mirrors - tcpdump/blob - print-msdp.c
2 * Copyright (c) 2001 William C. Fenner.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code
7 * distributions retain the above copyright notice and this paragraph
8 * in its entirety, and (2) distributions including binary code include
9 * the above copyright notice and this paragraph in its entirety in
10 * the documentation or other materials provided with the distribution.
11 * The name of William C. Fenner may not be used to endorse or
12 * promote products derived from this software without specific prior
13 * written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND
14 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
15 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
16 * FOR A PARTICULAR PURPOSE.
19 #define NETDISSECT_REWORKED
24 #include <tcpdump-stdinc.h>
26 #include "interface.h"
27 #include "addrtoname.h"
30 #define MSDP_TYPE_MAX 7
33 msdp_print(netdissect_options
*ndo
, const u_char
*sp
, u_int length
)
35 unsigned int type
, len
;
38 /* See if we think we're at the beginning of a compound packet */
40 len
= EXTRACT_16BITS(sp
+ 1);
41 if (len
> 1500 || len
< 3 || type
== 0 || type
> MSDP_TYPE_MAX
)
42 goto trunc
; /* not really truncated, but still not decodable */
43 ND_PRINT((ndo
, " msdp:"));
47 len
= EXTRACT_16BITS(sp
+ 1);
48 if (len
> 1400 || ndo
->ndo_vflag
)
49 ND_PRINT((ndo
, " [len %u]", len
));
55 case 1: /* IPv4 Source-Active */
56 case 3: /* IPv4 Source-Active Response */
58 ND_PRINT((ndo
, " SA"));
60 ND_PRINT((ndo
, " SA-Response"));
62 ND_PRINT((ndo
, " %u entries", *sp
));
63 if ((u_int
)((*sp
* 12) + 8) < len
) {
64 ND_PRINT((ndo
, " [w/data]"));
65 if (ndo
->ndo_vflag
> 1) {
67 ip_print(ndo
, sp
+ *sp
* 12 + 8 - 3,
68 len
- (*sp
* 12 + 8));
73 ND_PRINT((ndo
, " SA-Request"));
75 ND_PRINT((ndo
, " for %s", ipaddr_string(ndo
, sp
+ 1)));
78 ND_PRINT((ndo
, " Keepalive"));
80 ND_PRINT((ndo
, "[len=%d] ", len
));
83 ND_PRINT((ndo
, " Notification"));
86 ND_PRINT((ndo
, " [type=%d len=%d]", type
, len
));
94 ND_PRINT((ndo
, " [|msdp]"));