2 * Routines for PIM disassembly
3 * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/ipproto.h>
33 #include <epan/prefs.h>
34 #include <epan/in_cksum.h>
35 #include <epan/wmem/wmem.h>
36 #include "packet-pim.h"
38 #define PIM_TYPE(x) ((x) & 0x0f)
39 #define PIM_VER(x) (((x) & 0xf0) >> 4)
42 pimv2_unicast
, pimv2_group
, pimv2_source
45 static int proto_pim
= -1;
46 static int hf_pim_version
= -1;
47 static int hf_pim_type
= -1;
48 static int hf_pim_code
= -1;
49 static int hf_pim_cksum
= -1;
50 static int hf_pim_res_bytes
= -1;
51 /* PIM Hello options (RFC 4601, section 4.9.2 and RFC 3973, section 4.7.5) */
52 static int hf_pim_optiontype
= -1;
53 static int hf_pim_optionlength
= -1;
54 static int hf_pim_optionvalue
= -1;
55 static int hf_pim_register_flag
= -1;
56 static int hf_pim_register_flag_border
= -1;
57 static int hf_pim_register_flag_null_register
= -1;
58 static int hf_pim_mode
= -1;
59 static int hf_pim_holdtime
= -1;
60 static int hf_pim_numgroups
= -1;
61 static int hf_pim_numjoins
= -1;
62 static int hf_pim_numprunes
= -1;
63 static int hf_pim_t
= -1;
64 static int hf_pim_propagation_delay
= -1;
65 static int hf_pim_override_interval
= -1;
66 static int hf_pim_dr_priority
= -1;
67 static int hf_pim_generation_id
= -1;
68 static int hf_pim_state_refresh_version
= -1;
69 static int hf_pim_state_refresh_interval
= -1;
70 static int hf_pim_state_refresh_reserved
= -1;
72 static int hf_pim_rpt
= -1;
73 static int hf_pim_metric_pref
= -1;
74 static int hf_pim_metric
= -1;
75 static int hf_pim_prune_indicator
= -1;
76 static int hf_pim_prune_now
= -1;
77 static int hf_pim_assert_override
= -1;
78 static int hf_pim_source_ip4
= -1;
79 static int hf_pim_source_ip6
= -1;
80 static int hf_pim_group_ip4
= -1;
81 static int hf_pim_group_ip6
= -1;
82 static int hf_pim_group_mask_ip4
= -1;
83 static int hf_pim_upstream_neighbor_ip4
= -1;
84 static int hf_pim_upstream_neighbor_ip6
= -1;
85 static int hf_pim_join_ip4
= -1;
86 static int hf_pim_join_ip6
= -1;
87 static int hf_pim_prune_ip4
= -1;
88 static int hf_pim_prune_ip6
= -1;
89 static int hf_pim_address_list_ip4
= -1;
90 static int hf_pim_address_list_ip6
= -1;
91 static int hf_pim_bsr_ip4
= -1;
92 static int hf_pim_bsr_ip6
= -1;
93 static int hf_pim_rp_ip4
= -1;
94 static int hf_pim_rp_ip6
= -1;
95 static int hf_pim_originator_ip4
= -1;
96 static int hf_pim_originator_ip6
= -1;
97 static int hf_pim_group_address_ip4
= -1;
98 static int hf_pim_rp_address_ip4
= -1;
99 static int hf_pim_fragment_tag
= -1;
100 static int hf_pim_hash_mask_len
= -1;
101 static int hf_pim_bsr_priority
= -1;
102 static int hf_pim_rp_count
= -1;
103 static int hf_pim_frp_count
= -1;
104 static int hf_pim_priority
= -1;
105 static int hf_pim_prefix_count
= -1;
106 static int hf_pim_mask_len
= -1;
107 static int hf_pim_ttl
= -1;
108 static int hf_pim_interval
= -1;
110 static gint ett_pim
= -1;
111 static gint ett_pim_opts
= -1;
112 static gint ett_pim_opt
= -1;
114 static dissector_handle_t ip_handle
;
115 static dissector_handle_t ipv6_handle
;
117 static gboolean use_main_tree
= TRUE
;
122 * ftp://ftp.usc.edu/pub/csinfo/tech-reports/papers/95-599.ps.Z
124 * NOTE: There is still some doubt that this is THE definitive PIMv1
125 * specification. Of note, the type1vals entry, { 8, "Mode" }, does
126 * not appear as a valid code in the referenced document above.
128 * This one is likely closer to the last PIMv1 spec:
129 * http://tools.ietf.org/id/draft-ietf-idmr-pim-spec-02.txt
132 dissect_pimv1_addr(tvbuff_t
*tvb
, int offset
) {
133 guint16 flags_masklen
;
135 flags_masklen
= tvb_get_ntohs(tvb
, offset
);
136 if (flags_masklen
& 0x0180) {
137 return wmem_strdup_printf(wmem_packet_scope(), "(%s%s%s) ",
138 flags_masklen
& 0x0100 ? "S" : "",
139 flags_masklen
& 0x0080 ? "W" : "",
140 flags_masklen
& 0x0040 ? "R" : "");
142 return wmem_strdup_printf(wmem_packet_scope(), "%s/%u",
143 tvb_ip_to_str(tvb
, offset
+ 2), flags_masklen
& 0x3f);
147 static const value_string type1vals
[] = {
150 { 2, "Register-stop" },
152 { 4, "RP-Reachable" },
160 static const value_string pimv1_modevals
[] = {
163 { 2, "Sparse-Dense" },
167 /* This function is only called from the IGMP dissector */
169 dissect_pimv1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
173 guint length
, pim_length
;
174 guint16 pim_cksum
, computed_cksum
;
176 proto_tree
*pim_tree
= NULL
;
178 proto_tree
*pimopt_tree
= NULL
;
181 if (!proto_is_protocol_enabled(find_protocol_by_id(proto_pim
))) {
183 * We are not enabled; skip entire packet to be nice to the
184 * IGMP layer (so clicking on IGMP will display the data).
186 return offset
+tvb_length_remaining(tvb
, offset
);
189 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "PIMv1");
190 col_clear(pinfo
->cinfo
, COL_INFO
);
192 ti
= proto_tree_add_item(tree
, proto_pim
, tvb
, offset
, -1, ENC_NA
);
193 pim_tree
= proto_item_add_subtree(ti
, ett_pim
);
195 /* Put IGMP type, 0x14, into the tree */
196 proto_tree_add_text(pim_tree
, tvb
, offset
, 1, "Type: PIM (0x14)");
199 pim_type
= tvb_get_guint8(tvb
, offset
);
200 col_add_str(pinfo
->cinfo
, COL_INFO
,
201 val_to_str(pim_type
, type1vals
, "Unknown (%u)"));
203 proto_tree_add_uint(pim_tree
, hf_pim_code
, tvb
, offset
, 1, pim_type
);
206 pim_cksum
= tvb_get_ntohs(tvb
, offset
);
207 pim_ver
= PIM_VER(tvb_get_guint8(tvb
, offset
+ 2));
210 * Not PIMv1 - what gives?
212 proto_tree_add_uint(pim_tree
, hf_pim_cksum
, tvb
,
213 offset
, 2, pim_cksum
);
216 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
217 return offset
+tvb_length_remaining(tvb
, offset
);
221 * Well, it's PIM v1, so we can check whether this is a
222 * Register message, and thus can figure out how much to
223 * checksum and whether to make the columns read-only.
225 length
= tvb_length(tvb
);
228 * Register message - the PIM header is 8 bytes long.
229 * Also set the columns non-writable. Otherwise the IPv4 or
230 * IPv6 dissector for the encapsulated packet that caused
231 * this register will overwrite the PIM info in the columns.
234 col_set_writable(pinfo
->cinfo
, FALSE
);
237 * Other message - checksum the entire packet.
239 pim_length
= tvb_reported_length(tvb
);
242 if (!pinfo
->fragmented
&& length
>= pim_length
) {
244 * The packet isn't part of a fragmented datagram and isn't
245 * truncated, so we can checksum it.
247 cksum_vec
[0].ptr
= tvb_get_ptr(tvb
, 0, pim_length
);
248 cksum_vec
[0].len
= pim_length
;
249 computed_cksum
= in_cksum(&cksum_vec
[0], 1);
250 if (computed_cksum
== 0) {
251 proto_tree_add_uint_format_value(pim_tree
, hf_pim_cksum
, tvb
,
252 offset
, 2, pim_cksum
,
256 proto_tree_add_uint_format_value(pim_tree
, hf_pim_cksum
, tvb
,
257 offset
, 2, pim_cksum
,
258 "0x%04x [incorrect, should be 0x%04x]",
259 pim_cksum
, in_cksum_shouldbe(pim_cksum
, computed_cksum
));
262 proto_tree_add_uint(pim_tree
, hf_pim_cksum
, tvb
,
263 offset
, 2, pim_cksum
);
267 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
270 offset
+= 3; /* skip reserved stuff */
272 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
273 tiopt
= proto_tree_add_text(pim_tree
, tvb
, offset
, -1, "PIM options");
274 pimopt_tree
= proto_item_add_subtree(tiopt
, ett_pim_opts
);
278 /* version 1 decoder */
284 proto_tree_add_item(pimopt_tree
, hf_pim_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
287 holdtime
= tvb_get_ntohs(tvb
, offset
);
288 proto_tree_add_uint_format_value(pimopt_tree
, hf_pim_holdtime
, tvb
,
291 holdtime
== 0xffff ? "(infinity)": "");
296 case 1: /* register */
302 * The rest of the packet is a multicast data packet.
304 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
307 * It's an IP packet - determine whether it's IPv4 or IPv6.
309 v_hl
= tvb_get_guint8(tvb
, offset
);
310 switch((v_hl
& 0xf0) >> 4) {
311 case 0: /* Null-Register dummy header.
312 * Has the same address family as the encapsulating PIM packet,
313 * e.g. an IPv6 data packet is encapsulated in IPv6 PIM packet.
315 if (pinfo
->src
.type
== AT_IPv4
) {
316 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1, "IPv4 dummy header");
317 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
318 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
+ 16, 4, ENC_BIG_ENDIAN
);
319 } else if (pinfo
->src
.type
== AT_IPv6
) {
320 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1, "IPv6 dummy header");
321 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip6
, tvb
, offset
+ 8, 16, ENC_NA
);
322 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip6
, tvb
, offset
+ 8 + 16, 16, ENC_NA
);
324 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1,
325 "Dummy header for an unknown protocol");
329 call_dissector(ip_handle
, next_tvb
, pinfo
, tree
);
331 call_dissector(ip_handle
, next_tvb
, pinfo
, pimopt_tree
);
336 call_dissector(ipv6_handle
, next_tvb
, pinfo
, tree
);
338 call_dissector(ipv6_handle
, next_tvb
, pinfo
, pimopt_tree
);
342 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1,
343 "Unknown IP version %d", (v_hl
& 0xf0) >> 4);
349 case 2: /* register-stop */
351 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
353 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
358 case 3: /* join/prune */
360 case 7: /* graft-ack */
364 int ngroup
, i
, njoin
, nprune
, j
;
368 proto_tree
*grouptree
= NULL
;
370 proto_tree
*subtree
= NULL
;
373 proto_tree_add_item(pimopt_tree
, hf_pim_upstream_neighbor_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
376 offset
+= 2; /* skip reserved stuff */
378 holdtime
= tvb_get_ntohs(tvb
, offset
);
379 proto_tree_add_uint_format_value(pimopt_tree
, hf_pim_holdtime
, tvb
,
382 holdtime
== 0xffff ? "(infinity)": "");
385 offset
+= 1; /* skip reserved stuff */
387 mask_len
= tvb_get_guint8(tvb
, offset
);
388 proto_tree_add_text(pimopt_tree
, tvb
, offset
, 1,
389 "Mask length: %u", mask_len
);
392 adr_len
= tvb_get_guint8(tvb
, offset
);
393 proto_tree_add_text(pimopt_tree
, tvb
, offset
, 1,
394 "Address length: %u", adr_len
);
397 ngroup
= tvb_get_guint8(tvb
, offset
);
398 proto_tree_add_item(pimopt_tree
, hf_pim_numgroups
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
401 for (i
= 0; i
< ngroup
; i
++) {
403 * XXX - does the group address have the length "adr_len"
404 * and the group mask the length "mask_len"?
406 tigroup
= proto_tree_add_ipv4_format(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
, 4,
407 tvb_get_ipv4(tvb
, offset
), "Group %d: %s", i
, tvb_ip_to_str(tvb
, offset
));
408 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
411 proto_tree_add_ipv4_format(grouptree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4,
412 tvb_get_ipv4(tvb
, offset
), "Group %d Mask: %s", i
, tvb_ip_to_str(tvb
, offset
));
415 njoin
= tvb_get_ntohs(tvb
, offset
);
416 nprune
= tvb_get_ntohs(tvb
, offset
+ 2);
417 tisub
= proto_tree_add_item(grouptree
, hf_pim_numjoins
, tvb
,
418 offset
, 2, ENC_BIG_ENDIAN
);
419 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
421 for (j
= 0; j
< njoin
; j
++) {
422 s
= dissect_pimv1_addr(tvb
, off
);
423 proto_tree_add_text(subtree
, tvb
, off
, 6,
424 "IP address: %s", s
);
428 tisub
= proto_tree_add_item(grouptree
, hf_pim_numprunes
, tvb
,
429 offset
+ 2, 2, ENC_BIG_ENDIAN
);
430 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
431 for (j
= 0; j
< nprune
; j
++) {
432 s
= dissect_pimv1_addr(tvb
, off
);
433 proto_tree_add_text(subtree
, tvb
, off
, 6,
434 "IP address: %s", s
);
442 case 4: /* rp-reachability */
446 proto_tree_add_item(pimopt_tree
, hf_pim_group_address_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
449 proto_tree_add_item(pimopt_tree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
452 proto_tree_add_item(pimopt_tree
, hf_pim_rp_address_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
455 offset
+= 2; /* skip reserved stuff */
457 holdtime
= tvb_get_ntohs(tvb
, offset
);
458 proto_tree_add_uint_format_value(pimopt_tree
, hf_pim_holdtime
, tvb
,
461 holdtime
== 0xffff ? "(infinity)": "");
469 proto_tree_add_item(pimopt_tree
, hf_pim_group_address_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
472 proto_tree_add_item(pimopt_tree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
475 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
476 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
477 offset
, 4, ENC_BIG_ENDIAN
);
480 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
490 return offset
+tvb_length_remaining(tvb
, offset
);
494 dissect_pim_addr(proto_tree
* tree
, tvbuff_t
*tvb
, int offset
, enum pimv2_addrtype at
,
495 const char* label
, proto_item
** ret_item
, int hf_ip4
, int hf_ip6
, int *advance
) {
496 guint8 af
, et
, flags
, mask_len
;
497 struct e_in6_addr ipv6
;
499 proto_item
* ti
= NULL
;
502 af
= tvb_get_guint8(tvb
, offset
);
503 if (af
!= AFNUM_INET
&& af
!= AFNUM_INET6
) {
505 * We don't handle the other formats, and addresses don't include
506 * a length field, so we can't even show them as raw bytes.
511 et
= tvb_get_guint8(tvb
, offset
+ 1);
514 * The only defined encoding type is 0, for the native encoding;
515 * again, as addresses don't include a length field, we can't
516 * even show addresses with a different encoding type as raw
527 ipv4
= tvb_get_ipv4(tvb
, offset
+ 2);
530 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 2 + len
,
531 ipv4
, "%s: %s", label
, tvb_ip_to_str(tvb
, offset
+ 2));
535 ti
= proto_tree_add_ipv4(tree
, hf_ip4
, tvb
, offset
, 2 + len
, ipv4
);
541 tvb_get_ipv6(tvb
, offset
+ 2, &ipv6
);
544 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 2 + len
,
545 (guint8
*)&ipv6
, "%s: %s", label
, tvb_ip6_to_str(tvb
, offset
+ 2));
549 ti
= proto_tree_add_ipv6(tree
, hf_ip6
, tvb
, offset
, 2 + len
, (guint8
*)&ipv6
);
557 mask_len
= tvb_get_guint8(tvb
, offset
+ 3);
561 ipv4
= tvb_get_ipv4(tvb
, offset
+ 4);
564 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 4 + len
,
565 ipv4
, "%s: %s", label
, tvb_ip_to_str(tvb
, offset
+ 4));
569 ti
= proto_tree_add_ipv4(tree
, hf_ip4
, tvb
, offset
, 4 + len
, ipv4
);
572 proto_item_append_text(ti
, "/%u", mask_len
);
577 tvb_get_ipv6(tvb
, offset
+ 4, &ipv6
);
580 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 4 + len
,
581 (guint8
*)&ipv6
, "%s: %s", label
, tvb_ip6_to_str(tvb
, offset
+ 4));
585 ti
= proto_tree_add_ipv6(tree
, hf_ip6
, tvb
, offset
, 4 + len
, (guint8
*)&ipv6
);
587 proto_item_append_text(ti
, "/%u", mask_len
);
594 flags
= tvb_get_guint8(tvb
, offset
+ 2);
595 mask_len
= tvb_get_guint8(tvb
, offset
+ 3);
599 ipv4
= tvb_get_ipv4(tvb
, offset
+ 4);
602 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 4 + len
,
603 ipv4
, "%s: %s", label
, tvb_ip_to_str(tvb
, offset
+ 4));
607 ti
= proto_tree_add_ipv4_format_value(tree
, hf_ip4
, tvb
, offset
, 4 + len
, ipv4
,
608 "%s", tvb_ip_to_str(tvb
, offset
+ 4));
610 proto_item_append_text(ti
, "/%u", mask_len
);
615 tvb_get_ipv6(tvb
, offset
+ 4, &ipv6
);
618 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 4 + len
,
619 (guint8
*)&ipv6
, "%s: %s", label
, tvb_ip6_to_str(tvb
, offset
+ 4));
623 ti
= proto_tree_add_ipv6_format_value(tree
, hf_ip6
, tvb
, offset
, 4 + len
, (guint8
*)&ipv6
,
624 "%s", tvb_ip6_to_str(tvb
, offset
+ 4));
626 proto_item_append_text(ti
, "/%u", mask_len
);
630 proto_item_append_text(ti
, " (%s%s%s)",
631 flags
& 0x04 ? "S" : "",
632 flags
& 0x02 ? "W" : "",
633 flags
& 0x01 ? "R" : "");
641 if (ret_item
!= NULL
)
647 static const value_string type2vals
[] = {
650 { 2, "Register-stop" },
656 { 8, "Candidate-RP-Advertisement" },
657 { 9, "State-Refresh" },
661 static const value_string pim_opt_vals
[] = {
663 {2, "LAN Prune Delay"},
664 {18, "Deprecated and should not be used"},
666 {20, "Generation ID"},
667 {21, "State Refresh Capable"},
668 {22, "Bidir Capable"},
669 {24, "Address List"},
670 {65001, "Address List"}, /* old implementation */
675 * For PIM v2, see RFC 4601, RFC 3973 and draft-ietf-pim-sm-v2-new-03
676 * (when PIM is run over IPv6, the rules for computing the PIM checksum
677 * from the draft in question, not from RFC 2362, should be used).
680 dissect_pim(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
) {
683 guint length
, pim_length
;
684 guint16 pim_cksum
, computed_cksum
;
688 proto_tree
*pim_tree
= NULL
;
690 proto_tree
*pimopt_tree
= NULL
;
693 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "PIM");
694 col_clear(pinfo
->cinfo
, COL_INFO
);
696 pim_typever
= tvb_get_guint8(tvb
, 0);
698 switch (PIM_VER(pim_typever
)) {
700 typestr
= val_to_str(PIM_TYPE(pim_typever
), type2vals
, "Unknown (%u)");
702 case 1: /* PIMv1 - we should never see this */
708 col_add_fstr(pinfo
->cinfo
, COL_PROTOCOL
, "PIMv%d",
709 PIM_VER(pim_typever
));
710 col_add_str(pinfo
->cinfo
, COL_INFO
, typestr
);
712 ti
= proto_tree_add_item(tree
, proto_pim
, tvb
, offset
, -1, ENC_NA
);
713 pim_tree
= proto_item_add_subtree(ti
, ett_pim
);
715 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
716 proto_tree_add_item(pim_tree
, hf_pim_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
717 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
+ 1, 1, ENC_NA
);
718 pim_cksum
= tvb_get_ntohs(tvb
, offset
+ 2);
719 length
= tvb_length(tvb
);
720 if (PIM_VER(pim_typever
) == 2) {
722 * Well, it's PIM v2, so we can check whether this is a Register
723 * message, and thus can figure out how much to checksum and
724 * whether to make the columns read-only.
726 if (PIM_TYPE(pim_typever
) == 1) {
728 * Register message - the PIM header is 8 bytes long.
729 * Also set the columns non-writable. Otherwise the IPv4 or
730 * IPv6 dissector for the encapsulated packet that caused
731 * this register will overwrite the PIM info in the columns.
734 col_set_writable(pinfo
->cinfo
, FALSE
);
737 * Other message - checksum the entire packet.
739 pim_length
= tvb_reported_length(tvb
);
743 * We don't know what type of message this is, so say that
744 * the length is 0, to force it not to be checksummed.
748 if (!pinfo
->fragmented
&& length
>= pim_length
) {
750 * The packet isn't part of a fragmented datagram and isn't
751 * truncated, so we can checksum it.
754 switch (pinfo
->src
.type
) {
756 cksum_vec
[0].ptr
= tvb_get_ptr(tvb
, 0, pim_length
);
757 cksum_vec
[0].len
= pim_length
;
758 computed_cksum
= in_cksum(&cksum_vec
[0], 1);
761 /* Set up the fields of the pseudo-header. */
762 cksum_vec
[0].ptr
= (guint8
*)pinfo
->src
.data
;
763 cksum_vec
[0].len
= pinfo
->src
.len
;
764 cksum_vec
[1].ptr
= (guint8
*)pinfo
->dst
.data
;
765 cksum_vec
[1].len
= pinfo
->dst
.len
;
766 cksum_vec
[2].ptr
= (const guint8
*)&phdr
;
767 phdr
[0] = g_htonl(pim_length
);
768 phdr
[1] = g_htonl(IP_PROTO_PIM
);
769 cksum_vec
[2].len
= 8;
770 cksum_vec
[3].ptr
= tvb_get_ptr(tvb
, 0, pim_length
);
771 cksum_vec
[3].len
= pim_length
;
772 computed_cksum
= in_cksum(&cksum_vec
[0], 4);
775 /* PIM is available for IPv4 and IPv6 right now */
776 DISSECTOR_ASSERT_NOT_REACHED();
780 if (computed_cksum
== 0) {
781 proto_tree_add_uint_format_value(pim_tree
, hf_pim_cksum
, tvb
,
782 offset
+ 2, 2, pim_cksum
,
786 proto_tree_add_uint_format_value(pim_tree
, hf_pim_cksum
, tvb
,
787 offset
+ 2, 2, pim_cksum
,
788 "0x%04x [incorrect, should be 0x%04x]",
789 pim_cksum
, in_cksum_shouldbe(pim_cksum
, computed_cksum
));
792 proto_tree_add_uint(pim_tree
, hf_pim_cksum
, tvb
,
793 offset
+ 2, 2, pim_cksum
);
798 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
799 tiopt
= proto_tree_add_text(pim_tree
, tvb
, offset
, -1, "PIM options");
800 pimopt_tree
= proto_item_add_subtree(tiopt
, ett_pim_opts
);
804 if (PIM_VER(pim_typever
) != 2)
807 /* version 2 decoder */
808 switch (PIM_TYPE(pim_typever
)) {
813 while (tvb_reported_length_remaining(tvb
, offset
) >= 2) {
814 guint16 hello_opt
, opt_len
;
816 proto_item
*opt_item
;
817 proto_tree
*opt_tree
;
820 hello_opt
= tvb_get_ntohs(tvb
, offset
);
821 opt_len
= tvb_get_ntohs(tvb
, offset
+ 2);
822 opt_item
= proto_tree_add_text(pimopt_tree
, tvb
, offset
, 4 + opt_len
,
823 "Option %u: %s", hello_opt
,
824 val_to_str(hello_opt
, pim_opt_vals
, "Unknown: %u"));
825 opt_tree
= proto_item_add_subtree(opt_item
, ett_pim_opt
);
826 proto_tree_add_item(opt_tree
, hf_pim_optiontype
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
827 proto_tree_add_item(opt_tree
, hf_pim_optionlength
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
830 case 1: /* Hello Hold Time Option */
831 opt_value
= tvb_get_ntohs(tvb
, offset
+ 4);
832 proto_tree_add_uint_format_value(opt_tree
, hf_pim_holdtime
, tvb
,
833 offset
+ 4, opt_len
, opt_value
,
834 "%us %s", opt_value
, opt_value
== 0 ? "(goodbye)" :
835 opt_value
== 0xffff ? "(infinity)": "");
836 proto_item_append_text(opt_item
, ": %us %s", opt_value
,
837 opt_value
== 0 ? "(goodbye)" :
838 opt_value
== 0xffff ? "(infinity)": "");
841 case 2: /* LAN Prune Delay Option */
842 proto_tree_add_item(opt_tree
, hf_pim_t
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
843 proto_tree_add_item(opt_tree
, hf_pim_propagation_delay
, tvb
, offset
+ 4, 2, ENC_BIG_ENDIAN
);
844 proto_tree_add_item(opt_tree
, hf_pim_override_interval
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
845 proto_item_append_text(opt_item
,
846 ": T = %u, Propagation Delay = %ums, Override Interval = %ums",
847 tvb_get_guint8(tvb
, offset
+ 4) & 0x80 ? 1 : 0,
848 tvb_get_ntohs(tvb
, offset
+ 4) & 0x7fff,
849 tvb_get_ntohs(tvb
, offset
+ 6));
852 case 19: /* DR priority */
853 proto_tree_add_item(opt_tree
, hf_pim_dr_priority
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
854 proto_item_append_text(opt_item
, ": %u", tvb_get_ntohl(tvb
, offset
+ 4));
857 case 20: /* Generation ID */
858 proto_tree_add_item(opt_tree
, hf_pim_generation_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
859 proto_item_append_text(opt_item
, ": %u", tvb_get_ntohl(tvb
, offset
+ 4));
862 case 21: /* State Refresh Capable Option */
863 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_version
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
864 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_interval
, tvb
, offset
+ 5, 1, ENC_BIG_ENDIAN
);
865 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_reserved
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
866 proto_item_append_text(opt_item
, ": Version = %u, Interval = %us",
867 tvb_get_guint8(tvb
, offset
+ 4),
868 tvb_get_guint8(tvb
, offset
+ 5));
871 case 24: /* address list */
872 case 65001: /* address list (old implementations) */
875 proto_tree
*sub_tree
= NULL
;
876 proto_item
*addrlist_option
;
878 addrlist_option
= proto_tree_add_text(opt_tree
, tvb
, offset
, 4 + opt_len
,
879 "%sAddress List (%u)",
880 hello_opt
== 65001 ? "old " : "",
882 sub_tree
= proto_item_add_subtree(addrlist_option
, ett_pim_opt
);
883 for (i
= offset
+ 4; i
< offset
+ 4 + opt_len
; ) {
885 if (!dissect_pim_addr(sub_tree
, tvb
, i
, pimv2_unicast
, NULL
, NULL
,
886 hf_pim_address_list_ip4
, hf_pim_address_list_ip6
, &advance
))
895 proto_tree_add_item(opt_tree
, hf_pim_optionvalue
, tvb
,
896 offset
+ 4, opt_len
, ENC_NA
);
899 offset
+= 4 + opt_len
;
901 proto_item_append_text(tiopt
, ": %u", opt_count
);
905 case 1: /* register */
909 proto_tree
*flag_tree
;
912 tiflag
= proto_tree_add_item(pimopt_tree
, hf_pim_register_flag
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
913 flag_tree
= proto_item_add_subtree(tiflag
, ett_pim
);
914 proto_tree_add_item(flag_tree
, hf_pim_register_flag_border
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
915 proto_tree_add_item(flag_tree
, hf_pim_register_flag_null_register
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
919 * The rest of the packet is a multicast data packet.
921 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
924 * It's an IP packet - determine whether it's IPv4 or IPv6.
926 v_hl
= tvb_get_guint8(tvb
, offset
);
927 switch((v_hl
& 0xf0) >> 4) {
928 case 0: /* Null-Register dummy header.
929 * Has the same address family as the encapsulating PIM packet,
930 * e.g. an IPv6 data packet is encapsulated in IPv6 PIM packet.
932 if (pinfo
->src
.type
== AT_IPv4
) {
933 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1, "IPv4 dummy header");
934 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
935 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
+ 16, 4, ENC_BIG_ENDIAN
);
936 } else if (pinfo
->src
.type
== AT_IPv6
) {
937 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1, "IPv6 dummy header");
938 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip6
, tvb
, offset
+ 8, 16, ENC_NA
);
939 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip6
, tvb
, offset
+ 8 + 16, 16, ENC_NA
);
941 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1,
942 "Dummy header for an unknown protocol");
946 call_dissector(ip_handle
, next_tvb
, pinfo
, tree
);
948 call_dissector(ip_handle
, next_tvb
, pinfo
, pimopt_tree
);
953 call_dissector(ipv6_handle
, next_tvb
, pinfo
, tree
);
955 call_dissector(ipv6_handle
, next_tvb
, pinfo
, pimopt_tree
);
959 proto_tree_add_text(pimopt_tree
, tvb
, offset
, -1,
960 "Unknown IP version %d", (v_hl
& 0xf0) >> 4);
966 case 2: /* register-stop */
970 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
, NULL
, NULL
,
971 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
974 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
975 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
980 case 3: /* join/prune */
982 case 7: /* graft-ack */
986 int ngroup
, i
, njoin
, nprune
, j
;
988 proto_tree
*grouptree
= NULL
;
990 proto_tree
*subtree
= NULL
;
993 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
994 hf_pim_upstream_neighbor_ip4
, hf_pim_upstream_neighbor_ip6
, &advance
))
999 proto_tree_add_item(pimopt_tree
, hf_pim_res_bytes
, tvb
, offset
, 1, ENC_NA
);
1000 offset
+= 1; /* skip reserved field */
1002 ngroup
= tvb_get_guint8(tvb
, offset
);
1003 proto_tree_add_item(pimopt_tree
, hf_pim_numgroups
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1006 holdtime
= tvb_get_ntohs(tvb
, offset
);
1007 proto_tree_add_uint_format_value(pimopt_tree
, hf_pim_holdtime
, tvb
,
1008 offset
, 2, holdtime
,
1010 holdtime
== 0xffff ? "(infinity)": "");
1013 for (i
= 0; i
< ngroup
; i
++) {
1014 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
,
1015 wmem_strdup_printf(wmem_packet_scope(), "Group %d", i
), &tigroup
,
1016 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1019 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
1022 njoin
= tvb_get_ntohs(tvb
, offset
);
1023 nprune
= tvb_get_ntohs(tvb
, offset
+ 2);
1024 tisub
= proto_tree_add_item(grouptree
, hf_pim_numjoins
, tvb
,
1025 offset
, 2, ENC_BIG_ENDIAN
);
1026 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
1028 for (j
= 0; j
< njoin
; j
++) {
1029 if (!dissect_pim_addr(subtree
, tvb
, off
, pimv2_source
, NULL
, NULL
,
1030 hf_pim_join_ip4
, hf_pim_join_ip6
, &advance
))
1036 tisub
= proto_tree_add_item(grouptree
, hf_pim_numprunes
, tvb
,
1037 offset
+ 2, 2, ENC_BIG_ENDIAN
);
1038 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
1039 for (j
= 0; j
< nprune
; j
++) {
1040 if (!dissect_pim_addr(subtree
, tvb
, off
, pimv2_source
, NULL
, NULL
,
1041 hf_pim_prune_ip4
, hf_pim_prune_ip6
, &advance
))
1052 case 4: /* bootstrap */
1058 proto_tree
*grouptree
= NULL
;
1059 proto_item
*tigroup
;
1061 proto_tree_add_item(pimopt_tree
, hf_pim_fragment_tag
, tvb
,
1062 offset
, 2, ENC_BIG_ENDIAN
);
1065 proto_tree_add_item(pimopt_tree
, hf_pim_hash_mask_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1067 proto_tree_add_item(pimopt_tree
, hf_pim_bsr_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1070 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1071 hf_pim_bsr_ip4
, hf_pim_bsr_ip6
, &advance
))
1075 for (i
= 0; tvb_reported_length_remaining(tvb
, offset
) > 0; i
++) {
1076 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
,
1077 wmem_strdup_printf(wmem_packet_scope(), "Group %d", i
), &tigroup
,
1078 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1081 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
1084 proto_tree_add_item(grouptree
, hf_pim_rp_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1086 frpcnt
= tvb_get_guint8(tvb
, offset
);
1087 proto_tree_add_item(grouptree
, hf_pim_frp_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1090 for (j
= 0; j
< frpcnt
; j
++) {
1091 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1092 wmem_strdup_printf(wmem_packet_scope(), "RP %d", j
), NULL
,
1093 hf_pim_rp_ip4
, hf_pim_rp_ip6
, &advance
))
1098 holdtime
= tvb_get_ntohs(tvb
, offset
);
1099 proto_tree_add_uint_format_value(grouptree
, hf_pim_holdtime
, tvb
,
1100 offset
, 2, holdtime
,
1102 holdtime
== 0xffff ? "(infinity)": "");
1104 proto_tree_add_item(grouptree
, hf_pim_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1105 offset
+= 2; /* also skips reserved field */
1113 case 5: /* assert */
1117 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
,
1119 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1123 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1125 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1129 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1130 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
1131 offset
, 4, ENC_BIG_ENDIAN
);
1134 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1139 case 8: /* Candidate-RP-Advertisement */
1146 pfxcnt
= tvb_get_guint8(tvb
, offset
);
1147 proto_tree_add_item(pimopt_tree
, hf_pim_prefix_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1149 proto_tree_add_item(pimopt_tree
, hf_pim_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1151 holdtime
= tvb_get_ntohs(tvb
, offset
);
1152 proto_tree_add_uint_format_value(pimopt_tree
, hf_pim_holdtime
, tvb
,
1153 offset
, 2, holdtime
,
1155 holdtime
== 0xffff ? "(infinity)": "");
1158 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1160 hf_pim_rp_ip4
, hf_pim_rp_ip6
, &advance
))
1164 for (i
= 0; i
< pfxcnt
; i
++) {
1165 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
,
1166 wmem_strdup_printf(wmem_packet_scope(), "Group %d", i
), NULL
,
1167 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1175 case 9: /* State-Refresh */
1179 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_group
,
1181 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1185 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1187 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1191 if (!dissect_pim_addr(pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1193 hf_pim_originator_ip4
, hf_pim_originator_ip6
, &advance
))
1197 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1198 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
1199 offset
, 4, ENC_BIG_ENDIAN
);
1202 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1205 proto_tree_add_item(pimopt_tree
, hf_pim_mask_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1208 proto_tree_add_item(pimopt_tree
, hf_pim_ttl
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1211 proto_tree_add_item(pimopt_tree
, hf_pim_prune_indicator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1212 proto_tree_add_item(pimopt_tree
, hf_pim_prune_now
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1213 proto_tree_add_item(pimopt_tree
, hf_pim_assert_override
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1216 proto_tree_add_item(pimopt_tree
, hf_pim_interval
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1229 proto_register_pim(void)
1231 static hf_register_info hf
[] =
1234 { "Version", "pim.version",
1235 FT_UINT8
, BASE_DEC
, NULL
, 0xf0,
1239 { "Type", "pim.type",
1240 FT_UINT8
, BASE_DEC
, VALS(type2vals
), 0x0f,
1244 { "Code", "pim.code",
1245 FT_UINT8
, BASE_DEC
, VALS(type1vals
), 0x0,
1249 { "Checksum", "pim.cksum",
1250 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
1253 { &hf_pim_res_bytes
,
1254 { "Reserved byte(s)", "pim.res_bytes",
1255 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1258 { &hf_pim_optiontype
,
1259 { "Type", "pim.optiontype",
1260 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1263 { &hf_pim_optionlength
,
1264 { "Length", "pim.optionlength",
1265 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1268 { &hf_pim_optionvalue
,
1269 { "Unknown", "pim.optionvalue",
1270 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1273 { &hf_pim_register_flag
,
1274 { "Flags", "pim.register_flag",
1275 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1278 { &hf_pim_register_flag_border
,
1279 { "Border", "pim.register_flag.border",
1280 FT_BOOLEAN
, 32, TFS(&tfs_yes_no
), 0x80000000,
1283 { &hf_pim_register_flag_null_register
,
1284 { "Null-Register", "pim.register_flag.null_register",
1285 FT_BOOLEAN
, 32, TFS(&tfs_yes_no
), 0x40000000,
1289 { "Mode", "pim.mode",
1290 FT_UINT8
, BASE_DEC
, VALS(pimv1_modevals
), 0xf0,
1294 { "Holdtime", "pim.holdtime",
1295 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1296 "The amount of time a receiver must keep the neighbor "
1297 "reachable, in seconds.", HFILL
}
1299 { &hf_pim_numgroups
,
1300 { "Num Groups", "pim.numgroups",
1301 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1302 "Number of multicast group sets contained in the message.",
1306 { "Num Joins", "pim.numjoins",
1307 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1308 "Number of joined sources.", HFILL
}
1310 { &hf_pim_numprunes
,
1311 { "Num Prunes", "pim.numprunes",
1312 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1313 "Number of pruned sources.", HFILL
}
1317 FT_BOOLEAN
, 8, NULL
, 0x80,
1318 "Specifies the ability of the sending router to disable joins "
1319 "suppression.", HFILL
}
1321 { &hf_pim_propagation_delay
,
1322 { "Propagation Delay", "pim.propagation_delay",
1323 FT_UINT16
, BASE_DEC
, NULL
, 0x07fff,
1324 "Units are milli-seconds", HFILL
}
1326 { &hf_pim_override_interval
,
1327 { "Override Interval", "pim.override_interval",
1328 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1329 "Units are milli-seconds", HFILL
}
1331 { &hf_pim_dr_priority
,
1332 { "DR Priority", "pim.dr_priority",
1333 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1336 { &hf_pim_generation_id
,
1337 { "Generation ID", "pim.generation_id",
1338 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1341 { &hf_pim_state_refresh_version
,
1342 { "Version", "pim.state_refresh_version",
1343 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1346 { &hf_pim_state_refresh_interval
,
1347 { "Interval", "pim.state_refresh_interval",
1348 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1349 "Units in seconds.", HFILL
}
1351 { &hf_pim_state_refresh_reserved
,
1352 { "Reserved", "pim.state_refresh_reserved",
1353 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1357 { "RP Tree", "pim.rpt",
1358 FT_BOOLEAN
, 8, NULL
, 0x80,
1359 "Set to 1 for assert(*,G) messages and 0 for assert(S,G) "
1360 "messages.", HFILL
}
1362 { &hf_pim_metric_pref
,
1363 { "Metric Preference", "pim.metric_pref",
1364 FT_UINT32
, BASE_DEC
, NULL
, 0x7fffffff,
1368 { "Metric", "pim.metric",
1369 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1372 { &hf_pim_prune_indicator
,
1373 { "Prune indicator", "pim.prune_indicator",
1374 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x80,
1377 { &hf_pim_prune_now
,
1378 { "Prune now", "pim.prune_now",
1379 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x40,
1382 { &hf_pim_assert_override
,
1383 { "Assert override", "pim.assert_override",
1384 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x20,
1387 { &hf_pim_source_ip4
,
1388 { "Source", "pim.source",
1389 FT_IPv4
, BASE_NONE
, NULL
, 0,
1392 { &hf_pim_source_ip6
,
1393 { "Source", "pim.source",
1394 FT_IPv6
, BASE_NONE
, NULL
, 0,
1397 { &hf_pim_group_ip4
,
1398 { "Group", "pim.group",
1399 FT_IPv4
, BASE_NONE
, NULL
, 0,
1402 { &hf_pim_group_mask_ip4
,
1403 { "Mask", "pim.group_mask",
1404 FT_IPv4
, BASE_NONE
, NULL
, 0,
1407 { &hf_pim_group_ip6
,
1408 { "Group", "pim.group",
1409 FT_IPv6
, BASE_NONE
, NULL
, 0,
1412 { &hf_pim_upstream_neighbor_ip4
,
1413 { "Upstream-neighbor", "pim.upstream_neighbor",
1414 FT_IPv4
, BASE_NONE
, NULL
, 0,
1417 { &hf_pim_upstream_neighbor_ip6
,
1418 { "Upstream-neighbor", "pim.upstream_neighbor",
1419 FT_IPv6
, BASE_NONE
, NULL
, 0,
1422 { &hf_pim_join_ip4
,
1423 { "IP address", "pim.join_ip",
1424 FT_IPv4
, BASE_NONE
, NULL
, 0,
1427 { &hf_pim_join_ip6
,
1428 { "IP address", "pim.join_ip",
1429 FT_IPv6
, BASE_NONE
, NULL
, 0,
1432 { &hf_pim_prune_ip4
,
1433 { "IP address", "pim.prune_ip",
1434 FT_IPv4
, BASE_NONE
, NULL
, 0,
1437 { &hf_pim_prune_ip6
,
1438 { "IP address", "pim.prune_ip",
1439 FT_IPv6
, BASE_NONE
, NULL
, 0,
1442 { &hf_pim_address_list_ip4
,
1443 { "Address", "pim.address_list",
1444 FT_IPv4
, BASE_NONE
, NULL
, 0,
1447 { &hf_pim_address_list_ip6
,
1448 { "Address", "pim.address_list",
1449 FT_IPv6
, BASE_NONE
, NULL
, 0,
1454 FT_IPv4
, BASE_NONE
, NULL
, 0,
1459 FT_IPv6
, BASE_NONE
, NULL
, 0,
1464 FT_IPv4
, BASE_NONE
, NULL
, 0,
1469 FT_IPv6
, BASE_NONE
, NULL
, 0,
1472 { &hf_pim_originator_ip4
,
1473 { "Originator", "pim.originator",
1474 FT_IPv4
, BASE_NONE
, NULL
, 0,
1477 { &hf_pim_originator_ip6
,
1478 { "Originator", "pim.originator",
1479 FT_IPv6
, BASE_NONE
, NULL
, 0,
1482 { &hf_pim_group_address_ip4
,
1483 { "Group Address", "pim.group_address",
1484 FT_IPv4
, BASE_NONE
, NULL
, 0,
1487 { &hf_pim_rp_address_ip4
,
1488 { "RP Address", "pim.rp_address",
1489 FT_IPv4
, BASE_NONE
, NULL
, 0,
1492 { &hf_pim_fragment_tag
,
1493 { "Fragment tag", "pim.fragment_tag",
1494 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
1497 { &hf_pim_hash_mask_len
,
1498 { "Hash mask len", "pim.hash_mask_len",
1499 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1502 { &hf_pim_bsr_priority
,
1503 { "BSR priority", "pim.bsr_priority",
1504 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1508 { "RP count", "pim.rp_count",
1509 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1512 { &hf_pim_frp_count
,
1513 { "FRP count", "pim.frp_count",
1514 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1518 { "Priority", "pim.priority",
1519 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1522 { &hf_pim_prefix_count
,
1523 { "Prefix-count", "pim.prefix_count",
1524 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1528 { "Masklen", "pim.mask_len",
1529 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1534 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1538 { "Interval", "pim.interval",
1539 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1544 static gint
*ett
[] = {
1546 &ett_pim_opts
, /* Tree for all options */
1547 &ett_pim_opt
/* Tree for each option */
1550 module_t
*pim_module
;
1552 proto_pim
= proto_register_protocol("Protocol Independent Multicast",
1554 proto_register_field_array(proto_pim
, hf
, array_length(hf
));
1555 proto_register_subtree_array(ett
, array_length(ett
));
1557 pim_module
= prefs_register_protocol(proto_pim
, NULL
);
1558 prefs_register_bool_preference(pim_module
, "payload_tree",
1559 "PIM payload shown on main tree",
1560 "Whether the PIM payload is shown off of the main tree or encapsulated within the PIM options",
1566 proto_reg_handoff_pim(void)
1568 dissector_handle_t pim_handle
;
1570 pim_handle
= create_dissector_handle(dissect_pim
, proto_pim
);
1571 dissector_add_uint("ip.proto", IP_PROTO_PIM
, pim_handle
);
1574 * Get handles for the IPv4 and IPv6 dissectors.
1576 ip_handle
= find_dissector("ip");
1577 ipv6_handle
= find_dissector("ipv6");