2 * Routines for PIM disassembly
3 * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <epan/ipproto.h>
17 #include <epan/prefs.h>
18 #include <epan/expert.h>
19 #include <epan/in_cksum.h>
20 #include <epan/to_str.h>
22 #include <wsutil/array.h>
23 #include "packet-igmp.h"
25 void proto_register_pim(void);
26 void proto_reg_handoff_pim(void);
28 #define PIM_TYPE(x) ((x) & 0x0f)
29 #define PIM_VER(x) (((x) & 0xf0) >> 4)
30 #define PIM_BIDIR_SUBTYPE(x) ((x) & 0x0f)
31 #define PIM_SUBTYPE(x) (((x) & 0xf0) >> 4)
33 /* PIM message type */
35 #define PIM_TYPE_HELLO 0 /* Hello [RFC3973][RFC4601] */
36 #define PIM_TYPE_REGISTER 1 /* Register [RFC4601] */
37 #define PIM_TYPE_REGISTER_STOP 2 /* Register Stop [RFC4601] */
38 #define PIM_TYPE_JOIN_PRUNE 3 /* Join/Prune [RFC3973][RFC4601] */
39 #define PIM_TYPE_BOOTSTRAP 4 /* Bootstrap [RFC4601] */
40 #define PIM_TYPE_ASSERT 5 /* Assert [RFC3973][RFC4601] */
41 #define PIM_TYPE_GRAFT 6 /* Graft [RFC3973] */
42 #define PIM_TYPE_GRAFT_ACK 7 /* Graft-Ack [RFC3973] */
43 #define PIM_TYPE_CAND_RP_ADV 8 /* Candidate RP Advertisement [RFC4601] */
44 #define PIM_TYPE_STATE_REFRESH 9 /* State Refresh [RFC3973] */
45 #define PIM_TYPE_DF_ELECT 10 /* DF Election [RFC5015] */
46 #define PIM_TYPE_ECMP_REDIR 11 /* ECMP Redirect [RFC6754] */
47 #define PIM_TYPE_PFM 12 /* PIM PFM [RFC8364] */
48 #define PIM_TYPE_PACKED_REGISTER 13 /* PIM PFM [RFC9465] */
50 /* PIM Message Subtypes */
52 #define PIM_TYPE_PACKED_NULL_REGISTER 0 /* 13.0 */
53 #define PIM_TYPE_PACKED_REGISTER_STOP 1 /* 13.1 */
55 /* PIM Message hello options */
57 #define PIM_HELLO_HOLD_T 1 /* Hold Time [RFC7761] */
58 #define PIM_HELLO_LAN_PRUNE_DELAY 2 /* LAN Prune Delay [RFC3973] */
59 #define PIM_HELLO_LABEL_PARA 17 /* Label Parameters [Dino_Farinacci] */
60 #define PIM_HELLO_DEPRECATED_18 18 /* Deprecated */
61 #define PIM_HELLO_DR_PRIORITY 19 /* DR Priority [RFC7761] */
62 #define PIM_HELLO_GEN_ID 20 /* Generation ID [RFC3973] */
63 #define PIM_HELLO_STATE_REFRESH 21 /* State-Refresh [RFC3973] */
64 #define PIM_HELLO_BIDIR_CAPA 22 /* Bidirectional Capable [RFC5015] */
65 #define PIM_HELLO_VCI_CAPA 23 /* VCI Capability */
66 #define PIM_HELLO_VAR_ADDR_LST 24 /* variable Address List [RF7761] */
67 #define PIM_HELLO_VAR_NEIG_LST 25 /* variable Neighbor List TLV */
68 #define PIM_HELL0_JOIN_ATTR 26 /* Join Attribute [RFC5384] */
69 #define PIM_HELLO_O_TCP_CAPA 27 /* variable PIM-over-TCP-Capable [RFC6559] */
70 #define PIM_HELLO_O_SCTP_CAPA 28 /* variable PIM-over-SCTP-Capable [RFC6559] */
71 #define PIM_HELLO_VAR_POP_COUNT 29 /* variable Pop-Count [RFC6807] */
72 #define PIM_HELLO_MT_ID 30 /* PIM MT-ID [RFC6420] */
73 #define PIM_HELLO_INT_ID 31 /* Interface ID [RFC6395] */
74 #define PIM_HELLO_ECMP_REDIR 32 /* PIM ECMP Redirect Hello Option [RFC6754] */
75 #define PIM_HELLO_VPC_PEER_ID 33 /* 2 vPC Peer ID */
76 #define PIM_HELLO_DR_LB_CAPA 34 /* variable DR Load Balancing Capability [RFC8775] */
77 #define PIM_HELLO_DR_LB_LIST 35 /* variable DR Load Balancing List [RFC8775] */
78 #define PIM_HELLO_HIER_JP_ATTR 36 /* Hierarchical Join/Prune Attribute [RFC7887] */
79 #define PIM_HELLO_ADDR_LST 65001 /* Address list, old implementation */
80 #define PIM_HELLO_RPF_PROXY 65004 /* RPF Proxy Vector (Cisco proprietary) */
84 #define PIM_PFM_GROUP_SOURCE 1 /* Source Group Holdtime [RFC8364] */
87 /* PIM BIDIR DF election messages */
89 #define PIM_BDIR_DF_OFFER 1
90 #define PIM_BDIR_DF_WINNER 2
91 #define PIM_BDIR_DF_BACKOFF 3
92 #define PIM_BDIR_DF_PASS 4
94 /* PIM Address Encoding Types */
96 #define PIM_ADDR_ET_NATIVE 0 /* RFC7761 */
97 #define PIM_ADDR_ET_NATIVE_JA 1 /* RFC5384 */
99 #define PIM_TRANSPORT_MODE_MULTICAST 0 /*RFC8059*/
100 #define PIM_TRANSPORT_MODE_UNICAST_REPLICATION 1 /*RFC8059*/
102 #define PIM_JOIN_ATTRIBUTE_TYPE_RPF 0 /* RFC5496 */
103 #define PIM_JOIN_ATTRIBUTE_TYPE_MVPN 1 /* RFC6513 */
104 #define PIM_JOIN_ATTRIBUTE_TYPE_MTID 2 /* RFC6420 */
105 #define PIM_JOIN_ATTRIBUTE_TYPE_PC 3 /* RFC6807 */
106 #define PIM_JOIN_ATTRIBUTE_TYPE_EX_RPF 4 /* RFC7891 */
107 #define PIM_JOIN_ATTRIBUTE_TYPE_TA 5 /* RFC8059 */
108 #define PIM_JOIN_ATTRIBUTE_TYPE_RLOC 6 /* RFC8059 */
110 #define PIM_GROUP_ADDR_FLAGS_B 0x80
111 #define PIM_GROUP_ADDR_FLAGS_RESERVED 0x7E
112 #define PIM_GROUP_ADDR_FLAGS_Z 0x01
114 #define PIM_SOURCE_ADDR_FLAGS_RESERVED 0xF8
115 #define PIM_SOURCE_ADDR_FLAGS_S 0x04
116 #define PIM_SOURCE_ADDR_FLAGS_W 0x02
117 #define PIM_SOURCE_ADDR_FLAGS_R 0x01
119 #define PIM_SOURCE_JA_FLAGS_F 0x80
120 #define PIM_SOURCE_JA_FLAGS_E 0x40
121 #define PIM_SOURCE_JA_FLAGS_ATTR_TYPE 0x3F
123 static const value_string pimtypevals
[] = {
124 { PIM_TYPE_HELLO
, "Hello" },
125 { PIM_TYPE_REGISTER
, "Register" },
126 { PIM_TYPE_REGISTER_STOP
, "Register-stop" },
127 { PIM_TYPE_JOIN_PRUNE
, "Join/Prune" },
128 { PIM_TYPE_BOOTSTRAP
, "Bootstrap" },
129 { PIM_TYPE_ASSERT
, "Assert" },
130 { PIM_TYPE_GRAFT
, "Graft" },
131 { PIM_TYPE_GRAFT_ACK
, "Graft-Ack" },
132 { PIM_TYPE_CAND_RP_ADV
, "Candidate-RP-Advertisement" },
133 { PIM_TYPE_STATE_REFRESH
, "State-Refresh" },
134 { PIM_TYPE_DF_ELECT
, "DF election"},
135 { PIM_TYPE_ECMP_REDIR
, "ECMP redirect" },
136 { PIM_TYPE_PFM
, "PFM source discovery"},
137 { PIM_TYPE_PACKED_REGISTER
, "Packed Register"},
142 * List of subtypes for PIM message Type 13.
144 static const value_string pimtype13subtypevals
[] = {
145 { PIM_TYPE_PACKED_NULL_REGISTER
, "Packed Null-Register" },
146 { PIM_TYPE_PACKED_REGISTER_STOP
, "Packed Register-Stop" },
150 static const value_string pimbdirdfvals
[] = {
151 { PIM_BDIR_DF_OFFER
, "offer"},
152 { PIM_BDIR_DF_WINNER
, "DF Winner"},
153 { PIM_BDIR_DF_BACKOFF
, "DF Backoff"},
154 { PIM_BDIR_DF_PASS
, "DF Pass"},
158 static const value_string pim_opt_vals
[] = {
159 { PIM_HELLO_HOLD_T
, "Hold Time" },
160 { PIM_HELLO_LAN_PRUNE_DELAY
, "LAN Prune Delay" },
161 { PIM_HELLO_LABEL_PARA
, "Label Parameters" },
162 { PIM_HELLO_DEPRECATED_18
, "Deprecated" },
163 { PIM_HELLO_DR_PRIORITY
, "DR Priority" },
164 { PIM_HELLO_GEN_ID
, "Generation ID" },
165 { PIM_HELLO_STATE_REFRESH
, "State-Refresh" },
166 { PIM_HELLO_BIDIR_CAPA
, "Bidirectional Capable" },
167 { PIM_HELLO_VCI_CAPA
, "VCI Capability" },
168 { PIM_HELLO_VAR_ADDR_LST
, "Address List" },
169 { PIM_HELLO_VAR_NEIG_LST
, "Neighbor List TLV" },
170 { PIM_HELL0_JOIN_ATTR
, "Join Attribute" },
171 { PIM_HELLO_O_TCP_CAPA
, "PIM-over-TCP-Capable" },
172 { PIM_HELLO_O_SCTP_CAPA
, "PIM-over-SCTP-Capable" },
173 { PIM_HELLO_VAR_POP_COUNT
, "Pop-Count" },
174 { PIM_HELLO_MT_ID
, "PIM MT-ID" },
175 { PIM_HELLO_INT_ID
, "Interface ID" },
176 { PIM_HELLO_ECMP_REDIR
, "PIM ECMP Redirect Hello Option" },
177 { PIM_HELLO_VPC_PEER_ID
, "vPC Peer ID" },
178 { PIM_HELLO_DR_LB_CAPA
, "DR Load Balancing Capability" },
179 { PIM_HELLO_DR_LB_LIST
, "DR Load Balancing List" },
180 { PIM_HELLO_HIER_JP_ATTR
, "Hierarchical Join/Prune Attribute" },
181 { PIM_HELLO_ADDR_LST
, "Address list, old implementation" },
182 { PIM_HELLO_RPF_PROXY
, "RPF Proxy Vector (Cisco proprietary)" },
186 static const value_string pim_opt_vals1
[] = {
187 { PIM_PFM_GROUP_SOURCE
, "Group Source Holdtime TLV" },
193 static const value_string pim_addr_et_vals
[] = {
194 { PIM_ADDR_ET_NATIVE
, "Native"},
195 { PIM_ADDR_ET_NATIVE_JA
, "Native with Join Attribute"},
199 static const value_string attribute_transport_mode
[] = {
200 {PIM_TRANSPORT_MODE_UNICAST_REPLICATION
, "Unicast Replication"},
201 {PIM_TRANSPORT_MODE_MULTICAST
, "Multicast"},
204 static const value_string pim_join_attribute_type_vals
[] = {
205 { PIM_JOIN_ATTRIBUTE_TYPE_RPF
, "RPF Vector TLV"},
206 { PIM_JOIN_ATTRIBUTE_TYPE_MVPN
, "MVPN Join Attribute"},
207 { PIM_JOIN_ATTRIBUTE_TYPE_MTID
, "MT-ID Join Attribute"},
208 { PIM_JOIN_ATTRIBUTE_TYPE_PC
, "Pop-Count"},
209 { PIM_JOIN_ATTRIBUTE_TYPE_EX_RPF
, "Explicit RPF Vector"},
210 { PIM_JOIN_ATTRIBUTE_TYPE_TA
, "Transport Attribute"},
211 { PIM_JOIN_ATTRIBUTE_TYPE_RLOC
, "Receiver RLOC Attribute"},
215 enum pimv2_addrtype
{
216 pimv2_unicast
, pimv2_group
, pimv2_source
219 static int proto_pim
;
220 static int hf_pim_version
;
221 static int hf_pim_type
;
222 static int hf_pim_code
;
223 static int hf_pim_igmp_type
;
224 static int hf_pim_df_elect_subtype
;
225 static int hf_pim_df_elect_rsvd
;
226 static int hf_pim_cksum
;
227 static int hf_pim_cksum_status
;
228 static int hf_pim_res_bytes
;
229 static int hf_pim_reg_stop_p_bit
;
230 static int hf_pim_type_13_subtype
;
231 static int hf_pim_type_13_flagbits
;
232 /* PIM Hello options (RFC 4601, section 4.9.2 and RFC 3973, section 4.7.5) */
233 static int hf_pim_option
;
234 static int hf_pim_optiontype
;
235 static int hf_pim_optionlength
;
236 static int hf_pim_optionvalue
;
237 static int hf_pim_register_flag
;
238 static int hf_pim_register_flag_border
;
239 static int hf_pim_register_flag_null_register
;
240 static int hf_pim_mode
;
241 static int hf_pim_holdtime
;
242 static int hf_pim_holdtime_t
;
243 static int hf_pim_numgroups
;
244 static int hf_pim_numjoins
;
245 static int hf_pim_numprunes
;
247 static int hf_pim_propagation_delay
;
248 static int hf_pim_override_interval
;
249 static int hf_pim_dr_priority
;
250 static int hf_pim_generation_id
;
251 static int hf_pim_state_refresh_version
;
252 static int hf_pim_state_refresh_interval
;
253 static int hf_pim_state_refresh_reserved
;
255 static int hf_pim_rpt
;
256 static int hf_pim_metric_pref
;
257 static int hf_pim_df_metric_pref
;
258 static int hf_pim_metric
;
259 static int hf_pim_prune_indicator
;
260 static int hf_pim_prune_now
;
261 static int hf_pim_assert_override
;
262 static int hf_pim_ip_version
;
263 static int hf_pim_dummy_header
;
264 static int hf_pim_source_ip4
;
265 static int hf_pim_source_ip6
;
266 static int hf_pim_group_ip4
;
267 static int hf_pim_group_ip6
;
268 static int hf_pim_group_mask_ip4
;
269 static int hf_pim_upstream_neighbor_ip4
;
270 static int hf_pim_upstream_neighbor_ip6
;
271 static int hf_pim_join_ip4
;
272 static int hf_pim_join_ip6
;
273 static int hf_pim_prune_ip4
;
274 static int hf_pim_prune_ip6
;
275 static int hf_pim_address_list_ip4
;
276 static int hf_pim_address_list_ip6
;
277 static int hf_pim_bsr_ip4
;
278 static int hf_pim_bsr_ip6
;
279 static int hf_pim_rp_ip4
;
280 static int hf_pim_rp_ip6
;
281 static int hf_pim_bd_bo_offer_ip4
;
282 static int hf_pim_bd_bo_offer_ip6
;
283 static int hf_pim_bd_offer_metric_pref
;
284 static int hf_pim_bd_offer_metric
;
285 static int hf_pim_bd_offer_interval
;
286 static int hf_pim_bd_pass_ip4
;
287 static int hf_pim_bd_pass_ip6
;
288 static int hf_pim_bd_pass_metric_pref
;
289 static int hf_pim_bd_pass_metric
;
290 static int hf_pim_originator_ip4
;
291 static int hf_pim_originator_ip6
;
292 static int hf_pim_group_address_ip4
;
293 static int hf_pim_fragment_tag
;
294 static int hf_pim_hash_mask_len
;
295 static int hf_pim_bsr_priority
;
296 static int hf_pim_rp_count
;
297 static int hf_pim_frp_count
;
298 static int hf_pim_priority
;
299 static int hf_pim_prefix_count
;
300 static int hf_pim_addr_len
;
301 static int hf_pim_src_flags_a
;
302 static int hf_pim_src_flags_s
;
303 static int hf_pim_src_flags_w
;
304 static int hf_pim_src_flags_r
;
305 static int hf_pim_src_flags_rsv
;
306 static int hf_pim_mask_len
;
307 static int hf_pim_addr_af
;
308 static int hf_pim_addr_et
;
309 static int hf_pim_unicast_addr_ipv4
;
310 static int hf_pim_unicast_addr_ipv6
;
311 static int hf_pim_rloc_addr_ipv4
;
312 static int hf_pim_rloc_addr_ipv6
;
313 static int hf_pim_attribute_transport_mode
;
314 static int hf_pim_group
;
315 static int hf_pim_group_addr_flags
;
316 static int hf_pim_group_addr_flags_b
;
317 static int hf_pim_group_addr_flags_reserved
;
318 static int hf_pim_group_addr_flags_z
;
319 static int hf_pim_source_addr_flags
;
320 static int hf_pim_source_addr_flags_reserved
;
321 static int hf_pim_source_addr_flags_s
;
322 static int hf_pim_source_addr_flags_w
;
323 static int hf_pim_source_addr_flags_r
;
324 static int hf_pim_source_join_attribute
;
325 static int hf_pim_source_ja_flags
;
326 static int hf_pim_source_ja_flags_f
;
327 static int hf_pim_source_ja_flags_e
;
328 static int hf_pim_source_ja_flags_attr_type
;
329 static int hf_pim_source_ja_length
;
330 static int hf_pim_source_ja_value
;
331 static int hf_pim_ttl
;
332 static int hf_pim_interval
;
333 static int hf_pim_srcount
;
334 static int hf_pim_srcholdt
;
335 static int hf_pim_transitivetype
;
336 static int hf_pim_optiontype1
;
337 static int hf_pfm_no_forward_bit
;
340 static int ett_pim_opts
;
341 static int ett_pim_opt
;
342 static int ett_pim_addr_flags
;
344 static expert_field ei_pim_cksum
;
346 static dissector_handle_t pim_handle
;
347 static dissector_handle_t pimv1_handle
;
349 static dissector_handle_t ip_handle
;
350 static dissector_handle_t ipv6_handle
;
352 static bool use_main_tree
= true;
355 * The Story About Ping^WPIM:
357 * http://www.cs.usc.edu/assets/003/83187.pdf
359 * dated January 11, 1995, entitled "Protocol Independent Multicast (PIM):
360 * Protocol Specification", calls itself draft-ietf-idmr-pim-spec-01,
361 * and is in PostScript-converted-to-PDF form. It describes a protocol
362 * that runs atop IGMP, with a type of 4 for "Router PIM Messages", and
363 * a PIM version number field of 1.
365 * https://tools.ietf.org/html/draft-ietf-idmr-pim-sm-spec-00
367 * dated September 7, 1995, and
369 * https://tools.ietf.org/html/draft-ietf-idmr-pim-spec-02
371 * dated September 7, 1995, both entitled "Protocol Independent Multicast-
372 * Sparse Mode (PIM-SM): Protocol Specification", describe a protocol that
373 * runs atop IGMP, with a type of 4 for "Router PIM Messages", and a PIM
374 * version number field of 2.
376 * https://tools.ietf.org/html/draft-ietf-idmr-pim-sm-spec-03
378 * dated June 6, 1996, and all subsequent drafts, and RFC 2117, dated
379 * June 1997, all entitled "Protocol Independent Multicast-Sparse Mode
380 * (PIM-SM): Protocol Specification", describe a protocol that runs
381 * atop IP, with a protocol number of 103, and with a PIM version number
382 * field of 2. RFC 2117 was obsoleted by RFC 2362, which was obsoleted by
385 * None of them, including the PDF from USC, appear to describe the protocol
386 * dissected by the dissect_pimv1() code. In particular, none have a
387 * packet type value of 8 meaning "Mode"; the PDF from USC doesn't mention
388 * it at all, and subsequent drafts and RFC 2117 have (Candidate-)RP-
389 * Advertisement. Perhaps what's dissected by dissect_pimv1() was
390 * something between the PDF and draft-ietf-idmr-pim-spec-02.
392 * Looking at the Dense Mode specs,
394 * https://tools.ietf.org/html/draft-ietf-idmr-pim-dm-spec-02
396 * entitled "Protocol Independent Multicast-Dense Mode (PIM-DM): Protocol
397 * Specification", dated September 1995, describes a protocol that runs
398 * atop IGMP, with a type of 4 for "Router PIM Messages", and with a PIM
399 * version number field of 2.
401 * RFC 3973, entitled "Protocol Independent Multicast-Dense Mode (PIM-DM):
402 * Protocol Specification", also describes a protocol that runs atop IP,
403 * with a protocol number of 103, and with a PIM version number field of 2.
405 static int * const pim_src_flags_fields
[] = {
410 &hf_pim_src_flags_rsv
,
414 static int * const pim_group_addr_flags
[] = {
415 &hf_pim_group_addr_flags_b
,
416 &hf_pim_group_addr_flags_reserved
,
417 &hf_pim_group_addr_flags_z
,
421 static int * const pim_source_addr_flags
[] = {
422 &hf_pim_source_addr_flags_reserved
,
423 &hf_pim_source_addr_flags_s
,
424 &hf_pim_source_addr_flags_w
,
425 &hf_pim_source_addr_flags_r
,
429 static int * const pim_source_ja_flags
[] = {
430 &hf_pim_source_ja_flags_f
,
431 &hf_pim_source_ja_flags_e
,
432 &hf_pim_source_ja_flags_attr_type
,
437 dissect_pimv1_addr(tvbuff_t
*tvb
, int offset
, proto_tree
*pim_tree
, int hf_ip
) {
439 proto_tree_add_bitmask_list(pim_tree
, tvb
, offset
, 1, pim_src_flags_fields
, ENC_BIG_ENDIAN
);
442 proto_tree_add_item(pim_tree
, hf_pim_mask_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
445 proto_tree_add_item(pim_tree
, hf_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
449 static const value_string pim_type1_vals
[] = {
452 { 2, "Register-stop" },
454 { 4, "RP-Reachable" },
462 static const value_string pimv1_modevals
[] = {
465 { 2, "Sparse-Dense" },
469 static const value_string pim_ip_version_vals
[] = {
470 { 0, "Dummy Header" },
476 static const value_string unique_infinity
[] = {
477 { 0xffff, "Infinity" },
481 static const value_string unique_infinity_t
[] = {
483 { 0xffff, "Infinity" },
487 /* This function is only called from the IGMP dissector */
489 dissect_pimv1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
) {
492 unsigned length
, pim_length
;
494 proto_tree
*pim_tree
= NULL
;
496 proto_tree
*pimopt_tree
= NULL
;
499 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "PIMv1");
500 col_clear(pinfo
->cinfo
, COL_INFO
);
502 ti
= proto_tree_add_item(tree
, proto_pim
, tvb
, offset
, -1, ENC_NA
);
503 pim_tree
= proto_item_add_subtree(ti
, ett_pim
);
505 /* Put IGMP type, 0x14, into the tree */
506 proto_tree_add_string(pim_tree
, hf_pim_igmp_type
, tvb
, offset
, 0, "PIM (0x14)");
510 pim_type
= tvb_get_uint8(tvb
, offset
);
511 col_add_str(pinfo
->cinfo
, COL_INFO
,
512 val_to_str(pim_type
, pim_type1_vals
, "Unknown (%u)"));
514 proto_tree_add_uint(pim_tree
, hf_pim_code
, tvb
, offset
, 1, pim_type
);
517 pim_ver
= PIM_VER(tvb_get_uint8(tvb
, offset
+ 2));
519 proto_tree_add_checksum(pim_tree
, tvb
, offset
, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
, pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
522 * Not PIMv1; should we bother dissecting the PIM drafts
523 * with a version number of 2 and with PIM running atop
527 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
528 return offset
+tvb_reported_length_remaining(tvb
, offset
);
532 * Well, it's PIM v1, so we can check whether this is a
533 * Register message, and thus can figure out how much to
534 * checksum and whether to make the columns read-only.
536 length
= tvb_reported_length(tvb
);
539 * Register message - the PIM header is 8 bytes long.
540 * Also set the columns non-writable. Otherwise the IPv4 or
541 * IPv6 dissector for the encapsulated packet that caused
542 * this register will overwrite the PIM info in the columns.
544 * XXX - that's not what draft-ietf-idmr-pim-spec-01 or
545 * draft-ietf-idmr-pim-spec-02 say; they say that the checksum
546 * covers the entire IGMP message. Later drafts say it
547 * doesn't cover the encapsulated packet; perhaps that's what
548 * was always intended, and they just felt they needed to
549 * explicitly state that.
552 col_set_writable(pinfo
->cinfo
, -1, false);
555 * Other message - checksum the entire packet.
560 if (!pinfo
->fragmented
&& length
>= pim_length
&&
561 tvb_captured_length(tvb
) >= pim_length
) {
563 * The packet isn't part of a fragmented datagram and isn't
564 * truncated, so we can checksum it.
566 SET_CKSUM_VEC_TVB(cksum_vec
[0], tvb
, 0, pim_length
);
567 proto_tree_add_checksum(pim_tree
, tvb
, offset
, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
568 pinfo
, in_cksum(&cksum_vec
[0], 1), ENC_BIG_ENDIAN
, PROTO_CHECKSUM_VERIFY
|PROTO_CHECKSUM_IN_CKSUM
);
570 proto_tree_add_checksum(pim_tree
, tvb
, offset
, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
571 pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
575 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
579 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
, 3, ENC_NA
);
582 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
584 subitem
= proto_tree_add_item(pim_tree
, hf_pim_option
, tvb
, offset
, -1, ENC_NA
);
585 pimopt_tree
= proto_item_add_subtree(subitem
, ett_pim_opts
);
589 /* version 1 decoder */
593 proto_tree_add_item(pimopt_tree
, hf_pim_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
596 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
601 case 1: /* register */
607 * The rest of the packet is a multicast data packet.
609 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
612 * It's an IP packet - determine whether it's IPv4 or IPv6.
614 v_hl
= tvb_get_uint8(tvb
, offset
);
615 proto_tree_add_item(pimopt_tree
, hf_pim_ip_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
617 switch((v_hl
& 0xf0) >> 4) {
618 case 0: /* Null-Register dummy header.
619 * Has the same address family as the encapsulating PIM packet,
620 * e.g. an IPv6 data packet is encapsulated in IPv6 PIM packet.
622 ti
= proto_tree_add_item(pimopt_tree
, hf_pim_dummy_header
, tvb
, offset
, -1, ENC_NA
);
623 if (pinfo
->src
.type
== AT_IPv4
) {
624 proto_item_append_text(ti
, " IPv4");
625 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
626 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
+ 16, 4, ENC_BIG_ENDIAN
);
627 } else if (pinfo
->src
.type
== AT_IPv6
) {
628 proto_item_append_text(ti
, " IPv6");
629 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip6
, tvb
, offset
+ 8, 16, ENC_NA
);
630 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip6
, tvb
, offset
+ 8 + 16, 16, ENC_NA
);
632 proto_item_append_text(ti
, " for an unknown protocol");
637 call_dissector(ip_handle
, next_tvb
, pinfo
, tree
);
639 call_dissector(ip_handle
, next_tvb
, pinfo
, pimopt_tree
);
644 call_dissector(ipv6_handle
, next_tvb
, pinfo
, tree
);
646 call_dissector(ipv6_handle
, next_tvb
, pinfo
, pimopt_tree
);
655 case 2: /* register-stop */
657 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
659 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
664 case 3: /* join/prune */
666 case 7: /* graft-ack */
669 int ngroup
, i
, njoin
, nprune
, j
;
670 proto_tree
*grouptree
= NULL
;
672 proto_tree
*subtree
= NULL
;
675 proto_tree_add_item(pimopt_tree
, hf_pim_upstream_neighbor_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
679 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
, 2, ENC_NA
);
682 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
686 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
, 1, ENC_NA
);
689 proto_tree_add_item(pimopt_tree
, hf_pim_mask_len
, tvb
, offset
, 1, ENC_NA
);
692 proto_tree_add_item(pimopt_tree
, hf_pim_addr_len
, tvb
, offset
, 1, ENC_NA
);
695 ngroup
= tvb_get_uint8(tvb
, offset
);
696 proto_tree_add_item(pimopt_tree
, hf_pim_numgroups
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
699 for (i
= 0; i
< ngroup
; i
++) {
701 * XXX - does the group address have the length "adr_len"
702 * and the group mask the length "mask_len"?
704 tigroup
= proto_tree_add_ipv4_format(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
, 4,
705 tvb_get_ipv4(tvb
, offset
), "Group %d: %s", i
, tvb_ip_to_str(pinfo
->pool
, tvb
, offset
));
706 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
709 proto_tree_add_ipv4_format(grouptree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4,
710 tvb_get_ipv4(tvb
, offset
), "Group %d Mask: %s", i
, tvb_ip_to_str(pinfo
->pool
, tvb
, offset
));
713 njoin
= tvb_get_ntohs(tvb
, offset
);
714 nprune
= tvb_get_ntohs(tvb
, offset
+ 2);
715 tisub
= proto_tree_add_item(grouptree
, hf_pim_numjoins
, tvb
,
716 offset
, 2, ENC_BIG_ENDIAN
);
717 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
719 for (j
= 0; j
< njoin
; j
++) {
720 dissect_pimv1_addr(tvb
, off
, subtree
, hf_pim_join_ip4
);
724 tisub
= proto_tree_add_item(grouptree
, hf_pim_numprunes
, tvb
,
725 offset
+ 2, 2, ENC_BIG_ENDIAN
);
726 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
727 for (j
= 0; j
< nprune
; j
++) {
728 dissect_pimv1_addr(tvb
, off
, subtree
, hf_pim_prune_ip4
);
736 case 4: /* rp-reachability */
738 proto_tree_add_item(pimopt_tree
, hf_pim_group_address_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
741 proto_tree_add_item(pimopt_tree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
744 proto_tree_add_item(pimopt_tree
, hf_pim_rp_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
748 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
, 2, ENC_NA
);
751 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
759 proto_tree_add_item(pimopt_tree
, hf_pim_group_address_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
762 proto_tree_add_item(pimopt_tree
, hf_pim_group_mask_ip4
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
765 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
766 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
767 offset
, 4, ENC_BIG_ENDIAN
);
770 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
783 // NOLINTNEXTLINE(misc-no-recursion)
784 dissect_pim_addr(packet_info
*pinfo
, proto_tree
* tree
, tvbuff_t
*tvb
, int offset
, enum pimv2_addrtype at
,
785 const char* label
, proto_item
** ret_item
, int hf_ip4
, int hf_ip6
, int *advance
) {
786 uint8_t af
, et
, flags
, mask_len
, ja_af
;
789 proto_item
* ti
= NULL
;
790 proto_tree
* addr_tree
= NULL
;
791 proto_item
*rloc_tree
= NULL
;
792 proto_tree
*rloc_sub_tree
= NULL
;
793 proto_tree
* ja_tree
= NULL
;
796 uint8_t ja_eos_type
= 0;
797 uint8_t ja_length
= 0;
798 int ja_length_sum
= 0;
800 af
= tvb_get_uint8(tvb
, offset
);
801 if (af
!= AFNUM_INET
&& af
!= AFNUM_INET6
) {
803 * We don't handle the other formats, and addresses don't include
804 * a length field, so we can't even show them as raw bytes.
809 et
= tvb_get_uint8(tvb
, offset
+ 1);
810 if ((et
!= PIM_ADDR_ET_NATIVE
) && (et
!= PIM_ADDR_ET_NATIVE_JA
)) {
812 * The only defined encoding type is 0 and 1, for the native encoding
813 * and native with Join Attribute TLVs;
814 * again, as addresses don't include a length field, we can't
815 * even show addresses with a different encoding type as raw
826 ipv4
= tvb_get_ipv4(tvb
, offset
+ 2);
829 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 2 + len
,
830 ipv4
, "%s: %s", label
, tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 2));
834 ti
= proto_tree_add_ipv4(tree
, hf_ip4
, tvb
, offset
, 2 + len
, ipv4
);
840 tvb_get_ipv6(tvb
, offset
+ 2, &ipv6
);
843 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 2 + len
,
844 &ipv6
, "%s: %s", label
, tvb_ip6_to_str(pinfo
->pool
, tvb
, offset
+ 2));
848 ti
= proto_tree_add_ipv6(tree
, hf_ip6
, tvb
, offset
, 2 + len
, &ipv6
);
852 addr_tree
= proto_item_add_subtree(ti
, ett_pim
);
853 proto_tree_add_item(addr_tree
, hf_pim_addr_af
, tvb
, offset
, 1, ENC_NA
);
854 proto_tree_add_item(addr_tree
, hf_pim_addr_et
, tvb
, offset
+1, 1, ENC_NA
);
857 proto_tree_add_item(addr_tree
, hf_pim_unicast_addr_ipv4
, tvb
, offset
+2, 4, ENC_BIG_ENDIAN
);
860 proto_tree_add_item(addr_tree
, hf_pim_unicast_addr_ipv6
, tvb
, offset
+2, 16, ENC_NA
);
863 if (et
== PIM_ADDR_ET_NATIVE_JA
){
864 ja_offset
= offset
+ len
+ 2;
865 while (((ja_eos_type
& 0x40) != 0x40) && (tvb_reported_length_remaining(tvb
, ja_offset
) >= 2)){
866 ja_length
= tvb_get_uint8(tvb
, ja_offset
+1);
867 ti
= proto_tree_add_item(addr_tree
, hf_pim_source_join_attribute
, tvb
, ja_offset
, ja_length
+ 2, ENC_NA
);
868 ja_tree
= proto_item_add_subtree(ti
, ett_pim
);
869 ja_eos_type
= tvb_get_uint8(tvb
, ja_offset
);
870 proto_tree_add_bitmask(ja_tree
, tvb
, ja_offset
, hf_pim_source_ja_flags
,
871 ett_pim_addr_flags
, pim_source_ja_flags
, ENC_BIG_ENDIAN
);
872 proto_item_append_text(ti
, ": %s", val_to_str_const(ja_eos_type
& 0x3F, pim_join_attribute_type_vals
, "Unknown"));
874 proto_tree_add_item(ja_tree
, hf_pim_source_ja_length
, tvb
, ja_offset
, 1, ENC_BIG_ENDIAN
);
876 switch(ja_eos_type
& 0x3F){
877 case PIM_JOIN_ATTRIBUTE_TYPE_TA
:
878 proto_tree_add_item(ja_tree
, hf_pim_attribute_transport_mode
, tvb
, ja_offset
, 1, ENC_NA
);
880 case PIM_JOIN_ATTRIBUTE_TYPE_RLOC
:
881 ja_af
= tvb_get_uint8(tvb
, offset
);
884 rloc_tree
= proto_tree_add_ipv4_format(ja_tree
, hf_ip4
, tvb
, ja_offset
, ja_length
,
885 ipv4
, "RLOC: %s", tvb_ip_to_str(pinfo
->pool
, tvb
, ja_offset
+ 1));
886 rloc_sub_tree
= proto_item_add_subtree(rloc_tree
, ett_pim
);
887 proto_tree_add_item(rloc_sub_tree
, hf_pim_addr_af
, tvb
, ja_offset
, 1, ENC_NA
);
888 proto_tree_add_item(rloc_sub_tree
, hf_pim_rloc_addr_ipv4
, tvb
, ja_offset
+ 1, 4, ENC_BIG_ENDIAN
);
891 rloc_tree
= proto_tree_add_ipv6_format(ja_tree
, hf_ip6
, tvb
, ja_offset
, ja_length
,
892 &ipv6
, "RLOC: %s", tvb_ip_to_str(pinfo
->pool
, tvb
, ja_offset
+ 1));
893 rloc_sub_tree
= proto_item_add_subtree(rloc_tree
, ett_pim
);
894 proto_tree_add_item(rloc_sub_tree
, hf_pim_addr_af
, tvb
, ja_offset
, 1, ENC_NA
);
895 proto_tree_add_item(rloc_sub_tree
, hf_pim_rloc_addr_ipv6
, tvb
, ja_offset
+ 1, 16, ENC_NA
);
902 ja_offset
+= ja_length
;
903 ja_length_sum
+= (2 + (int)ja_length
);
905 *advance
= 2 + len
+ ja_length_sum
;
912 mask_len
= tvb_get_uint8(tvb
, offset
+ 3);
916 ipv4
= tvb_get_ipv4(tvb
, offset
+ 4);
919 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 4 + len
,
920 ipv4
, "%s: %s", label
, tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 4));
924 ti
= proto_tree_add_ipv4(tree
, hf_ip4
, tvb
, offset
, 4 + len
, ipv4
);
927 proto_item_append_text(ti
, "/%u", mask_len
);
932 tvb_get_ipv6(tvb
, offset
+ 4, &ipv6
);
935 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 4 + len
,
936 &ipv6
, "%s: %s", label
, tvb_ip6_to_str(pinfo
->pool
, tvb
, offset
+ 4));
940 ti
= proto_tree_add_ipv6(tree
, hf_ip6
, tvb
, offset
, 4 + len
, &ipv6
);
942 proto_item_append_text(ti
, "/%u", mask_len
);
945 addr_tree
= proto_item_add_subtree(ti
, ett_pim
);
946 proto_tree_add_item(addr_tree
, hf_pim_addr_af
, tvb
, offset
, 1, ENC_NA
);
947 proto_tree_add_item(addr_tree
, hf_pim_addr_et
, tvb
, offset
+1, 1, ENC_NA
);
948 proto_tree_add_bitmask(addr_tree
, tvb
, offset
+2, hf_pim_group_addr_flags
,
949 ett_pim_addr_flags
, pim_group_addr_flags
, ENC_BIG_ENDIAN
);
950 proto_tree_add_item(addr_tree
, hf_pim_mask_len
, tvb
, offset
+3, 1, ENC_NA
);
953 proto_tree_add_item(addr_tree
, hf_pim_group_ip4
, tvb
, offset
+4, 4, ENC_BIG_ENDIAN
);
956 proto_tree_add_item(addr_tree
, hf_pim_group_ip6
, tvb
, offset
+4, 16, ENC_NA
);
963 flags
= tvb_get_uint8(tvb
, offset
+ 2);
964 mask_len
= tvb_get_uint8(tvb
, offset
+ 3);
968 ipv4
= tvb_get_ipv4(tvb
, offset
+ 4);
971 ti
= proto_tree_add_ipv4_format(tree
, hf_ip4
, tvb
, offset
, 4 + len
,
972 ipv4
, "%s: %s", label
, tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 4));
976 ti
= proto_tree_add_ipv4_format_value(tree
, hf_ip4
, tvb
, offset
, 4 + len
, ipv4
,
977 "%s", tvb_ip_to_str(pinfo
->pool
, tvb
, offset
+ 4));
979 proto_item_append_text(ti
, "/%u", mask_len
);
984 tvb_get_ipv6(tvb
, offset
+ 4, &ipv6
);
987 ti
= proto_tree_add_ipv6_format(tree
, hf_ip6
, tvb
, offset
, 4 + len
,
988 &ipv6
, "%s: %s", label
, tvb_ip6_to_str(pinfo
->pool
, tvb
, offset
+ 4));
992 ti
= proto_tree_add_ipv6_format_value(tree
, hf_ip6
, tvb
, offset
, 4 + len
, &ipv6
,
993 "%s", tvb_ip6_to_str(pinfo
->pool
, tvb
, offset
+ 4));
995 proto_item_append_text(ti
, "/%u", mask_len
);
999 proto_item_append_text(ti
, " (%s%s%s)",
1000 flags
& 0x04 ? "S" : "",
1001 flags
& 0x02 ? "W" : "",
1002 flags
& 0x01 ? "R" : "");
1004 addr_tree
= proto_item_add_subtree(ti
, ett_pim
);
1005 proto_tree_add_item(addr_tree
, hf_pim_addr_af
, tvb
, offset
, 1, ENC_NA
);
1006 proto_tree_add_item(addr_tree
, hf_pim_addr_et
, tvb
, offset
+1, 1, ENC_NA
);
1007 proto_tree_add_bitmask(addr_tree
, tvb
, offset
+2, hf_pim_source_addr_flags
,
1008 ett_pim_addr_flags
, pim_source_addr_flags
, ENC_BIG_ENDIAN
);
1009 proto_tree_add_item(addr_tree
, hf_pim_mask_len
, tvb
, offset
+3, 1, ENC_NA
);
1012 proto_tree_add_item(addr_tree
, hf_pim_source_ip4
, tvb
, offset
+4, 4, ENC_BIG_ENDIAN
);
1015 proto_tree_add_item(addr_tree
, hf_pim_source_ip6
, tvb
, offset
+4, 16, ENC_NA
);
1019 if (et
== PIM_ADDR_ET_NATIVE_JA
) {
1020 ja_offset
= offset
+ 4 + len
;
1021 while (((ja_eos_type
& 0x40) != 0x40) && (tvb_reported_length_remaining(tvb
, ja_offset
) >= 2)) {
1022 ja_length
= tvb_get_uint8(tvb
, ja_offset
+1);
1023 ti
= proto_tree_add_item(addr_tree
, hf_pim_source_join_attribute
, tvb
, ja_offset
, ja_length
+ 2, ENC_NA
);
1024 ja_tree
= proto_item_add_subtree(ti
, ett_pim
);
1025 ja_eos_type
= tvb_get_uint8(tvb
, ja_offset
);
1026 proto_tree_add_bitmask(ja_tree
, tvb
, ja_offset
, hf_pim_source_ja_flags
,
1027 ett_pim_addr_flags
, pim_source_ja_flags
, ENC_BIG_ENDIAN
);
1028 proto_item_append_text(ti
, ": %s", val_to_str_const(ja_eos_type
& 0x3F, pim_join_attribute_type_vals
, "Unknown"));
1030 proto_tree_add_item(ja_tree
, hf_pim_source_ja_length
, tvb
, ja_offset
, 1, ENC_BIG_ENDIAN
);
1032 switch(ja_eos_type
& 0x3F) {
1033 case PIM_JOIN_ATTRIBUTE_TYPE_RPF
:
1034 if ((ja_length
== 6) || (ja_length
== 18)) {
1036 // We recurse here, but we'll run out of packet before we run out of stack.
1037 if (!dissect_pim_addr(pinfo
, ja_tree
, tvb
, ja_offset
, pimv2_unicast
, NULL
, NULL
,
1038 hf_pim_unicast_addr_ipv4
, hf_pim_unicast_addr_ipv6
, &advance_attr
))
1041 proto_tree_add_item(ja_tree
, hf_pim_source_ja_value
, tvb
, ja_offset
, ja_length
, ENC_NA
);
1044 case PIM_JOIN_ATTRIBUTE_TYPE_RLOC
:
1045 ja_af
= tvb_get_uint8(tvb
, offset
);
1048 rloc_tree
= proto_tree_add_ipv4_format(ja_tree
, hf_ip4
, tvb
, ja_offset
, ja_length
,
1049 ipv4
, "RLOC: %s", tvb_ip_to_str(pinfo
->pool
, tvb
, ja_offset
+ 1));
1050 rloc_sub_tree
= proto_item_add_subtree(rloc_tree
, ett_pim
);
1051 proto_tree_add_item(rloc_sub_tree
, hf_pim_addr_af
, tvb
, ja_offset
, 1, ENC_NA
);
1052 proto_tree_add_item(rloc_sub_tree
, hf_pim_rloc_addr_ipv4
, tvb
, ja_offset
+ 1, 4, ENC_BIG_ENDIAN
);
1055 rloc_tree
= proto_tree_add_ipv6_format(ja_tree
, hf_ip6
, tvb
, ja_offset
, ja_length
,
1056 &ipv6
, "RLOC: %s", tvb_ip_to_str(pinfo
->pool
, tvb
, ja_offset
+ 1));
1057 rloc_sub_tree
= proto_item_add_subtree(rloc_tree
, ett_pim
);
1058 proto_tree_add_item(rloc_sub_tree
, hf_pim_addr_af
, tvb
, ja_offset
, 1, ENC_NA
);
1059 proto_tree_add_item(rloc_sub_tree
, hf_pim_rloc_addr_ipv6
, tvb
, ja_offset
+ 1, 16, ENC_NA
);
1064 proto_tree_add_item(ja_tree
, hf_pim_source_ja_value
, tvb
, ja_offset
, ja_length
, ENC_NA
);
1066 ja_offset
+= ja_length
;
1067 ja_length_sum
+= (2 + (int)ja_length
);
1070 *advance
= 4 + len
+ ja_length_sum
;
1077 if (ret_item
!= NULL
)
1085 * For PIM v2, see RFC 4601, RFC 3973 and draft-ietf-pim-sm-v2-new-03
1086 * (when PIM is run over IPv6, the rules for computing the PIM checksum
1087 * from the draft in question, not from RFC 2362, should be used).
1090 dissect_pim(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
) {
1092 uint8_t pim_typever
;
1093 uint8_t pim_subtype
;
1094 uint8_t pim_bidir_subtype
= 0;
1095 unsigned length
, pim_length
;
1098 const char *typestr
;
1099 proto_tree
*pim_tree
= NULL
;
1101 proto_tree
*pimopt_tree
= NULL
;
1104 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "PIM");
1105 col_clear(pinfo
->cinfo
, COL_INFO
);
1107 pim_typever
= tvb_get_uint8(tvb
, 0);
1108 pim_subtype
= PIM_SUBTYPE(tvb_get_uint8(tvb
, 1));
1110 switch (PIM_VER(pim_typever
)) {
1112 if (PIM_TYPE(pim_typever
) < 12) {
1113 typestr
= val_to_str(PIM_TYPE(pim_typever
), pimtypevals
, "Unknown (%u)");
1114 } else if ((PIM_TYPE(pim_typever
) == PIM_TYPE_PACKED_REGISTER
)) {
1116 * Need only the first 4 bits for subtype as per the new PIM Common header.
1118 typestr
= val_to_str(pim_subtype
, pimtype13subtypevals
, "Unknown (%u)");
1120 typestr
= "Unknown";
1123 case 1: /* PIMv1 - we should never see this */
1125 typestr
= "Unknown";
1129 col_add_fstr(pinfo
->cinfo
, COL_PROTOCOL
, "PIMv%d",
1130 PIM_VER(pim_typever
));
1131 col_add_str(pinfo
->cinfo
, COL_INFO
, typestr
);
1133 ti
= proto_tree_add_item(tree
, proto_pim
, tvb
, offset
, -1, ENC_NA
);
1134 pim_tree
= proto_item_add_subtree(ti
, ett_pim
);
1136 proto_tree_add_item(pim_tree
, hf_pim_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1137 proto_tree_add_item(pim_tree
, hf_pim_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1138 if (PIM_TYPE(pim_typever
) == PIM_TYPE_PFM
) {
1139 proto_tree_add_item(pim_tree
, hf_pfm_no_forward_bit
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
1141 if (PIM_TYPE(pim_typever
) == PIM_TYPE_REGISTER_STOP
) {
1143 * [version-4bits][type-4bits][0x01]
1145 proto_tree_add_item(pim_tree
, hf_pim_reg_stop_p_bit
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
1147 if (PIM_TYPE(pim_typever
) == PIM_TYPE_DF_ELECT
) {
1148 proto_tree_add_item(pim_tree
, hf_pim_df_elect_subtype
, tvb
, offset
+ 1, 1, ENC_BIG_ENDIAN
);
1149 proto_tree_add_item(pim_tree
, hf_pim_df_elect_rsvd
, tvb
, offset
+ 1, 1, ENC_BIG_ENDIAN
);
1150 pim_bidir_subtype
= tvb_get_uint8(tvb
,offset
);
1151 } else if ((PIM_TYPE(pim_typever
) == PIM_TYPE_PACKED_REGISTER
)) {
1153 * [version-4bits][type-4bits][0x[SubType-4bits][Flagbits-4bits]
1155 proto_tree_add_item(pim_tree
, hf_pim_type_13_subtype
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
1156 proto_tree_add_item(pim_tree
, hf_pim_type_13_flagbits
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
1158 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
+ 1, 1, ENC_NA
);
1161 if (PIM_VER(pim_typever
) != 2) {
1162 proto_tree_add_checksum(pim_tree
, tvb
, offset
+2, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
1163 pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
1165 * We don't know this version, so we don't know how much of the
1166 * packet the checksum covers.
1168 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
1169 proto_tree_add_item(pim_tree
, hf_pim_option
, tvb
, offset
, -1, ENC_NA
);
1175 * Well, it's PIM v2, so we can check whether this is a Register
1176 * message, and thus can figure out how much to checksum and
1177 * whether to make the columns read-only.
1179 length
= tvb_reported_length(tvb
);
1180 if (PIM_TYPE(pim_typever
) == 1) {
1182 * Register message - the PIM header is 8 bytes long.
1183 * Also set the columns non-writable. Otherwise the IPv4 or
1184 * IPv6 dissector for the encapsulated packet that caused
1185 * this register will overwrite the PIM info in the columns.
1188 col_set_writable(pinfo
->cinfo
, -1, false);
1191 * Other message - checksum the entire packet.
1193 pim_length
= length
;
1195 if (!pinfo
->fragmented
&& length
>= pim_length
&&
1196 tvb_captured_length(tvb
) >= pim_length
) {
1198 * The packet isn't part of a fragmented datagram and isn't
1199 * truncated, so we can checksum it.
1202 switch (pinfo
->src
.type
) {
1204 SET_CKSUM_VEC_TVB(cksum_vec
[0], tvb
, 0, pim_length
);
1205 proto_tree_add_checksum(pim_tree
, tvb
, offset
+2, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
1206 pinfo
, in_cksum(&cksum_vec
[0], 1), ENC_BIG_ENDIAN
, PROTO_CHECKSUM_VERIFY
|PROTO_CHECKSUM_IN_CKSUM
);
1209 /* Set up the fields of the pseudo-header. */
1210 SET_CKSUM_VEC_PTR(cksum_vec
[0], (const uint8_t *)pinfo
->src
.data
, pinfo
->src
.len
);
1211 SET_CKSUM_VEC_PTR(cksum_vec
[1], (const uint8_t *)pinfo
->dst
.data
, pinfo
->dst
.len
);
1212 phdr
[0] = g_htonl(pim_length
);
1213 phdr
[1] = g_htonl(IP_PROTO_PIM
);
1214 SET_CKSUM_VEC_PTR(cksum_vec
[2], (const uint8_t *)&phdr
, 8);
1215 SET_CKSUM_VEC_TVB(cksum_vec
[3], tvb
, 0, pim_length
);
1216 proto_tree_add_checksum(pim_tree
, tvb
, offset
+2, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
1217 pinfo
, in_cksum(&cksum_vec
[0], 4), ENC_BIG_ENDIAN
, PROTO_CHECKSUM_VERIFY
|PROTO_CHECKSUM_IN_CKSUM
);
1220 /* PIM is available for IPv4 and IPv6 right now */
1221 DISSECTOR_ASSERT_NOT_REACHED();
1225 proto_tree_add_checksum(pim_tree
, tvb
, offset
+2, hf_pim_cksum
, hf_pim_cksum_status
, &ei_pim_cksum
,
1226 pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
1230 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
1231 tiopt
= proto_tree_add_item(pim_tree
, hf_pim_option
, tvb
, offset
, -1, ENC_NA
);
1232 pimopt_tree
= proto_item_add_subtree(tiopt
, ett_pim_opts
);
1236 /* version 2 decoder */
1237 switch (PIM_TYPE(pim_typever
)) {
1238 case PIM_TYPE_HELLO
: /*hello*/
1242 while (tvb_reported_length_remaining(tvb
, offset
) >= 2) {
1243 uint16_t hello_opt
, opt_len
;
1245 const char* hold_str
;
1246 proto_item
*opt_item
;
1247 proto_tree
*opt_tree
;
1250 hello_opt
= tvb_get_ntohs(tvb
, offset
);
1251 opt_len
= tvb_get_ntohs(tvb
, offset
+ 2);
1252 opt_tree
= proto_tree_add_subtree_format(pimopt_tree
, tvb
, offset
, 4 + opt_len
,
1253 ett_pim_opt
, &opt_item
, "Option %u: %s", hello_opt
,
1254 val_to_str(hello_opt
, pim_opt_vals
, "Unknown: %u"));
1255 proto_tree_add_item(opt_tree
, hf_pim_optiontype
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1256 proto_tree_add_item(opt_tree
, hf_pim_optionlength
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
1259 case PIM_HELLO_HOLD_T
: /* Hello Hold Time Option */
1261 proto_tree_add_item_ret_uint(opt_tree
, hf_pim_holdtime_t
, tvb
,
1262 offset
+4, 2, ENC_BIG_ENDIAN
, &holdtime
);
1263 proto_item_append_text(opt_item
, ": %u", holdtime
);
1264 hold_str
= try_val_to_str(holdtime
, unique_infinity_t
);
1265 if (hold_str
!= NULL
)
1266 proto_item_append_text(opt_item
, " (%s)", hold_str
);
1270 case PIM_HELLO_LAN_PRUNE_DELAY
: /* LAN Prune Delay Option */
1271 proto_tree_add_item(opt_tree
, hf_pim_t
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
1272 proto_tree_add_item(opt_tree
, hf_pim_propagation_delay
, tvb
, offset
+ 4, 2, ENC_BIG_ENDIAN
);
1273 proto_tree_add_item(opt_tree
, hf_pim_override_interval
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
1274 proto_item_append_text(opt_item
,
1275 ": T = %u, Propagation Delay = %ums, Override Interval = %ums",
1276 tvb_get_uint8(tvb
, offset
+ 4) & 0x80 ? 1 : 0,
1277 tvb_get_ntohs(tvb
, offset
+ 4) & 0x7fff,
1278 tvb_get_ntohs(tvb
, offset
+ 6));
1281 case PIM_HELLO_DR_PRIORITY
: /* DR priority */
1282 proto_tree_add_item(opt_tree
, hf_pim_dr_priority
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
1283 proto_item_append_text(opt_item
, ": %u", tvb_get_ntohl(tvb
, offset
+ 4));
1286 case PIM_HELLO_GEN_ID
: /* Generation ID */
1287 proto_tree_add_item(opt_tree
, hf_pim_generation_id
, tvb
, offset
+ 4, 4, ENC_BIG_ENDIAN
);
1288 proto_item_append_text(opt_item
, ": %u", tvb_get_ntohl(tvb
, offset
+ 4));
1291 case PIM_HELLO_STATE_REFRESH
: /* State Refresh Capable Option */
1292 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_version
, tvb
, offset
+ 4, 1, ENC_BIG_ENDIAN
);
1293 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_interval
, tvb
, offset
+ 5, 1, ENC_BIG_ENDIAN
);
1294 proto_tree_add_item(opt_tree
, hf_pim_state_refresh_reserved
, tvb
, offset
+ 6, 2, ENC_BIG_ENDIAN
);
1295 proto_item_append_text(opt_item
, ": Version = %u, Interval = %us",
1296 tvb_get_uint8(tvb
, offset
+ 4),
1297 tvb_get_uint8(tvb
, offset
+ 5));
1300 case PIM_HELLO_VAR_ADDR_LST
: /* address list */
1301 case PIM_HELLO_ADDR_LST
: /* address list (old implementations) */
1304 proto_tree
*sub_tree
= NULL
;
1306 sub_tree
= proto_tree_add_subtree_format(opt_tree
, tvb
, offset
, 4 + opt_len
,
1307 ett_pim_opt
, NULL
, "%sAddress List (%u)",
1308 hello_opt
== 65001 ? "old " : "",
1310 for (i
= offset
+ 4; i
< offset
+ 4 + opt_len
; ) {
1312 if (!dissect_pim_addr(pinfo
, sub_tree
, tvb
, i
, pimv2_unicast
, NULL
, NULL
,
1313 hf_pim_address_list_ip4
, hf_pim_address_list_ip6
, &advance
))
1322 proto_tree_add_item(opt_tree
, hf_pim_optionvalue
, tvb
,
1323 offset
+ 4, opt_len
, ENC_NA
);
1326 offset
+= 4 + opt_len
;
1328 proto_item_append_text(tiopt
, ": %u", opt_count
);
1332 case PIM_TYPE_REGISTER
: /* register */
1336 proto_tree
*flag_tree
;
1339 tiflag
= proto_tree_add_item(pimopt_tree
, hf_pim_register_flag
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1340 flag_tree
= proto_item_add_subtree(tiflag
, ett_pim
);
1341 proto_tree_add_item(flag_tree
, hf_pim_register_flag_border
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1342 proto_tree_add_item(flag_tree
, hf_pim_register_flag_null_register
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1346 * The rest of the packet is a multicast data packet.
1348 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
1351 * It's an IP packet - determine whether it's IPv4 or IPv6.
1353 v_hl
= tvb_get_uint8(tvb
, offset
);
1354 proto_tree_add_item(pimopt_tree
, hf_pim_ip_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1356 switch((v_hl
& 0xf0) >> 4) {
1357 case 0: /* Null-Register dummy header.
1358 * Has the same address family as the encapsulating PIM packet,
1359 * e.g. an IPv6 data packet is encapsulated in IPv6 PIM packet.
1361 ti
= proto_tree_add_item(pimopt_tree
, hf_pim_dummy_header
, tvb
, offset
, -1, ENC_NA
);
1362 if (pinfo
->src
.type
== AT_IPv4
) {
1363 proto_item_append_text(ti
, "IPv4");
1364 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip4
, tvb
, offset
+ 12, 4, ENC_BIG_ENDIAN
);
1365 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip4
, tvb
, offset
+ 16, 4, ENC_BIG_ENDIAN
);
1366 } else if (pinfo
->src
.type
== AT_IPv6
) {
1367 proto_item_append_text(ti
, "IPv6");
1368 proto_tree_add_item(pimopt_tree
, hf_pim_source_ip6
, tvb
, offset
+ 8, 16, ENC_NA
);
1369 proto_tree_add_item(pimopt_tree
, hf_pim_group_ip6
, tvb
, offset
+ 8 + 16, 16, ENC_NA
);
1371 proto_item_append_text(ti
, "for an unknown protocol");
1374 if (use_main_tree
) {
1375 call_dissector(ip_handle
, next_tvb
, pinfo
, tree
);
1377 call_dissector(ip_handle
, next_tvb
, pinfo
, pimopt_tree
);
1381 if (use_main_tree
) {
1382 call_dissector(ipv6_handle
, next_tvb
, pinfo
, tree
);
1384 call_dissector(ipv6_handle
, next_tvb
, pinfo
, pimopt_tree
);
1393 case PIM_TYPE_REGISTER_STOP
: /* register-stop */
1397 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
, NULL
, NULL
,
1398 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1401 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1402 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1407 case PIM_TYPE_JOIN_PRUNE
: /* join/prune */
1408 case PIM_TYPE_GRAFT
: /* graft */
1409 case PIM_TYPE_GRAFT_ACK
: /* graft-ack */
1413 int ngroup
, i
, njoin
, nprune
, j
;
1414 proto_tree
*grouptree
= NULL
;
1415 proto_item
*tigroup
;
1416 proto_tree
*subtree
= NULL
;
1419 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1420 hf_pim_upstream_neighbor_ip4
, hf_pim_upstream_neighbor_ip6
, &advance
))
1425 /* reserved field */
1426 proto_tree_add_item(pimopt_tree
, hf_pim_res_bytes
, tvb
, offset
, 1, ENC_NA
);
1429 ngroup
= tvb_get_uint8(tvb
, offset
);
1430 proto_tree_add_item(pimopt_tree
, hf_pim_numgroups
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1433 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1436 for (i
= 0; i
< ngroup
; i
++) {
1437 tigroup
=proto_tree_add_string_format(pimopt_tree
, hf_pim_group
, tvb
, offset
, -1, "", "Group %d", i
);
1438 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
1439 if (!dissect_pim_addr(pinfo
, grouptree
, tvb
, offset
, pimv2_group
,
1440 wmem_strdup_printf(pinfo
->pool
, "Group %d", i
), NULL
,
1441 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1446 njoin
= tvb_get_ntohs(tvb
, offset
);
1447 nprune
= tvb_get_ntohs(tvb
, offset
+ 2);
1448 tisub
= proto_tree_add_item(grouptree
, hf_pim_numjoins
, tvb
,
1449 offset
, 2, ENC_BIG_ENDIAN
);
1450 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
1452 for (j
= 0; j
< njoin
; j
++) {
1453 if (!dissect_pim_addr(pinfo
, subtree
, tvb
, off
, pimv2_source
, NULL
, NULL
,
1454 hf_pim_join_ip4
, hf_pim_join_ip6
, &advance
))
1460 tisub
= proto_tree_add_item(grouptree
, hf_pim_numprunes
, tvb
,
1461 offset
+ 2, 2, ENC_BIG_ENDIAN
);
1462 subtree
= proto_item_add_subtree(tisub
, ett_pim
);
1463 for (j
= 0; j
< nprune
; j
++) {
1464 if (!dissect_pim_addr(pinfo
, subtree
, tvb
, off
, pimv2_source
, NULL
, NULL
,
1465 hf_pim_prune_ip4
, hf_pim_prune_ip6
, &advance
))
1476 case PIM_TYPE_BOOTSTRAP
: /* bootstrap */
1481 proto_tree
*grouptree
= NULL
;
1482 proto_item
*tigroup
;
1484 proto_tree_add_item(pimopt_tree
, hf_pim_fragment_tag
, tvb
,
1485 offset
, 2, ENC_BIG_ENDIAN
);
1488 proto_tree_add_item(pimopt_tree
, hf_pim_hash_mask_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1490 proto_tree_add_item(pimopt_tree
, hf_pim_bsr_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1493 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1494 hf_pim_bsr_ip4
, hf_pim_bsr_ip6
, &advance
))
1498 for (i
= 0; tvb_reported_length_remaining(tvb
, offset
) > 0; i
++) {
1499 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
,
1500 wmem_strdup_printf(pinfo
->pool
, "Group %d", i
), &tigroup
,
1501 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1504 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
1507 proto_tree_add_item(grouptree
, hf_pim_rp_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1509 frpcnt
= tvb_get_uint8(tvb
, offset
);
1510 proto_tree_add_item(grouptree
, hf_pim_frp_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1513 for (j
= 0; j
< frpcnt
; j
++) {
1514 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1515 wmem_strdup_printf(pinfo
->pool
, "RP %d", j
), NULL
,
1516 hf_pim_rp_ip4
, hf_pim_rp_ip6
, &advance
))
1521 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1523 proto_tree_add_item(grouptree
, hf_pim_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1526 /* reserved stuff */
1527 proto_tree_add_item(pim_tree
, hf_pim_res_bytes
, tvb
, offset
, 1, ENC_NA
);
1536 case PIM_TYPE_ASSERT
: /* assert */
1540 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
,
1542 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1546 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1548 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1552 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1553 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
1554 offset
, 4, ENC_BIG_ENDIAN
);
1557 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1562 case PIM_TYPE_CAND_RP_ADV
: /* Candidate-RP-Advertisement */
1568 pfxcnt
= tvb_get_uint8(tvb
, offset
);
1569 proto_tree_add_item(pimopt_tree
, hf_pim_prefix_count
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1571 proto_tree_add_item(pimopt_tree
, hf_pim_priority
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1574 proto_tree_add_item(pimopt_tree
, hf_pim_holdtime
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1577 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1579 hf_pim_rp_ip4
, hf_pim_rp_ip6
, &advance
))
1583 for (i
= 0; i
< pfxcnt
; i
++) {
1584 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
,
1585 wmem_strdup_printf(pinfo
->pool
, "Group %d", i
), NULL
,
1586 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1594 case PIM_TYPE_STATE_REFRESH
: /* State-Refresh */
1598 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
,
1600 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1604 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1606 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1610 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1612 hf_pim_originator_ip4
, hf_pim_originator_ip6
, &advance
))
1616 proto_tree_add_item(pimopt_tree
, hf_pim_rpt
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1617 proto_tree_add_item(pimopt_tree
, hf_pim_metric_pref
, tvb
,
1618 offset
, 4, ENC_BIG_ENDIAN
);
1621 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1624 proto_tree_add_item(pimopt_tree
, hf_pim_mask_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1627 proto_tree_add_item(pimopt_tree
, hf_pim_ttl
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1630 proto_tree_add_item(pimopt_tree
, hf_pim_prune_indicator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1631 proto_tree_add_item(pimopt_tree
, hf_pim_prune_now
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1632 proto_tree_add_item(pimopt_tree
, hf_pim_assert_override
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1635 proto_tree_add_item(pimopt_tree
, hf_pim_interval
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1641 case PIM_TYPE_DF_ELECT
:
1645 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1647 hf_pim_rp_ip4
, hf_pim_rp_ip6
, &advance
))
1650 proto_tree_add_item(pimopt_tree
, hf_pim_df_metric_pref
, tvb
,
1651 offset
, 4, ENC_BIG_ENDIAN
);
1653 proto_tree_add_item(pimopt_tree
, hf_pim_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1656 switch(PIM_BIDIR_SUBTYPE(pim_bidir_subtype
)) {
1657 case PIM_BDIR_DF_BACKOFF
:
1658 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1660 hf_pim_bd_bo_offer_ip4
, hf_pim_bd_bo_offer_ip6
, &advance
))
1663 proto_tree_add_item(pimopt_tree
, hf_pim_bd_offer_metric_pref
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1665 proto_tree_add_item(pimopt_tree
, hf_pim_bd_offer_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1667 proto_tree_add_item(pimopt_tree
, hf_pim_bd_offer_interval
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1669 case PIM_BDIR_DF_PASS
:
1670 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
,
1672 hf_pim_bd_pass_ip4
, hf_pim_bd_pass_ip6
, &advance
))
1675 proto_tree_add_item(pimopt_tree
, hf_pim_bd_pass_metric_pref
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1677 proto_tree_add_item(pimopt_tree
, hf_pim_bd_pass_metric
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1683 case PIM_TYPE_PFM
: /*pfm*/
1688 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1689 hf_pim_originator_ip4
, hf_pim_originator_ip6
, &advance
))
1692 while (tvb_reported_length_remaining(tvb
, offset
) >= 2) {
1693 uint16_t pfm
, pfm_opt
, opt_len
;
1694 proto_item
*opt_item
;
1695 proto_tree
*opt_tree
;
1698 pfm
= tvb_get_ntohs(tvb
, offset
);
1699 opt_len
= tvb_get_ntohs(tvb
, offset
+ 2);
1700 pfm_opt
= pfm
& 0x7FFF;
1701 opt_tree
= proto_tree_add_subtree_format(pimopt_tree
, tvb
, offset
, 4 + opt_len
,
1702 ett_pim_opt
, &opt_item
, "Option %u: %s", pfm_opt
,
1703 val_to_str(pfm_opt
, pim_opt_vals1
, "Unknown: %u"));
1704 proto_tree_add_item(opt_tree
, hf_pim_transitivetype
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1705 proto_tree_add_item(opt_tree
, hf_pim_optiontype1
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1706 proto_tree_add_item(opt_tree
, hf_pim_optionlength
, tvb
, offset
+ 2, 2, ENC_BIG_ENDIAN
);
1709 case PIM_PFM_GROUP_SOURCE
:
1711 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_group
, NULL
, NULL
,
1712 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1716 src_count
=tvb_get_ntohs(tvb
, offset
);
1717 proto_tree_add_item(pimopt_tree
, hf_pim_srcount
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1719 proto_tree_add_item(pimopt_tree
, hf_pim_srcholdt
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1722 if (!dissect_pim_addr(pinfo
, pimopt_tree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1723 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1732 proto_tree_add_item(opt_tree
, hf_pim_optionvalue
, tvb
,
1733 offset
, opt_len
, ENC_NA
);
1738 proto_item_append_text(tiopt
, ": %u", opt_count
);
1743 case PIM_TYPE_PACKED_REGISTER
: /* Packed Register */
1747 proto_tree
*grouptree
= NULL
;
1748 proto_item
*tigroup
;
1750 switch (pim_subtype
) {
1751 case PIM_TYPE_PACKED_NULL_REGISTER
:
1752 case PIM_TYPE_PACKED_REGISTER_STOP
:
1754 * Total length minus PIM header length
1755 * divided by 1 encoded record size (14 bytes).
1757 ngroups
= (length
-4)/14;
1758 for (i
= 0; i
< ngroups
; i
++) {
1760 * RFC9465 states that an (S,G) entry is called a "Record".
1762 tigroup
=proto_tree_add_string_format(pimopt_tree
, hf_pim_group
, tvb
, offset
, -1, "", "Record %d", i
+1);
1763 grouptree
= proto_item_add_subtree(tigroup
, ett_pim
);
1764 if (!dissect_pim_addr(pinfo
, grouptree
, tvb
, offset
, pimv2_group
,
1765 wmem_strdup_printf(pinfo
->pool
, "Group"), NULL
,
1766 hf_pim_group_ip4
, hf_pim_group_ip6
, &advance
))
1767 goto breakpackedreg
;
1769 if (!dissect_pim_addr(pinfo
, grouptree
, tvb
, offset
, pimv2_unicast
, NULL
, NULL
,
1770 hf_pim_source_ip4
, hf_pim_source_ip6
, &advance
))
1771 goto breakpackedreg
;
1786 return tvb_captured_length(tvb
);
1790 proto_register_pim(void)
1792 static hf_register_info hf
[] =
1795 { "Version", "pim.version",
1796 FT_UINT8
, BASE_DEC
, NULL
, 0xf0,
1800 { "Type", "pim.type",
1801 FT_UINT8
, BASE_DEC
, VALS(pimtypevals
), 0x0f,
1804 { &hf_pim_df_elect_subtype
,
1805 { "DF Subtype", "pim.df_elect.subtype",
1806 FT_UINT8
, BASE_DEC
, VALS(pimbdirdfvals
), 0xf0,
1809 { &hf_pim_df_elect_rsvd
,
1810 { "DF reserved", "pim.df_elect.rsvd",
1811 FT_UINT8
, BASE_DEC
, NULL
, 0x0f,
1814 { &hf_pim_igmp_type
,
1815 { "Type", "pim.igmp_type",
1816 FT_STRING
, BASE_NONE
, NULL
, 0x0,
1820 { "Code", "pim.code",
1821 FT_UINT8
, BASE_DEC
, VALS(pim_type1_vals
), 0x0,
1825 { "Checksum", "pim.cksum",
1826 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
1829 { &hf_pim_cksum_status
,
1830 { "Checksum Status", "pim.cksum.status",
1831 FT_UINT8
, BASE_NONE
, VALS(proto_checksum_vals
), 0x0,
1834 { &hf_pim_res_bytes
,
1835 { "Reserved byte(s)", "pim.res_bytes",
1836 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1839 { &hf_pim_type_13_subtype
,
1840 { "Subtype", "pim.subtype_type13",
1841 FT_UINT8
, BASE_DEC
, VALS(pimtype13subtypevals
), 0xf0,
1844 { &hf_pim_type_13_flagbits
,
1845 { "Flag Bits", "pim.flag_bits_type13",
1846 FT_UINT8
, BASE_DEC
, NULL
, 0x0f,
1851 { "PIM Options", "pim.option",
1852 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1855 { &hf_pim_optiontype
,
1856 { "Type", "pim.optiontype",
1857 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1860 { &hf_pim_optiontype1
,
1861 { "Type", "pim.optiontype",
1862 FT_UINT16
, BASE_DEC
, NULL
, 0x7fff,
1865 { &hf_pim_optionlength
,
1866 { "Length", "pim.optionlength",
1867 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1870 { &hf_pim_optionvalue
,
1871 { "Unknown", "pim.optionvalue",
1872 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1875 { &hf_pim_register_flag
,
1876 { "Flags", "pim.register_flag",
1877 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1880 { &hf_pim_register_flag_border
,
1881 { "Border", "pim.register_flag.border",
1882 FT_BOOLEAN
, 32, TFS(&tfs_yes_no
), 0x80000000,
1885 { &hf_pim_register_flag_null_register
,
1886 { "Null-Register", "pim.register_flag.null_register",
1887 FT_BOOLEAN
, 32, TFS(&tfs_yes_no
), 0x40000000,
1891 { "Mode", "pim.mode",
1892 FT_UINT8
, BASE_DEC
, VALS(pimv1_modevals
), 0xf0,
1896 { "Holdtime", "pim.holdtime",
1897 FT_UINT16
, BASE_DEC
|BASE_SPECIAL_VALS
, VALS(unique_infinity
), 0x0,
1898 "The amount of time a receiver must keep the neighbor "
1899 "reachable, in seconds.", HFILL
}
1901 { &hf_pim_holdtime_t
,
1902 { "Holdtime", "pim.holdtime",
1903 FT_UINT16
, BASE_DEC
|BASE_SPECIAL_VALS
, VALS(unique_infinity_t
), 0x0,
1904 "The amount of time a receiver must keep the neighbor "
1905 "reachable, in seconds.", HFILL
}
1907 { &hf_pim_numgroups
,
1908 { "Num Groups", "pim.numgroups",
1909 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1910 "Number of multicast group sets contained in the message.",
1914 { "Num Joins", "pim.numjoins",
1915 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1916 "Number of joined sources.", HFILL
}
1918 { &hf_pim_numprunes
,
1919 { "Num Prunes", "pim.numprunes",
1920 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1921 "Number of pruned sources.", HFILL
}
1925 FT_BOOLEAN
, 8, NULL
, 0x80,
1926 "Specifies the ability of the sending router to disable joins "
1927 "suppression.", HFILL
}
1929 { &hf_pim_propagation_delay
,
1930 { "Propagation Delay", "pim.propagation_delay",
1931 FT_UINT16
, BASE_DEC
, NULL
, 0x7fff,
1932 "Units are milli-seconds", HFILL
}
1934 { &hf_pim_override_interval
,
1935 { "Override Interval", "pim.override_interval",
1936 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1937 "Units are milli-seconds", HFILL
}
1939 { &hf_pim_dr_priority
,
1940 { "DR Priority", "pim.dr_priority",
1941 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1944 { &hf_pim_generation_id
,
1945 { "Generation ID", "pim.generation_id",
1946 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1949 { &hf_pim_state_refresh_version
,
1950 { "Version", "pim.state_refresh_version",
1951 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1954 { &hf_pim_state_refresh_interval
,
1955 { "Interval", "pim.state_refresh_interval",
1956 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1957 "Units in seconds.", HFILL
}
1959 { &hf_pim_state_refresh_reserved
,
1960 { "Reserved", "pim.state_refresh_reserved",
1961 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1965 { "RP Tree", "pim.rpt",
1966 FT_BOOLEAN
, 8, NULL
, 0x80,
1967 "Set to 1 for assert(*,G) messages and 0 for assert(S,G) "
1968 "messages.", HFILL
}
1970 { &hf_pim_metric_pref
,
1971 { "Metric Preference", "pim.metric_pref",
1972 FT_UINT32
, BASE_DEC
, NULL
, 0x7fffffff,
1975 { &hf_pim_df_metric_pref
,
1976 { "DF Metric Preference", "pim.metric_pref",
1977 FT_UINT32
, BASE_DEC
, NULL
, 0,
1981 { "Metric", "pim.metric",
1982 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1985 { &hf_pim_prune_indicator
,
1986 { "Prune indicator", "pim.prune_indicator",
1987 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x80,
1990 { &hf_pim_prune_now
,
1991 { "Prune now", "pim.prune_now",
1992 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x40,
1995 { &hf_pim_assert_override
,
1996 { "Assert override", "pim.assert_override",
1997 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x20,
2000 { &hf_pim_ip_version
,
2001 { "IP Version", "pim.ip_version",
2002 FT_UINT8
, BASE_DEC
, VALS(pim_ip_version_vals
), 0xF0,
2005 { &hf_pim_dummy_header
,
2006 { "Dummy Header", "pim.dummy_header",
2007 FT_NONE
, BASE_NONE
, NULL
, 0,
2010 { &hf_pim_source_ip4
,
2011 { "Source", "pim.source",
2012 FT_IPv4
, BASE_NONE
, NULL
, 0,
2015 { &hf_pim_source_ip6
,
2016 { "Source", "pim.source_ip6",
2017 FT_IPv6
, BASE_NONE
, NULL
, 0,
2020 { &hf_pim_group_ip4
,
2021 { "Group", "pim.group",
2022 FT_IPv4
, BASE_NONE
, NULL
, 0,
2025 { &hf_pim_group_mask_ip4
,
2026 { "Mask", "pim.group_mask",
2027 FT_IPv4
, BASE_NONE
, NULL
, 0,
2030 { &hf_pim_group_ip6
,
2031 { "Group", "pim.group_ip6",
2032 FT_IPv6
, BASE_NONE
, NULL
, 0,
2035 { &hf_pim_upstream_neighbor_ip4
,
2036 { "Upstream-neighbor", "pim.upstream_neighbor",
2037 FT_IPv4
, BASE_NONE
, NULL
, 0,
2040 { &hf_pim_upstream_neighbor_ip6
,
2041 { "Upstream-neighbor", "pim.upstream_neighbor_ip6",
2042 FT_IPv6
, BASE_NONE
, NULL
, 0,
2046 { "IP address", "pim.join_ip",
2047 FT_IPv4
, BASE_NONE
, NULL
, 0,
2051 { "IP address", "pim.join_ip6",
2052 FT_IPv6
, BASE_NONE
, NULL
, 0,
2055 { &hf_pim_prune_ip4
,
2056 { "IP address", "pim.prune_ip",
2057 FT_IPv4
, BASE_NONE
, NULL
, 0,
2060 { &hf_pim_prune_ip6
,
2061 { "IP address", "pim.prune_ip6",
2062 FT_IPv6
, BASE_NONE
, NULL
, 0,
2065 { &hf_pim_address_list_ip4
,
2066 { "Address", "pim.address_list",
2067 FT_IPv4
, BASE_NONE
, NULL
, 0,
2070 { &hf_pim_address_list_ip6
,
2071 { "Address", "pim.address_list_ip6",
2072 FT_IPv6
, BASE_NONE
, NULL
, 0,
2077 FT_IPv4
, BASE_NONE
, NULL
, 0,
2081 { "BSR", "pim.bsr_ip6",
2082 FT_IPv6
, BASE_NONE
, NULL
, 0,
2087 FT_IPv4
, BASE_NONE
, NULL
, 0,
2091 { "RP", "pim.rp_ip6",
2092 FT_IPv6
, BASE_NONE
, NULL
, 0,
2095 { &hf_pim_originator_ip4
,
2096 { "Originator", "pim.originator",
2097 FT_IPv4
, BASE_NONE
, NULL
, 0,
2100 { &hf_pim_originator_ip6
,
2101 { "Originator", "pim.originator_ip6",
2102 FT_IPv6
, BASE_NONE
, NULL
, 0,
2105 { &hf_pim_group_address_ip4
,
2106 { "Group Address", "pim.group_address",
2107 FT_IPv4
, BASE_NONE
, NULL
, 0,
2110 { &hf_pim_bd_pass_ip4
,
2111 { "New Winner IP", "pim.bidir_winner_ip4",
2112 FT_IPv4
, BASE_NONE
, NULL
, 0,
2115 { &hf_pim_bd_pass_ip6
,
2116 { "New Winner IP", "pim.bidir_winner_ip6",
2117 FT_IPv6
, BASE_NONE
, NULL
, 0,
2120 { &hf_pim_bd_pass_metric_pref
,
2121 { "Winner Metric Preference", "pim.bidir_win_metric_pref",
2122 FT_UINT32
, BASE_DEC
, NULL
, 0,
2125 { &hf_pim_bd_pass_metric
,
2126 { "Winner Metric", "pim.bidir_win_metric",
2127 FT_UINT32
, BASE_DEC
, NULL
, 0,
2130 { &hf_pim_bd_bo_offer_ip4
,
2131 { "Offering IP", "pim.bidir_offering_ip4",
2132 FT_IPv4
, BASE_NONE
, NULL
, 0,
2135 { &hf_pim_bd_bo_offer_ip6
,
2136 { "Offering IP", "pim.bidir_offering_ip6",
2137 FT_IPv6
, BASE_NONE
, NULL
, 0,
2140 { &hf_pim_bd_offer_metric_pref
,
2141 { "Offering Metric Preference", "pim.bidir_off_metric_pref",
2142 FT_UINT32
, BASE_DEC
, NULL
, 0,
2145 { &hf_pim_bd_offer_metric
,
2146 { "Offering Metric", "pim.bidir_off_metric",
2147 FT_UINT32
, BASE_DEC
, NULL
, 0,
2150 { &hf_pim_bd_offer_interval
,
2151 { "Offering interval (ms)", "pim.bidir_offering_interval",
2152 FT_UINT16
, BASE_DEC
, NULL
, 0,
2155 { &hf_pim_fragment_tag
,
2156 { "Fragment tag", "pim.fragment_tag",
2157 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
2160 { &hf_pim_hash_mask_len
,
2161 { "Hash mask len", "pim.hash_mask_len",
2162 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2165 { &hf_pim_bsr_priority
,
2166 { "BSR priority", "pim.bsr_priority",
2167 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2171 { "RP count", "pim.rp_count",
2172 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2175 { &hf_pim_frp_count
,
2176 { "FRP count", "pim.frp_count",
2177 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2181 { "Priority", "pim.priority",
2182 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2185 { &hf_pim_prefix_count
,
2186 { "Prefix-count", "pim.prefix_count",
2187 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2190 { &hf_pim_src_flags_a
,
2191 { "Annotated", "pim.src_flags.a",
2192 FT_UINT8
, BASE_DEC
, NULL
, 0x08,
2195 { &hf_pim_src_flags_s
,
2196 { "Sparse", "pim.src_flags.s",
2197 FT_UINT8
, BASE_DEC
, NULL
, 0x04,
2200 { &hf_pim_src_flags_w
,
2201 { "WC", "pim.src_flags.w",
2202 FT_UINT8
, BASE_DEC
, NULL
, 0x02,
2205 { &hf_pim_src_flags_r
,
2206 { "RP", "pim.src_flags.r",
2207 FT_UINT8
, BASE_DEC
, NULL
, 0x01,
2210 { &hf_pim_src_flags_rsv
,
2211 { "Reserved", "pim.src_flags.rsv",
2212 FT_UINT8
, BASE_DEC
, NULL
, 0xF0,
2216 { "Masklen", "pim.mask_len",
2217 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2221 { "Address Len", "pim.addr_len",
2222 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2227 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2231 { "Interval", "pim.interval",
2232 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2236 { "Address Family", "pim.addr_address_family",
2237 FT_UINT8
, BASE_DEC
, VALS(afn_vals
), 0x0,
2241 { "Encoding Type", "pim.addr_encoding_type",
2242 FT_UINT8
, BASE_DEC
, VALS(pim_addr_et_vals
), 0x0,
2245 { &hf_pim_unicast_addr_ipv4
,
2246 { "Unicast", "pim.unicast",
2247 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
2250 { &hf_pim_unicast_addr_ipv6
,
2251 { "Unicast", "pim.unicast_ipv6",
2252 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
2255 { &hf_pim_attribute_transport_mode
,
2256 { "Attribute Transport Mode", "pim.attribute_transport_mode",
2257 FT_UINT8
, BASE_DEC
, VALS(attribute_transport_mode
), 0x0,
2260 { &hf_pim_rloc_addr_ipv4
,
2261 { "RLOC", "pim.rloc",
2262 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
2265 { &hf_pim_rloc_addr_ipv6
,
2266 { "RLOC", "pim.rloc_ipv6",
2267 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
2271 { "Group", "pim.group_set",
2272 FT_STRING
, BASE_NONE
, NULL
, 0x0,
2275 { &hf_pim_group_addr_flags
,
2276 { "Flags", "pim.group_addr.flags",
2277 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
2280 { &hf_pim_group_addr_flags_b
,
2281 { "Bidirectional PIM", "pim.group_addr.flags.b",
2282 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_GROUP_ADDR_FLAGS_B
,
2285 { &hf_pim_group_addr_flags_reserved
,
2286 { "Reserved", "pim.group_addr.flags.reserved",
2287 FT_UINT8
, BASE_HEX
, NULL
, PIM_GROUP_ADDR_FLAGS_RESERVED
,
2290 { &hf_pim_group_addr_flags_z
,
2291 { "Admin Scope Zone", "pim.group_addr.flags.z",
2292 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_GROUP_ADDR_FLAGS_Z
,
2295 { &hf_pim_source_addr_flags
,
2296 { "Flags", "pim.source_addr.flags",
2297 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
2300 { &hf_pim_source_addr_flags_reserved
,
2301 { "Reserved", "pim.source_addr.flags.reserved",
2302 FT_UINT8
, BASE_HEX
, NULL
, PIM_SOURCE_ADDR_FLAGS_RESERVED
,
2305 { &hf_pim_source_addr_flags_s
,
2306 { "Sparse", "pim.source_addr.flags.s",
2307 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_SOURCE_ADDR_FLAGS_S
,
2310 { &hf_pim_source_addr_flags_w
,
2311 { "WildCard", "pim.source_addr.flags.w",
2312 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_SOURCE_ADDR_FLAGS_W
,
2315 { &hf_pim_source_addr_flags_r
,
2316 { "Rendezvous Point Tree", "pim.source_addr.flags.r",
2317 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_SOURCE_ADDR_FLAGS_R
,
2320 { &hf_pim_source_join_attribute
,
2321 { "Join Attribute", "pim.source_ja",
2322 FT_NONE
, BASE_NONE
, NULL
, 0x0,
2325 { &hf_pim_source_ja_flags
,
2326 { "Flags", "pim.source_ja.flags",
2327 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
2330 { &hf_pim_source_ja_flags_f
,
2331 { "Forward", "pim.source_ja.flags.f",
2332 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_SOURCE_JA_FLAGS_F
,
2335 { &hf_pim_source_ja_flags_e
,
2336 { "End of Attributes", "pim.source_ja.flags.e",
2337 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), PIM_SOURCE_JA_FLAGS_E
,
2340 { &hf_pim_source_ja_flags_attr_type
,
2341 { "Attribute Type", "pim.source_ja.flags.attr_type",
2342 FT_UINT8
, BASE_DEC
, VALS(pim_join_attribute_type_vals
), PIM_SOURCE_JA_FLAGS_ATTR_TYPE
,
2345 { &hf_pim_source_ja_length
,
2346 { "Length", "pim.source_ja.length",
2347 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
2350 { &hf_pim_source_ja_value
,
2351 { "Value", "pim.source_ja.value",
2352 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
2356 { "Source Count", "pim.srccount",
2357 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2358 "Number of sources.", HFILL
}
2361 { "Source Holdtime", "pim.srcholdtime",
2362 FT_UINT16
, BASE_DEC
|BASE_SPECIAL_VALS
, VALS(unique_infinity_t
), 0x0,
2363 "The amount of time a receiver must keep the source reachable, in seconds.", HFILL
}
2365 { &hf_pim_transitivetype
,
2366 { "Transitive Type", "pim.transitivetype",
2367 FT_BOOLEAN
, 8, NULL
, 0x80,
2368 "Set to 1 if this type is to be forwarded even if a router does not support it.", HFILL
}
2370 { &hf_pfm_no_forward_bit
,
2371 { "Pfm no forward bit", "pim.pfmnoforwardbit",
2372 FT_BOOLEAN
, 8, NULL
, 0x80,
2373 "When set, this bit means that the PFM message is not to be forwarded.", HFILL
}
2375 { &hf_pim_reg_stop_p_bit
,
2376 { "P-bit", "pim.packedregstoppbit",
2377 FT_BOOLEAN
, 8, NULL
, 0x01,
2378 "RP is indicating Register-Packing capability (RFC9465).", HFILL
}
2382 static int *ett
[] = {
2384 &ett_pim_opts
, /* Tree for all options */
2385 &ett_pim_opt
, /* Tree for each option */
2386 &ett_pim_addr_flags
/* Tree for flags */
2389 static ei_register_info ei
[] = {
2390 { &ei_pim_cksum
, { "pim.bad_checksum", PI_CHECKSUM
, PI_ERROR
, "Bad checksum", EXPFILL
}},
2393 expert_module_t
* expert_pim
;
2394 module_t
*pim_module
;
2396 proto_pim
= proto_register_protocol("Protocol Independent Multicast", "PIM", "pim");
2397 proto_register_field_array(proto_pim
, hf
, array_length(hf
));
2398 proto_register_subtree_array(ett
, array_length(ett
));
2399 expert_pim
= expert_register_protocol(proto_pim
);
2400 expert_register_field_array(expert_pim
, ei
, array_length(ei
));
2402 pim_handle
= register_dissector("pim", dissect_pim
, proto_pim
);
2403 pimv1_handle
= register_dissector("pimv1", dissect_pimv1
, proto_pim
);
2405 pim_module
= prefs_register_protocol(proto_pim
, NULL
);
2406 prefs_register_bool_preference(pim_module
, "payload_tree",
2407 "PIM payload shown on main tree",
2408 "Whether the PIM payload is shown off of the main tree or encapsulated within the PIM options",
2414 proto_reg_handoff_pim(void)
2416 dissector_add_uint("ip.proto", IP_PROTO_PIM
, pim_handle
);
2417 dissector_add_uint("igmp.type", IGMP_V1_PIM_ROUTING_MESSAGE
, pimv1_handle
);
2420 * Get handles for the IPv4 and IPv6 dissectors.
2422 ip_handle
= find_dissector_add_dependency("ip", proto_pim
);
2423 ipv6_handle
= find_dissector_add_dependency("ipv6", proto_pim
);
2427 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2432 * indent-tabs-mode: nil
2435 * vi: set shiftwidth=4 tabstop=8 expandtab:
2436 * :indentSize=4:tabSize=8:noTabs=true: