]>
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 /* \summary: Multicast Source Discovery Protocol (MSDP) printer */
25 #include <netdissect-stdinc.h>
27 #include "netdissect.h"
28 #include "addrtoname.h"
31 #define MSDP_TYPE_MAX 7
34 msdp_print(netdissect_options
*ndo
, const u_char
*sp
, u_int length
)
36 unsigned int type
, len
;
39 /* See if we think we're at the beginning of a compound packet */
40 type
= EXTRACT_U_1(sp
);
41 len
= EXTRACT_BE_U_2(sp
+ 1);
42 if (len
> 1500 || len
< 3 || type
== 0 || type
> MSDP_TYPE_MAX
)
43 goto trunc
; /* not really truncated, but still not decodable */
47 type
= EXTRACT_U_1(sp
);
48 len
= EXTRACT_BE_U_2(sp
+ 1);
49 if (len
> 1400 || ndo
->ndo_vflag
)
50 ND_PRINT(" [len %u]", len
);
56 case 1: /* IPv4 Source-Active */
57 case 3: /* IPv4 Source-Active Response */
61 ND_PRINT(" SA-Response");
63 ND_PRINT(" %u entries", EXTRACT_U_1(sp
));
64 if ((u_int
)((EXTRACT_U_1(sp
) * 12) + 8) < len
) {
65 ND_PRINT(" [w/data]");
66 if (ndo
->ndo_vflag
> 1) {
69 EXTRACT_U_1(sp
) * 12 + 8 - 3,
70 len
- (EXTRACT_U_1(sp
) * 12 + 8));
75 ND_PRINT(" SA-Request");
77 ND_PRINT(" for %s", ipaddr_string(ndo
, sp
+ 1));
80 ND_PRINT(" Keepalive");
82 ND_PRINT("[len=%d] ", len
);
85 ND_PRINT(" Notification");
88 ND_PRINT(" [type=%d len=%d]", type
, len
);
101 * c-style: whitesmith