]> The Tcpdump Group git mirrors - tcpdump/blob - print-pim.c
Use the new GET_ macros instead of the EXTRACT_ ones
[tcpdump] / print-pim.c
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
22 /* \summary: Protocol Independent Multicast (PIM) printer */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include "netdissect-stdinc.h"
29
30 #include "netdissect.h"
31 #include "addrtoname.h"
32 #include "extract.h"
33
34 #include "ip.h"
35 #include "ip6.h"
36 #include "ipproto.h"
37
38 #define PIMV1_TYPE_QUERY 0
39 #define PIMV1_TYPE_REGISTER 1
40 #define PIMV1_TYPE_REGISTER_STOP 2
41 #define PIMV1_TYPE_JOIN_PRUNE 3
42 #define PIMV1_TYPE_RP_REACHABILITY 4
43 #define PIMV1_TYPE_ASSERT 5
44 #define PIMV1_TYPE_GRAFT 6
45 #define PIMV1_TYPE_GRAFT_ACK 7
46
47 static const struct tok pimv1_type_str[] = {
48 { PIMV1_TYPE_QUERY, "Query" },
49 { PIMV1_TYPE_REGISTER, "Register" },
50 { PIMV1_TYPE_REGISTER_STOP, "Register-Stop" },
51 { PIMV1_TYPE_JOIN_PRUNE, "Join/Prune" },
52 { PIMV1_TYPE_RP_REACHABILITY, "RP-reachable" },
53 { PIMV1_TYPE_ASSERT, "Assert" },
54 { PIMV1_TYPE_GRAFT, "Graft" },
55 { PIMV1_TYPE_GRAFT_ACK, "Graft-ACK" },
56 { 0, NULL }
57 };
58
59 #define PIMV2_TYPE_HELLO 0
60 #define PIMV2_TYPE_REGISTER 1
61 #define PIMV2_TYPE_REGISTER_STOP 2
62 #define PIMV2_TYPE_JOIN_PRUNE 3
63 #define PIMV2_TYPE_BOOTSTRAP 4
64 #define PIMV2_TYPE_ASSERT 5
65 #define PIMV2_TYPE_GRAFT 6
66 #define PIMV2_TYPE_GRAFT_ACK 7
67 #define PIMV2_TYPE_CANDIDATE_RP 8
68 #define PIMV2_TYPE_PRUNE_REFRESH 9
69 #define PIMV2_TYPE_DF_ELECTION 10
70 #define PIMV2_TYPE_ECMP_REDIRECT 11
71
72 static const struct tok pimv2_type_values[] = {
73 { PIMV2_TYPE_HELLO, "Hello" },
74 { PIMV2_TYPE_REGISTER, "Register" },
75 { PIMV2_TYPE_REGISTER_STOP, "Register Stop" },
76 { PIMV2_TYPE_JOIN_PRUNE, "Join / Prune" },
77 { PIMV2_TYPE_BOOTSTRAP, "Bootstrap" },
78 { PIMV2_TYPE_ASSERT, "Assert" },
79 { PIMV2_TYPE_GRAFT, "Graft" },
80 { PIMV2_TYPE_GRAFT_ACK, "Graft Acknowledgement" },
81 { PIMV2_TYPE_CANDIDATE_RP, "Candidate RP Advertisement" },
82 { PIMV2_TYPE_PRUNE_REFRESH, "Prune Refresh" },
83 { PIMV2_TYPE_DF_ELECTION, "DF Election" },
84 { PIMV2_TYPE_ECMP_REDIRECT, "ECMP Redirect" },
85 { 0, NULL}
86 };
87
88 #define PIMV2_HELLO_OPTION_HOLDTIME 1
89 #define PIMV2_HELLO_OPTION_LANPRUNEDELAY 2
90 #define PIMV2_HELLO_OPTION_DR_PRIORITY_OLD 18
91 #define PIMV2_HELLO_OPTION_DR_PRIORITY 19
92 #define PIMV2_HELLO_OPTION_GENID 20
93 #define PIMV2_HELLO_OPTION_REFRESH_CAP 21
94 #define PIMV2_HELLO_OPTION_BIDIR_CAP 22
95 #define PIMV2_HELLO_OPTION_ADDRESS_LIST 24
96 #define PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD 65001
97
98 static const struct tok pimv2_hello_option_values[] = {
99 { PIMV2_HELLO_OPTION_HOLDTIME, "Hold Time" },
100 { PIMV2_HELLO_OPTION_LANPRUNEDELAY, "LAN Prune Delay" },
101 { PIMV2_HELLO_OPTION_DR_PRIORITY_OLD, "DR Priority (Old)" },
102 { PIMV2_HELLO_OPTION_DR_PRIORITY, "DR Priority" },
103 { PIMV2_HELLO_OPTION_GENID, "Generation ID" },
104 { PIMV2_HELLO_OPTION_REFRESH_CAP, "State Refresh Capability" },
105 { PIMV2_HELLO_OPTION_BIDIR_CAP, "Bi-Directional Capability" },
106 { PIMV2_HELLO_OPTION_ADDRESS_LIST, "Address List" },
107 { PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD, "Address List (Old)" },
108 { 0, NULL}
109 };
110
111 #define PIMV2_REGISTER_FLAG_LEN 4
112 #define PIMV2_REGISTER_FLAG_BORDER 0x80000000
113 #define PIMV2_REGISTER_FLAG_NULL 0x40000000
114
115 static const struct tok pimv2_register_flag_values[] = {
116 { PIMV2_REGISTER_FLAG_BORDER, "Border" },
117 { PIMV2_REGISTER_FLAG_NULL, "Null" },
118 { 0, NULL}
119 };
120
121 /*
122 * XXX: We consider a case where IPv6 is not ready yet for portability,
123 * but PIM dependent defintions should be independent of IPv6...
124 */
125
126 struct pim {
127 nd_uint8_t pim_typever;
128 /* upper 4bit: PIM version number; 2 for PIMv2 */
129 /* lower 4bit: the PIM message type, currently they are:
130 * Hello, Register, Register-Stop, Join/Prune,
131 * Bootstrap, Assert, Graft (PIM-DM only),
132 * Graft-Ack (PIM-DM only), C-RP-Adv
133 */
134 #define PIM_VER(x) (((x) & 0xf0) >> 4)
135 #define PIM_TYPE(x) ((x) & 0x0f)
136 nd_uint8_t pim_rsv; /* Reserved in v1, address length in v2 */
137 nd_uint16_t pim_cksum; /* IP style check sum */
138 };
139
140 static void pimv2_print(netdissect_options *, const u_char *bp, u_int len, const u_char *);
141
142 static void
143 pimv1_join_prune_print(netdissect_options *ndo,
144 const u_char *bp, u_int len)
145 {
146 u_int ngroups, njoin, nprune;
147 u_int njp;
148
149 /* If it's a single group and a single source, use 1-line output. */
150 if (ND_TTEST_LEN(bp, 30) && GET_U_1(bp + 11) == 1 &&
151 ((njoin = GET_BE_U_2(bp + 20)) + GET_BE_U_2(bp + 22)) == 1) {
152 u_int hold;
153
154 ND_PRINT(" RPF %s ", ipaddr_string(ndo, bp));
155 hold = GET_BE_U_2(bp + 6);
156 if (hold != 180) {
157 ND_PRINT("Hold ");
158 unsigned_relts_print(ndo, hold);
159 }
160 ND_PRINT("%s (%s/%u, %s", njoin ? "Join" : "Prune",
161 ipaddr_string(ndo, bp + 26), GET_U_1(bp + 25) & 0x3f,
162 ipaddr_string(ndo, bp + 12));
163 if (GET_BE_U_4(bp + 16) != 0xffffffff)
164 ND_PRINT("/%s", ipaddr_string(ndo, bp + 16));
165 ND_PRINT(") %s%s %s",
166 (GET_U_1(bp + 24) & 0x01) ? "Sparse" : "Dense",
167 (GET_U_1(bp + 25) & 0x80) ? " WC" : "",
168 (GET_U_1(bp + 25) & 0x40) ? "RP" : "SPT");
169 return;
170 }
171
172 if (len < sizeof(nd_ipv4))
173 goto trunc;
174 ND_TCHECK_LEN(bp, sizeof(nd_ipv4));
175 if (ndo->ndo_vflag > 1)
176 ND_PRINT("\n");
177 ND_PRINT(" Upstream Nbr: %s", ipaddr_string(ndo, bp));
178 bp += 4;
179 len -= 4;
180 if (len < 4)
181 goto trunc;
182 ND_TCHECK_2(bp + 2);
183 if (ndo->ndo_vflag > 1)
184 ND_PRINT("\n");
185 ND_PRINT(" Hold time: ");
186 unsigned_relts_print(ndo, GET_BE_U_2(bp + 2));
187 if (ndo->ndo_vflag < 2)
188 return;
189 bp += 4;
190 len -= 4;
191
192 if (len < 4)
193 goto trunc;
194 ND_TCHECK_4(bp);
195 ngroups = GET_U_1(bp + 3);
196 bp += 4;
197 len -= 4;
198 while (ngroups != 0) {
199 /*
200 * XXX - does the address have length "addrlen" and the
201 * mask length "maddrlen"?
202 */
203 if (len < 4)
204 goto trunc;
205 ND_TCHECK_LEN(bp, sizeof(nd_ipv4));
206 ND_PRINT("\n\tGroup: %s", ipaddr_string(ndo, bp));
207 bp += 4;
208 len -= 4;
209 if (len < 4)
210 goto trunc;
211 ND_TCHECK_LEN(bp, sizeof(nd_ipv4));
212 if (GET_BE_U_4(bp) != 0xffffffff)
213 ND_PRINT("/%s", ipaddr_string(ndo, bp));
214 bp += 4;
215 len -= 4;
216 if (len < 4)
217 goto trunc;
218 ND_TCHECK_4(bp);
219 njoin = GET_BE_U_2(bp);
220 nprune = GET_BE_U_2(bp + 2);
221 ND_PRINT(" joined: %u pruned: %u", njoin, nprune);
222 bp += 4;
223 len -= 4;
224 for (njp = 0; njp < (njoin + nprune); njp++) {
225 const char *type;
226
227 if (njp < njoin)
228 type = "Join ";
229 else
230 type = "Prune";
231 if (len < 6)
232 goto trunc;
233 ND_TCHECK_6(bp);
234 ND_PRINT("\n\t%s %s%s%s%s/%u", type,
235 (GET_U_1(bp) & 0x01) ? "Sparse " : "Dense ",
236 (GET_U_1(bp + 1) & 0x80) ? "WC " : "",
237 (GET_U_1(bp + 1) & 0x40) ? "RP " : "SPT ",
238 ipaddr_string(ndo, bp + 2),
239 GET_U_1(bp + 1) & 0x3f);
240 bp += 6;
241 len -= 6;
242 }
243 ngroups--;
244 }
245 return;
246 trunc:
247 nd_print_trunc(ndo);
248 return;
249 }
250
251 void
252 pimv1_print(netdissect_options *ndo,
253 const u_char *bp, u_int len)
254 {
255 u_char type;
256
257 ndo->ndo_protocol = "pimv1";
258 ND_TCHECK_1(bp + 1);
259 type = GET_U_1(bp + 1);
260
261 ND_PRINT(" %s", tok2str(pimv1_type_str, "[type %u]", type));
262 switch (type) {
263 case PIMV1_TYPE_QUERY:
264 if (ND_TTEST_1(bp + 8)) {
265 switch (GET_U_1(bp + 8) >> 4) {
266 case 0:
267 ND_PRINT(" Dense-mode");
268 break;
269 case 1:
270 ND_PRINT(" Sparse-mode");
271 break;
272 case 2:
273 ND_PRINT(" Sparse-Dense-mode");
274 break;
275 default:
276 ND_PRINT(" mode-%u", GET_U_1(bp + 8) >> 4);
277 break;
278 }
279 }
280 if (ndo->ndo_vflag) {
281 ND_TCHECK_2(bp + 10);
282 ND_PRINT(" (Hold-time ");
283 unsigned_relts_print(ndo, GET_BE_U_2(bp + 10));
284 ND_PRINT(")");
285 }
286 break;
287
288 case PIMV1_TYPE_REGISTER:
289 ND_TCHECK_LEN(bp + 8, 20); /* ip header */
290 ND_PRINT(" for %s > %s", ipaddr_string(ndo, bp + 20),
291 ipaddr_string(ndo, bp + 24));
292 break;
293 case PIMV1_TYPE_REGISTER_STOP:
294 ND_TCHECK_LEN(bp + 12, sizeof(nd_ipv4));
295 ND_PRINT(" for %s > %s", ipaddr_string(ndo, bp + 8),
296 ipaddr_string(ndo, bp + 12));
297 break;
298 case PIMV1_TYPE_RP_REACHABILITY:
299 if (ndo->ndo_vflag) {
300 ND_TCHECK_2(bp + 22);
301 ND_PRINT(" group %s", ipaddr_string(ndo, bp + 8));
302 if (GET_BE_U_4(bp + 12) != 0xffffffff)
303 ND_PRINT("/%s", ipaddr_string(ndo, bp + 12));
304 ND_PRINT(" RP %s hold ", ipaddr_string(ndo, bp + 16));
305 unsigned_relts_print(ndo, GET_BE_U_2(bp + 22));
306 }
307 break;
308 case PIMV1_TYPE_ASSERT:
309 ND_TCHECK_LEN(bp + 16, sizeof(nd_ipv4));
310 ND_PRINT(" for %s > %s", ipaddr_string(ndo, bp + 16),
311 ipaddr_string(ndo, bp + 8));
312 if (GET_BE_U_4(bp + 12) != 0xffffffff)
313 ND_PRINT("/%s", ipaddr_string(ndo, bp + 12));
314 ND_TCHECK_4(bp + 24);
315 ND_PRINT(" %s pref %u metric %u",
316 (GET_U_1(bp + 20) & 0x80) ? "RP-tree" : "SPT",
317 GET_BE_U_4(bp + 20) & 0x7fffffff,
318 GET_BE_U_4(bp + 24));
319 break;
320 case PIMV1_TYPE_JOIN_PRUNE:
321 case PIMV1_TYPE_GRAFT:
322 case PIMV1_TYPE_GRAFT_ACK:
323 if (ndo->ndo_vflag) {
324 if (len < 8)
325 goto trunc;
326 pimv1_join_prune_print(ndo, bp + 8, len - 8);
327 }
328 break;
329 }
330 ND_TCHECK_1(bp + 4);
331 if ((GET_U_1(bp + 4) >> 4) != 1)
332 ND_PRINT(" [v%u]", GET_U_1(bp + 4) >> 4);
333 return;
334
335 trunc:
336 nd_print_trunc(ndo);
337 return;
338 }
339
340 /*
341 * auto-RP is a cisco protocol, documented at
342 * ftp://ftpeng.cisco.com/ipmulticast/specs/pim-autorp-spec01.txt
343 *
344 * This implements version 1+, dated Sept 9, 1998.
345 */
346 void
347 cisco_autorp_print(netdissect_options *ndo,
348 const u_char *bp, u_int len)
349 {
350 u_int type;
351 u_int numrps;
352 u_int hold;
353
354 ndo->ndo_protocol = "cisco_autorp";
355 if (len < 8)
356 goto trunc;
357 ND_TCHECK_1(bp);
358 ND_PRINT(" auto-rp ");
359 type = GET_U_1(bp);
360 switch (type) {
361 case 0x11:
362 ND_PRINT("candidate-advert");
363 break;
364 case 0x12:
365 ND_PRINT("mapping");
366 break;
367 default:
368 ND_PRINT("type-0x%02x", type);
369 break;
370 }
371
372 ND_TCHECK_1(bp + 1);
373 numrps = GET_U_1(bp + 1);
374
375 ND_TCHECK_2(bp + 2);
376 ND_PRINT(" Hold ");
377 hold = GET_BE_U_2(bp + 2);
378 if (hold)
379 unsigned_relts_print(ndo, GET_BE_U_2(bp + 2));
380 else
381 ND_PRINT("FOREVER");
382
383 /* Next 4 bytes are reserved. */
384
385 bp += 8; len -= 8;
386
387 /*XXX skip unless -v? */
388
389 /*
390 * Rest of packet:
391 * numrps entries of the form:
392 * 32 bits: RP
393 * 6 bits: reserved
394 * 2 bits: PIM version supported, bit 0 is "supports v1", 1 is "v2".
395 * 8 bits: # of entries for this RP
396 * each entry: 7 bits: reserved, 1 bit: negative,
397 * 8 bits: mask 32 bits: source
398 * lather, rinse, repeat.
399 */
400 while (numrps != 0) {
401 u_int nentries;
402 char s;
403
404 if (len < 4)
405 goto trunc;
406 ND_TCHECK_4(bp);
407 ND_PRINT(" RP %s", ipaddr_string(ndo, bp));
408 bp += 4;
409 len -= 4;
410 if (len < 1)
411 goto trunc;
412 ND_TCHECK_1(bp);
413 switch (GET_U_1(bp) & 0x3) {
414 case 0: ND_PRINT(" PIMv?");
415 break;
416 case 1: ND_PRINT(" PIMv1");
417 break;
418 case 2: ND_PRINT(" PIMv2");
419 break;
420 case 3: ND_PRINT(" PIMv1+2");
421 break;
422 }
423 if (GET_U_1(bp) & 0xfc)
424 ND_PRINT(" [rsvd=0x%02x]", GET_U_1(bp) & 0xfc);
425 bp += 1;
426 len -= 1;
427 if (len < 1)
428 goto trunc;
429 ND_TCHECK_1(bp);
430 nentries = GET_U_1(bp);
431 bp += 1;
432 len -= 1;
433 s = ' ';
434 while (nentries != 0) {
435 if (len < 6)
436 goto trunc;
437 ND_TCHECK_6(bp);
438 ND_PRINT("%c%s%s/%u", s, GET_U_1(bp) & 1 ? "!" : "",
439 ipaddr_string(ndo, bp + 2), GET_U_1(bp + 1));
440 if (GET_U_1(bp) & 0x02) {
441 ND_PRINT(" bidir");
442 }
443 if (GET_U_1(bp) & 0xfc) {
444 ND_PRINT("[rsvd=0x%02x]", GET_U_1(bp) & 0xfc);
445 }
446 s = ',';
447 bp += 6; len -= 6;
448 nentries--;
449 }
450 numrps--;
451 }
452 return;
453
454 trunc:
455 nd_print_trunc(ndo);
456 return;
457 }
458
459 void
460 pim_print(netdissect_options *ndo,
461 const u_char *bp, u_int len, const u_char *bp2)
462 {
463 const struct pim *pim = (const struct pim *)bp;
464 uint8_t pim_typever;
465
466 ndo->ndo_protocol = "pim";
467 #ifdef notyet /* currently we see only version and type */
468 ND_TCHECK_1(pim->pim_rsv);
469 #endif
470
471 ND_TCHECK_1(pim->pim_typever);
472 pim_typever = GET_U_1(pim->pim_typever);
473 switch (PIM_VER(pim_typever)) {
474 case 2:
475 if (!ndo->ndo_vflag) {
476 ND_PRINT("PIMv%u, %s, length %u",
477 PIM_VER(pim_typever),
478 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim_typever)),
479 len);
480 return;
481 } else {
482 ND_PRINT("PIMv%u, length %u\n\t%s",
483 PIM_VER(pim_typever),
484 len,
485 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim_typever)));
486 pimv2_print(ndo, bp, len, bp2);
487 }
488 break;
489 default:
490 ND_PRINT("PIMv%u, length %u",
491 PIM_VER(pim_typever),
492 len);
493 break;
494 }
495 return;
496
497 trunc:
498 nd_print_trunc(ndo);
499 return;
500 }
501
502 /*
503 * PIMv2 uses encoded address representations.
504 *
505 * The last PIM-SM I-D before RFC2117 was published specified the
506 * following representation for unicast addresses. However, RFC2117
507 * specified no encoding for unicast addresses with the unicast
508 * address length specified in the header. Therefore, we have to
509 * guess which encoding is being used (Cisco's PIMv2 implementation
510 * uses the non-RFC encoding). RFC2117 turns a previously "Reserved"
511 * field into a 'unicast-address-length-in-bytes' field. We guess
512 * that it's the draft encoding if this reserved field is zero.
513 *
514 * RFC2362 goes back to the encoded format, and calls the addr length
515 * field "reserved" again.
516 *
517 * The first byte is the address family, from:
518 *
519 * 0 Reserved
520 * 1 IP (IP version 4)
521 * 2 IP6 (IP version 6)
522 * 3 NSAP
523 * 4 HDLC (8-bit multidrop)
524 * 5 BBN 1822
525 * 6 802 (includes all 802 media plus Ethernet "canonical format")
526 * 7 E.163
527 * 8 E.164 (SMDS, Frame Relay, ATM)
528 * 9 F.69 (Telex)
529 * 10 X.121 (X.25, Frame Relay)
530 * 11 IPX
531 * 12 Appletalk
532 * 13 Decnet IV
533 * 14 Banyan Vines
534 * 15 E.164 with NSAP format subaddress
535 *
536 * In addition, the second byte is an "Encoding". 0 is the default
537 * encoding for the address family, and no other encodings are currently
538 * specified.
539 *
540 */
541
542 enum pimv2_addrtype {
543 pimv2_unicast, pimv2_group, pimv2_source
544 };
545
546 /* 0 1 2 3
547 * 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
548 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
549 * | Addr Family | Encoding Type | Unicast Address |
550 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+++++++
551 * 0 1 2 3
552 * 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
553 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
554 * | Addr Family | Encoding Type | Reserved | Mask Len |
555 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
556 * | Group multicast Address |
557 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
558 * 0 1 2 3
559 * 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
560 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
561 * | Addr Family | Encoding Type | Rsrvd |S|W|R| Mask Len |
562 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
563 * | Source Address |
564 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
565 */
566 static int
567 pimv2_addr_print(netdissect_options *ndo,
568 const u_char *bp, u_int len, enum pimv2_addrtype at,
569 u_int addr_len, int silent)
570 {
571 u_int af;
572 int hdrlen;
573
574 if (addr_len == 0) {
575 if (len < 2)
576 goto trunc;
577 ND_TCHECK_1(bp + 1);
578 switch (GET_U_1(bp)) {
579 case 1:
580 af = AF_INET;
581 addr_len = (u_int)sizeof(nd_ipv4);
582 break;
583 case 2:
584 af = AF_INET6;
585 addr_len = (u_int)sizeof(nd_ipv6);
586 break;
587 default:
588 return -1;
589 }
590 if (GET_U_1(bp + 1) != 0)
591 return -1;
592 hdrlen = 2;
593 } else {
594 switch (addr_len) {
595 case sizeof(nd_ipv4):
596 af = AF_INET;
597 break;
598 case sizeof(nd_ipv6):
599 af = AF_INET6;
600 break;
601 default:
602 return -1;
603 break;
604 }
605 hdrlen = 0;
606 }
607
608 bp += hdrlen;
609 len -= hdrlen;
610 switch (at) {
611 case pimv2_unicast:
612 if (len < addr_len)
613 goto trunc;
614 ND_TCHECK_LEN(bp, addr_len);
615 if (af == AF_INET) {
616 if (!silent)
617 ND_PRINT("%s", ipaddr_string(ndo, bp));
618 }
619 else if (af == AF_INET6) {
620 if (!silent)
621 ND_PRINT("%s", ip6addr_string(ndo, bp));
622 }
623 return hdrlen + addr_len;
624 case pimv2_group:
625 case pimv2_source:
626 if (len < addr_len + 2)
627 goto trunc;
628 ND_TCHECK_LEN(bp, addr_len + 2);
629 if (af == AF_INET) {
630 if (!silent) {
631 ND_PRINT("%s", ipaddr_string(ndo, bp + 2));
632 if (GET_U_1(bp + 1) != 32)
633 ND_PRINT("/%u", GET_U_1(bp + 1));
634 }
635 }
636 else if (af == AF_INET6) {
637 if (!silent) {
638 ND_PRINT("%s", ip6addr_string(ndo, bp + 2));
639 if (GET_U_1(bp + 1) != 128)
640 ND_PRINT("/%u", GET_U_1(bp + 1));
641 }
642 }
643 if (GET_U_1(bp) && !silent) {
644 if (at == pimv2_group) {
645 ND_PRINT("(0x%02x)", GET_U_1(bp));
646 } else {
647 ND_PRINT("(%s%s%s",
648 GET_U_1(bp) & 0x04 ? "S" : "",
649 GET_U_1(bp) & 0x02 ? "W" : "",
650 GET_U_1(bp) & 0x01 ? "R" : "");
651 if (GET_U_1(bp) & 0xf8) {
652 ND_PRINT("+0x%02x",
653 GET_U_1(bp) & 0xf8);
654 }
655 ND_PRINT(")");
656 }
657 }
658 return hdrlen + 2 + addr_len;
659 default:
660 return -1;
661 }
662 trunc:
663 return -1;
664 }
665
666 enum checksum_status {
667 CORRECT,
668 INCORRECT,
669 UNVERIFIED
670 };
671
672 static enum checksum_status
673 pimv2_check_checksum(netdissect_options *ndo, const u_char *bp,
674 const u_char *bp2, u_int len)
675 {
676 const struct ip *ip;
677 u_int cksum;
678
679 if (!ND_TTEST_LEN(bp, len)) {
680 /* We don't have all the data. */
681 return (UNVERIFIED);
682 }
683 ip = (const struct ip *)bp2;
684 if (IP_V(ip) == 4) {
685 struct cksum_vec vec[1];
686
687 vec[0].ptr = bp;
688 vec[0].len = len;
689 cksum = in_cksum(vec, 1);
690 return (cksum ? INCORRECT : CORRECT);
691 } else if (IP_V(ip) == 6) {
692 const struct ip6_hdr *ip6;
693
694 ip6 = (const struct ip6_hdr *)bp2;
695 cksum = nextproto6_cksum(ndo, ip6, bp, len, len, IPPROTO_PIM);
696 return (cksum ? INCORRECT : CORRECT);
697 } else {
698 return (UNVERIFIED);
699 }
700 }
701
702 static void
703 pimv2_print(netdissect_options *ndo,
704 const u_char *bp, u_int len, const u_char *bp2)
705 {
706 const struct pim *pim = (const struct pim *)bp;
707 int advance;
708 enum checksum_status cksum_status;
709 u_int pim_typever;
710 u_int pimv2_addr_len;
711
712 ndo->ndo_protocol = "pimv2";
713 if (len < 2)
714 goto trunc;
715 ND_TCHECK_1(pim->pim_rsv);
716 pim_typever = GET_U_1(pim->pim_typever);
717 pimv2_addr_len = GET_U_1(pim->pim_rsv);
718 if (pimv2_addr_len != 0)
719 ND_PRINT(", RFC2117-encoding");
720
721 if (len < 4)
722 goto trunc;
723 ND_TCHECK_2(pim->pim_cksum);
724 ND_PRINT(", cksum 0x%04x ", GET_BE_U_2(pim->pim_cksum));
725 if (GET_BE_U_2(pim->pim_cksum) == 0) {
726 ND_PRINT("(unverified)");
727 } else {
728 if (PIM_TYPE(pim_typever) == PIMV2_TYPE_REGISTER) {
729 /*
730 * The checksum only covers the packet header,
731 * not the encapsulated packet.
732 */
733 cksum_status = pimv2_check_checksum(ndo, bp, bp2, 8);
734 if (cksum_status == INCORRECT) {
735 /*
736 * To quote RFC 4601, "For interoperability
737 * reasons, a message carrying a checksum
738 * calculated over the entire PIM Register
739 * message should also be accepted."
740 */
741 cksum_status = pimv2_check_checksum(ndo, bp, bp2, len);
742 }
743 } else {
744 /*
745 * The checksum covers the entire packet.
746 */
747 cksum_status = pimv2_check_checksum(ndo, bp, bp2, len);
748 }
749 switch (cksum_status) {
750
751 case CORRECT:
752 ND_PRINT("(correct)");
753 break;
754
755 case INCORRECT:
756 ND_PRINT("(incorrect)");
757 break;
758
759 case UNVERIFIED:
760 ND_PRINT("(unverified)");
761 break;
762 }
763 }
764 bp += 4;
765 len -= 4;
766
767 switch (PIM_TYPE(pim_typever)) {
768 case PIMV2_TYPE_HELLO:
769 {
770 uint16_t otype, olen;
771 while (len > 0) {
772 if (len < 4)
773 goto trunc;
774 ND_TCHECK_4(bp);
775 otype = GET_BE_U_2(bp);
776 olen = GET_BE_U_2(bp + 2);
777 ND_PRINT("\n\t %s Option (%u), length %u, Value: ",
778 tok2str(pimv2_hello_option_values, "Unknown", otype),
779 otype,
780 olen);
781 bp += 4;
782 len -= 4;
783
784 if (len < olen)
785 goto trunc;
786 ND_TCHECK_LEN(bp, olen);
787 switch (otype) {
788 case PIMV2_HELLO_OPTION_HOLDTIME:
789 if (olen != 2) {
790 ND_PRINT("ERROR: Option Length != 2 Bytes (%u)", olen);
791 } else {
792 unsigned_relts_print(ndo,
793 GET_BE_U_2(bp));
794 }
795 break;
796
797 case PIMV2_HELLO_OPTION_LANPRUNEDELAY:
798 if (olen != 4) {
799 ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen);
800 } else {
801 char t_bit;
802 uint16_t lan_delay, override_interval;
803 lan_delay = GET_BE_U_2(bp);
804 override_interval = GET_BE_U_2(bp + 2);
805 t_bit = (lan_delay & 0x8000)? 1 : 0;
806 lan_delay &= ~0x8000;
807 ND_PRINT("\n\t T-bit=%u, LAN delay %ums, Override interval %ums",
808 t_bit, lan_delay, override_interval);
809 }
810 break;
811
812 case PIMV2_HELLO_OPTION_DR_PRIORITY_OLD:
813 case PIMV2_HELLO_OPTION_DR_PRIORITY:
814 switch (olen) {
815 case 0:
816 ND_PRINT("Bi-Directional Capability (Old)");
817 break;
818 case 4:
819 ND_PRINT("%u", GET_BE_U_4(bp));
820 break;
821 default:
822 ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen);
823 break;
824 }
825 break;
826
827 case PIMV2_HELLO_OPTION_GENID:
828 if (olen != 4) {
829 ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen);
830 } else {
831 ND_PRINT("0x%08x", GET_BE_U_4(bp));
832 }
833 break;
834
835 case PIMV2_HELLO_OPTION_REFRESH_CAP:
836 if (olen != 4) {
837 ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen);
838 } else {
839 ND_PRINT("v%u", GET_U_1(bp));
840 if (GET_U_1(bp + 1) != 0) {
841 ND_PRINT(", interval ");
842 unsigned_relts_print(ndo,
843 GET_U_1(bp + 1));
844 }
845 if (GET_BE_U_2(bp + 2) != 0) {
846 ND_PRINT(" ?0x%04x?",
847 GET_BE_U_2(bp + 2));
848 }
849 }
850 break;
851
852 case PIMV2_HELLO_OPTION_BIDIR_CAP:
853 break;
854
855 case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD:
856 case PIMV2_HELLO_OPTION_ADDRESS_LIST:
857 if (ndo->ndo_vflag > 1) {
858 const u_char *ptr = bp;
859 u_int plen = len;
860 while (ptr < (bp+olen)) {
861 ND_PRINT("\n\t ");
862 advance = pimv2_addr_print(ndo, ptr, plen, pimv2_unicast, pimv2_addr_len, 0);
863 if (advance < 0)
864 goto trunc;
865 ptr += advance;
866 plen -= advance;
867 }
868 }
869 break;
870 default:
871 if (ndo->ndo_vflag <= 1)
872 print_unknown_data(ndo, bp, "\n\t ", olen);
873 break;
874 }
875 /* do we want to see an additionally hexdump ? */
876 if (ndo->ndo_vflag> 1)
877 print_unknown_data(ndo, bp, "\n\t ", olen);
878 bp += olen;
879 len -= olen;
880 }
881 break;
882 }
883
884 case PIMV2_TYPE_REGISTER:
885 {
886 const struct ip *ip;
887
888 if (len < 4)
889 goto trunc;
890 ND_TCHECK_LEN(bp, PIMV2_REGISTER_FLAG_LEN);
891
892 ND_PRINT(", Flags [ %s ]\n\t",
893 tok2str(pimv2_register_flag_values,
894 "none",
895 GET_BE_U_4(bp)));
896
897 bp += 4; len -= 4;
898 /* encapsulated multicast packet */
899 if (len == 0)
900 goto trunc;
901 ip = (const struct ip *)bp;
902 ND_TCHECK_1(ip->ip_vhl);
903 switch (IP_V(ip)) {
904 case 0: /* Null header */
905 ND_TCHECK_4(ip->ip_dst);
906 ND_PRINT("IP-Null-header %s > %s",
907 ipaddr_string(ndo, ip->ip_src),
908 ipaddr_string(ndo, ip->ip_dst));
909 break;
910
911 case 4: /* IPv4 */
912 ip_print(ndo, bp, len);
913 break;
914
915 case 6: /* IPv6 */
916 ip6_print(ndo, bp, len);
917 break;
918
919 default:
920 ND_PRINT("IP ver %u", IP_V(ip));
921 break;
922 }
923 break;
924 }
925
926 case PIMV2_TYPE_REGISTER_STOP:
927 ND_PRINT(" group=");
928 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
929 goto trunc;
930 bp += advance; len -= advance;
931 ND_PRINT(" source=");
932 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
933 goto trunc;
934 bp += advance; len -= advance;
935 break;
936
937 case PIMV2_TYPE_JOIN_PRUNE:
938 case PIMV2_TYPE_GRAFT:
939 case PIMV2_TYPE_GRAFT_ACK:
940
941
942 /*
943 * 0 1 2 3
944 * 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
945 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
946 * |PIM Ver| Type | Addr length | Checksum |
947 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
948 * | Unicast-Upstream Neighbor Address |
949 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
950 * | Reserved | Num groups | Holdtime |
951 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
952 * | Encoded-Multicast Group Address-1 |
953 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
954 * | Number of Joined Sources | Number of Pruned Sources |
955 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
956 * | Encoded-Joined Source Address-1 |
957 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
958 * | . |
959 * | . |
960 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
961 * | Encoded-Joined Source Address-n |
962 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
963 * | Encoded-Pruned Source Address-1 |
964 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
965 * | . |
966 * | . |
967 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
968 * | Encoded-Pruned Source Address-n |
969 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
970 * | . |
971 * | . |
972 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
973 * | Encoded-Multicast Group Address-n |
974 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
975 */
976
977 {
978 uint8_t ngroup;
979 uint16_t holdtime;
980 uint16_t njoin;
981 uint16_t nprune;
982 u_int i, j;
983
984 if (PIM_TYPE(pim_typever) != 7) { /*not for Graft-ACK*/
985 ND_PRINT(", upstream-neighbor: ");
986 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
987 goto trunc;
988 bp += advance; len -= advance;
989 }
990 if (len < 4)
991 goto trunc;
992 ND_TCHECK_4(bp);
993 ngroup = GET_U_1(bp + 1);
994 holdtime = GET_BE_U_2(bp + 2);
995 ND_PRINT("\n\t %u group(s)", ngroup);
996 if (PIM_TYPE(pim_typever) != 7) { /*not for Graft-ACK*/
997 ND_PRINT(", holdtime: ");
998 if (holdtime == 0xffff)
999 ND_PRINT("infinite");
1000 else
1001 unsigned_relts_print(ndo, holdtime);
1002 }
1003 bp += 4; len -= 4;
1004 for (i = 0; i < ngroup; i++) {
1005 ND_PRINT("\n\t group #%u: ", i+1);
1006 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
1007 goto trunc;
1008 bp += advance; len -= advance;
1009 if (len < 4)
1010 goto trunc;
1011 ND_TCHECK_4(bp);
1012 njoin = GET_BE_U_2(bp);
1013 nprune = GET_BE_U_2(bp + 2);
1014 ND_PRINT(", joined sources: %u, pruned sources: %u", njoin, nprune);
1015 bp += 4; len -= 4;
1016 for (j = 0; j < njoin; j++) {
1017 ND_PRINT("\n\t joined source #%u: ", j+1);
1018 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_source, pimv2_addr_len, 0)) < 0)
1019 goto trunc;
1020 bp += advance; len -= advance;
1021 }
1022 for (j = 0; j < nprune; j++) {
1023 ND_PRINT("\n\t pruned source #%u: ", j+1);
1024 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_source, pimv2_addr_len, 0)) < 0)
1025 goto trunc;
1026 bp += advance; len -= advance;
1027 }
1028 }
1029 break;
1030 }
1031
1032 case PIMV2_TYPE_BOOTSTRAP:
1033 {
1034 u_int i, j, frpcnt;
1035
1036 /* Fragment Tag, Hash Mask len, and BSR-priority */
1037 if (len < 2)
1038 goto trunc;
1039 ND_TCHECK_2(bp);
1040 ND_PRINT(" tag=%x", GET_BE_U_2(bp));
1041 bp += 2;
1042 len -= 2;
1043 if (len < 1)
1044 goto trunc;
1045 ND_TCHECK_1(bp);
1046 ND_PRINT(" hashmlen=%u", GET_U_1(bp));
1047 if (len < 2)
1048 goto trunc;
1049 ND_TCHECK_1(bp + 2);
1050 ND_PRINT(" BSRprio=%u", GET_U_1(bp + 1));
1051 bp += 2;
1052 len -= 2;
1053
1054 /* Encoded-Unicast-BSR-Address */
1055 ND_PRINT(" BSR=");
1056 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
1057 goto trunc;
1058 bp += advance;
1059 len -= advance;
1060
1061 for (i = 0; len > 0; i++) {
1062 /* Encoded-Group Address */
1063 ND_PRINT(" (group%u: ", i);
1064 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
1065 goto trunc;
1066 bp += advance;
1067 len -= advance;
1068
1069 /* RP-Count, Frag RP-Cnt, and rsvd */
1070 if (len < 1)
1071 goto trunc;
1072 ND_TCHECK_1(bp);
1073 ND_PRINT(" RPcnt=%u", GET_U_1(bp));
1074 if (len < 2)
1075 goto trunc;
1076 ND_TCHECK_1(bp + 1);
1077 frpcnt = GET_U_1(bp + 1);
1078 ND_PRINT(" FRPcnt=%u", frpcnt);
1079 if (len < 4)
1080 goto trunc;
1081 bp += 4;
1082 len -= 4;
1083
1084 for (j = 0; j < frpcnt && len > 0; j++) {
1085 /* each RP info */
1086 ND_PRINT(" RP%u=", j);
1087 if ((advance = pimv2_addr_print(ndo, bp, len,
1088 pimv2_unicast,
1089 pimv2_addr_len,
1090 0)) < 0)
1091 goto trunc;
1092 bp += advance;
1093 len -= advance;
1094
1095 if (len < 2)
1096 goto trunc;
1097 ND_TCHECK_2(bp);
1098 ND_PRINT(",holdtime=");
1099 unsigned_relts_print(ndo,
1100 GET_BE_U_2(bp));
1101 if (len < 3)
1102 goto trunc;
1103 ND_TCHECK_1(bp + 2);
1104 ND_PRINT(",prio=%u", GET_U_1(bp + 2));
1105 if (len < 4)
1106 goto trunc;
1107 bp += 4;
1108 len -= 4;
1109 }
1110 ND_PRINT(")");
1111 }
1112 break;
1113 }
1114 case PIMV2_TYPE_ASSERT:
1115 ND_PRINT(" group=");
1116 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
1117 goto trunc;
1118 bp += advance; len -= advance;
1119 ND_PRINT(" src=");
1120 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
1121 goto trunc;
1122 bp += advance; len -= advance;
1123 if (len < 8)
1124 goto trunc;
1125 ND_TCHECK_8(bp);
1126 if (GET_U_1(bp) & 0x80)
1127 ND_PRINT(" RPT");
1128 ND_PRINT(" pref=%u", GET_BE_U_4(bp) & 0x7fffffff);
1129 ND_PRINT(" metric=%u", GET_BE_U_4(bp + 4));
1130 break;
1131
1132 case PIMV2_TYPE_CANDIDATE_RP:
1133 {
1134 u_int i, pfxcnt;
1135
1136 /* Prefix-Cnt, Priority, and Holdtime */
1137 if (len < 1)
1138 goto trunc;
1139 ND_TCHECK_1(bp);
1140 ND_PRINT(" prefix-cnt=%u", GET_U_1(bp));
1141 pfxcnt = GET_U_1(bp);
1142 if (len < 2)
1143 goto trunc;
1144 ND_TCHECK_1(bp + 1);
1145 ND_PRINT(" prio=%u", GET_U_1(bp + 1));
1146 if (len < 4)
1147 goto trunc;
1148 ND_TCHECK_2(bp + 2);
1149 ND_PRINT(" holdtime=");
1150 unsigned_relts_print(ndo, GET_BE_U_2(bp + 2));
1151 bp += 4;
1152 len -= 4;
1153
1154 /* Encoded-Unicast-RP-Address */
1155 ND_PRINT(" RP=");
1156 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
1157 goto trunc;
1158 bp += advance;
1159 len -= advance;
1160
1161 /* Encoded-Group Addresses */
1162 for (i = 0; i < pfxcnt && len > 0; i++) {
1163 ND_PRINT(" Group%u=", i);
1164 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
1165 goto trunc;
1166 bp += advance;
1167 len -= advance;
1168 }
1169 break;
1170 }
1171
1172 case PIMV2_TYPE_PRUNE_REFRESH:
1173 ND_PRINT(" src=");
1174 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
1175 goto trunc;
1176 bp += advance;
1177 len -= advance;
1178 ND_PRINT(" grp=");
1179 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_group, pimv2_addr_len, 0)) < 0)
1180 goto trunc;
1181 bp += advance;
1182 len -= advance;
1183 ND_PRINT(" forwarder=");
1184 if ((advance = pimv2_addr_print(ndo, bp, len, pimv2_unicast, pimv2_addr_len, 0)) < 0)
1185 goto trunc;
1186 bp += advance;
1187 len -= advance;
1188 if (len < 2)
1189 goto trunc;
1190 ND_TCHECK_2(bp);
1191 ND_PRINT(" TUNR ");
1192 unsigned_relts_print(ndo, GET_BE_U_2(bp));
1193 break;
1194
1195
1196 default:
1197 ND_PRINT(" [type %u]", PIM_TYPE(pim_typever));
1198 break;
1199 }
1200
1201 return;
1202
1203 trunc:
1204 nd_print_trunc(ndo);
1205 }