HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-igmp.c
blob0a531f085d8eafdd9df3dc6e639ad9dc260b8a14
1 /* packet-igmp.c
2 * Routines for IGMP packet disassembly
3 * 2001 Ronnie Sahlberg
4 * 2007 Thomas Morin
5 * <See AUTHORS for emails>
7 * $Id$
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 IGMP is defined in the following RFCs
29 RFC988 Version 0 Obsolete
30 RFC1054 Version 1
31 RFC1112 Version 1 (same as RFC1054 as far as we are concerned)
32 RFC2236 Version 2
33 RFC3376 Version 3
35 Size in bytes for each packet
36 type RFC988 RFC1054 RFC2236 RFC3376 DVMRP MRDISC MSNIP IGAP RGMP
37 v0 v1 v2 v3 v1/v3
38 0x01 20
39 0x02 20
40 0x03 20
41 0x04 20
42 0x05 20
43 0x06 20
44 0x07 20
45 0x08 20
46 0x11 8* 8* >=12
47 0x12 8* 8*
48 0x13 x
49 0x16 8
50 0x17 8
51 0x22 >=8
52 0x23 >=8b
53 0x24 >=8a 8b
54 0x25 4a >=8b
55 0x26 4a
56 0x40 ??c
57 0x41 ??c
58 0x42 ??c
59 0xfc 8
60 0xfd 8
61 0xfe 8
62 0xff 8
64 * Differs in second byte of protocol. Always 0 in V1
67 Multicast traceroute was taken from
68 draft-ietf-idmr-traceroute-ipm-07.txt
70 Size in bytes for each packet
71 type draft-ietf-idmr-traceroute-ipm-07.ps
72 0x1e 24 + n*32
73 0x1f 24 + n*32 (n == 0 for Query)
75 x DVMRP Protocol see packet-dvmrp.c
77 DVMRP is defined in the following RFCs
78 RFC1075 Version 1
79 draft-ietf-idmr-dvmrp-v3-10.txt Version 3
81 V1 and V3 can be distinguished by looking at bytes 6 and 7 in the
82 IGMP header.
83 If header[6]==0xff and header[7]==0x03 we have version 3.
85 a MRDISC Protocol see packet-mrdisc.c
87 MRDISC : IGMP Multicast Router DISCovery
88 draft-ietf-idmr-igmp-mrdisc-06.txt
89 TTL == 1 and IP.DST==224.0.0.2 for all packets
91 b MSNIP Protocol see packet-msnip.c
93 MSNIP : Multicast Source Notification of Interest Protocol
94 draft-ietf-idmr-msnip-00.txt
95 0x23, 0x24 are sent with ip.dst==224.0.0.22
96 0x25 is sent as unicast.
98 c IGAP Protocol see packet-igap.c
100 IGAP : Internet Group membership Authentication Protocol
101 draft-hayashi-igap-03.txt
103 d RGMP Protocol see packet-rgmp.c
105 RGMP : Router-port Group Management Protocol
106 RFC3488
107 TTL == 1 and IP.DST==224.0.0.25 for all packets
111 #include "config.h"
113 #include <string.h>
114 #include <glib.h>
116 #include <epan/packet.h>
117 #include <epan/to_str.h>
118 #include <epan/ipproto.h>
119 #include <epan/in_cksum.h>
120 #include "packet-igmp.h"
121 #include "packet-dvmrp.h"
122 #include "packet-pim.h"
123 #include "packet-mrdisc.h"
124 #include "packet-msnip.h"
125 #include "packet-igap.h"
126 #include "packet-rgmp.h"
128 static int proto_igmp = -1;
129 static int hf_type = -1;
130 static int hf_version = -1;
131 static int hf_group_type = -1;
132 static int hf_reply_code = -1;
133 static int hf_reply_pending = -1;
134 static int hf_checksum = -1;
135 static int hf_checksum_bad = -1;
136 static int hf_identifier = -1;
137 static int hf_access_key = -1;
138 static int hf_max_resp = -1;
139 static int hf_max_resp_exp = -1;
140 static int hf_max_resp_mant = -1;
141 static int hf_suppress = -1;
142 static int hf_qrv = -1;
143 static int hf_qqic = -1;
144 static int hf_num_src = -1;
145 static int hf_saddr = -1;
146 static int hf_num_grp_recs = -1;
147 static int hf_record_type = -1;
148 static int hf_aux_data_len = -1;
149 static int hf_maddr = -1;
150 static int hf_aux_data = -1;
151 static int hf_mtrace_max_hops = -1;
152 static int hf_mtrace_saddr = -1;
153 static int hf_mtrace_raddr = -1;
154 static int hf_mtrace_rspaddr = -1;
155 static int hf_mtrace_resp_ttl = -1;
156 static int hf_mtrace_q_id = -1;
157 static int hf_mtrace_q_arrival = -1;
158 static int hf_mtrace_q_inaddr = -1;
159 static int hf_mtrace_q_outaddr = -1;
160 static int hf_mtrace_q_prevrtr = -1;
161 static int hf_mtrace_q_inpkt = -1;
162 static int hf_mtrace_q_outpkt = -1;
163 static int hf_mtrace_q_total = -1;
164 static int hf_mtrace_q_rtg_proto = -1;
165 static int hf_mtrace_q_fwd_ttl = -1;
166 static int hf_mtrace_q_mbz = -1;
167 static int hf_mtrace_q_s = -1;
168 static int hf_mtrace_q_src_mask = -1;
169 static int hf_mtrace_q_fwd_code = -1;
171 static int ett_igmp = -1;
172 static int ett_group_record = -1;
173 static int ett_sqrv_bits = -1;
174 static int ett_max_resp = -1;
175 static int ett_mtrace_block = -1;
177 #define MC_ALL_ROUTERS 0xe0000002
178 #define MC_ALL_IGMPV3_ROUTERS 0xe0000016
179 #define MC_RGMP 0xe0000019
182 #define IGMP_V0_CREATE_GROUP_REQUEST 0x01
183 #define IGMP_V0_CREATE_GROUP_REPLY 0x02
184 #define IGMP_V0_JOIN_GROUP_REQUEST 0x03
185 #define IGMP_V0_JOIN_GROUP_REPLY 0x04
186 #define IGMP_V0_LEAVE_GROUP_REQUEST 0x05
187 #define IGMP_V0_LEAVE_GROUP_REPLY 0x06
188 #define IGMP_V0_CONFIRM_GROUP_REQUEST 0x07
189 #define IGMP_V0_CONFIRM_GROUP_REPLY 0x08
190 #define IGMP_V1_HOST_MEMBERSHIP_QUERY 0x11
191 #define IGMP_V1_HOST_MEMBERSHIP_REPORT 0x12
192 #define IGMP_DVMRP 0x13
193 #define IGMP_V1_PIM_ROUTING_MESSAGE 0x14
194 #define IGMP_V2_MEMBERSHIP_REPORT 0x16
195 #define IGMP_V2_LEAVE_GROUP 0x17
196 #define IGMP_TRACEROUTE_RESPONSE 0x1e
197 #define IGMP_TRACEROUTE_QUERY_REQ 0x1f
198 #define IGMP_V3_MEMBERSHIP_REPORT 0x22
199 #define IGMP_TYPE_0x23 0x23
200 #define IGMP_TYPE_0x24 0x24
201 #define IGMP_TYPE_0x25 0x25
202 #define IGMP_TYPE_0x26 0x26
204 #define IGMP_TRACEROUTE_HDR_LEN 24
205 #define IGMP_TRACEROUTE_RSP_LEN 32
207 static const value_string commands[] = {
208 {IGMP_V0_CREATE_GROUP_REQUEST, "Create Group Request" },
209 {IGMP_V0_CREATE_GROUP_REPLY, "Create Group Reply" },
210 {IGMP_V0_JOIN_GROUP_REQUEST, "Join Group Request" },
211 {IGMP_V0_JOIN_GROUP_REPLY, "Join Group Reply" },
212 {IGMP_V0_LEAVE_GROUP_REQUEST, "Leave Group Request" },
213 {IGMP_V0_LEAVE_GROUP_REPLY, "Leave Group Reply" },
214 {IGMP_V0_CONFIRM_GROUP_REQUEST, "Confirm Group Request" },
215 {IGMP_V0_CONFIRM_GROUP_REPLY, "Confirm Group Reply" },
216 {IGMP_V1_HOST_MEMBERSHIP_QUERY, "Membership Query" },
217 {IGMP_V1_HOST_MEMBERSHIP_REPORT,"Membership Report" },
218 {IGMP_DVMRP, "DVMRP Protocol" },
219 {IGMP_V1_PIM_ROUTING_MESSAGE, "PIM Routing Message" },
220 {IGMP_V2_MEMBERSHIP_REPORT, "Membership Report" },
221 {IGMP_V2_LEAVE_GROUP, "Leave Group" },
222 {IGMP_TRACEROUTE_RESPONSE, "Traceroute Response" },
223 {IGMP_TRACEROUTE_QUERY_REQ, "Traceroute Query or Request" },
224 {IGMP_V3_MEMBERSHIP_REPORT, "Membership Report" },
225 {0, NULL}
228 #define IGMP_V3_S 0x08
229 #define IGMP_V3_QRV_MASK 0x07
231 #define IGMP_MAX_RESP_EXP 0x70
232 #define IGMP_MAX_RESP_MANT 0x0f
234 #define IGMP_V0_GROUP_PUBLIC 0x00
235 #define IGMP_V0_GROUP_PRIVATE 0x01
237 static const value_string vs_group_type[] = {
238 {IGMP_V0_GROUP_PUBLIC, "Public Group" },
239 {IGMP_V0_GROUP_PRIVATE, "Private Group" },
240 {0, NULL}
243 #define IGMP_V0_REPLY_GRANTED 0x00
244 #define IGMP_V0_REPLY_NO_RESOURCES 0x01
245 #define IGMP_V0_REPLY_INVALID_CODE 0x02
246 #define IGMP_V0_REPLY_INVALID_GROUP 0x03
247 #define IGMP_V0_REPLY_INVALID_KEY 0x04
249 static const value_string vs_reply_code[] = {
250 {IGMP_V0_REPLY_GRANTED, "Request Granted" },
251 {IGMP_V0_REPLY_NO_RESOURCES, "Request Denied, No Resources" },
252 {IGMP_V0_REPLY_INVALID_CODE, "Request Denied, Invalid Code" },
253 {IGMP_V0_REPLY_INVALID_GROUP, "Request Denied, Invalid Group" },
254 {IGMP_V0_REPLY_INVALID_KEY, "Request Denied, Invalid Key" },
255 {0, NULL}
258 static const true_false_string tfs_s = {
259 "SUPPRESS router side processing",
260 "Do not suppress router side processing"
263 #define IGMP_V3_MODE_IS_INCLUDE 1
264 #define IGMP_V3_MODE_IS_EXCLUDE 2
265 #define IGMP_V3_CHANGE_TO_INCLUDE_MODE 3
266 #define IGMP_V3_CHANGE_TO_EXCLUDE_MODE 4
267 #define IGMP_V3_ALLOW_NEW_SOURCES 5
268 #define IGMP_V3_BLOCK_OLD_SOURCES 6
270 static const value_string vs_record_type[] = {
271 {IGMP_V3_MODE_IS_INCLUDE, "Mode Is Include" },
272 {IGMP_V3_MODE_IS_EXCLUDE, "Mode Is Exclude" },
273 {IGMP_V3_CHANGE_TO_INCLUDE_MODE,"Change To Include Mode" },
274 {IGMP_V3_CHANGE_TO_EXCLUDE_MODE,"Change To Exclude Mode" },
275 {IGMP_V3_ALLOW_NEW_SOURCES, "Allow New Sources" },
276 {IGMP_V3_BLOCK_OLD_SOURCES, "Block Old Sources" },
277 { 0, NULL}
280 static const value_string mtrace_rtg_vals[] = {
281 {1, "DVMRP" },
282 {2, "MOSPF" },
283 {3, "PIM" },
284 {4, "CBT" },
285 {5, "PIM using special routing table" },
286 {6, "PIM using a static route" },
287 {7, "DVMRP using a static route" },
288 {8, "PIM using MBGP (aka BGP4+) route" },
289 {9, "CBT using special routing table" },
290 {10, "CBT using a static route" },
291 {11, "PIM using state created by Assert processing" },
292 {0, NULL}
295 static const value_string mtrace_fwd_code_vals[] = {
296 {0x00, "NO_ERROR" },
297 {0x01, "WRONG_IF" },
298 {0x02, "PRUNE_SENT" },
299 {0x03, "PRUNE_RCVD" },
300 {0x04, "SCOPED" },
301 {0x05, "NO_ROUTE" },
302 {0x06, "WRONG_LAST_HOP" },
303 {0x07, "NOT_FORWARDING" },
304 {0x08, "REACHED_RP" },
305 {0x09, "RPF_IF" },
306 {0x0A, "NO_MULTICAST" },
307 {0x0B, "INFO_HIDDEN" },
308 {0x81, "NO_SPACE" },
309 {0x82, "OLD_ROUTER" },
310 {0x83, "ADMIN_PROHIB" },
311 {0, NULL}
314 #define PRINT_IGMP_VERSION(version) \
315 do { \
316 proto_item *ti; \
317 col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "IGMPv%d",version); \
318 col_add_fstr(pinfo->cinfo, COL_INFO, \
319 "%s",val_to_str(type, commands, "Unknown Type:0x%02x")); \
320 /* version of IGMP protocol */ \
321 ti = proto_tree_add_uint(tree, hf_version, tvb, 0, 0, version); \
322 PROTO_ITEM_SET_GENERATED(ti); \
323 /* type of command */ \
324 proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);\
325 offset += 1; \
326 } while (0);
328 void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
329 int hf_index_bad, packet_info *pinfo, guint len)
331 guint16 cksum, hdrcksum;
332 vec_t cksum_vec[1];
333 proto_item *hidden_item;
335 if (len == 0) {
337 * Checksum the entire IGMP packet.
339 len = tvb_reported_length(tvb);
342 hdrcksum = tvb_get_ntohs(tvb, 2);
343 if (!pinfo->fragmented && tvb_length(tvb) >= len) {
345 * The packet isn't part of a fragmented datagram and isn't
346 * truncated, so we can checksum it.
348 cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, len);
349 cksum_vec[0].len = len;
351 cksum = in_cksum(&cksum_vec[0],1);
353 if (cksum == 0) {
354 proto_tree_add_uint_format(tree, hf_index, tvb, 2, 2, hdrcksum,
355 "Header checksum: 0x%04x [correct]", hdrcksum);
356 } else {
357 hidden_item = proto_tree_add_boolean(tree, hf_index_bad,
358 tvb, 2, 2, TRUE);
359 PROTO_ITEM_SET_HIDDEN(hidden_item);
360 proto_tree_add_uint_format(tree, hf_index, tvb, 2, 2, hdrcksum,
361 "Header checksum: 0x%04x [incorrect, should be 0x%04x]",
362 hdrcksum, in_cksum_shouldbe(hdrcksum,cksum));
364 } else
365 proto_tree_add_uint(tree, hf_index, tvb, 2, 2, hdrcksum);
367 return;
371 /* Unknown IGMP message type */
372 static int
373 dissect_igmp_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
375 int len;
377 col_add_str(pinfo->cinfo, COL_INFO,
378 val_to_str(type, commands, "Unknown Type:0x%02x"));
380 /* type of command */
381 proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
382 offset += 1;
384 /* Just call the rest of it "data" */
385 len = tvb_length_remaining(tvb, offset);
386 proto_tree_add_text(tree, tvb, offset, len, "Data");
387 offset += len;
389 return offset;
394 /*************************************************************
395 * IGMP Protocol dissectors
396 *************************************************************/
397 static int
398 dissect_v3_max_resp(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
400 proto_tree *tree;
401 proto_item *item;
402 guint8 bits;
403 guint32 tsecs;
405 bits = tvb_get_guint8(tvb, offset);
406 if (bits&0x80) {
407 tsecs = ((bits&IGMP_MAX_RESP_MANT)|0x10);
408 tsecs = tsecs << ( ((bits&IGMP_MAX_RESP_EXP)>>4) + 3);
409 } else {
410 tsecs = bits;
413 item = proto_tree_add_uint_format_value(parent_tree, hf_max_resp, tvb,
414 offset, 1, tsecs, "%.1f sec (0x%02x)",tsecs*0.1,bits);
416 if (bits&0x80) {
417 tree = proto_item_add_subtree(item, ett_max_resp);
419 proto_tree_add_uint(tree, hf_max_resp_exp, tvb, offset, 1,
420 bits);
421 proto_tree_add_uint(tree, hf_max_resp_mant, tvb, offset, 1,
422 bits);
425 offset += 1;
427 return offset;
430 static int
431 dissect_v3_sqrv_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
433 proto_tree *tree;
434 proto_item *item;
435 guint8 bits;
437 bits = tvb_get_guint8(tvb, offset);
439 item = proto_tree_add_text(parent_tree, tvb, offset, 1,
440 "QRV=%d S=%s", bits&IGMP_V3_QRV_MASK,
441 (bits&IGMP_V3_S)?tfs_s.true_string:tfs_s.false_string);
442 tree = proto_item_add_subtree(item, ett_sqrv_bits);
444 /* S flag */
445 proto_tree_add_boolean(tree, hf_suppress, tvb, offset, 1, bits);
446 /* QRV */
447 proto_tree_add_uint(tree, hf_qrv, tvb, offset, 1, bits);
448 offset += 1;
450 return offset;
453 static int
454 dissect_v3_group_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
456 proto_tree *tree;
457 proto_item *item;
458 int old_offset = offset;
459 guint8 adl;
460 guint16 num;
461 guint32 ip;
462 guint32 maddr;
463 guint8 record_type;
465 ip = tvb_get_ipv4(tvb, offset+4);
466 item = proto_tree_add_text(parent_tree, tvb, offset, -1,
467 "Group Record : %s %s",
468 ip_to_str((guint8*)&ip),
469 val_to_str_const(tvb_get_guint8(tvb, offset), vs_record_type,"")
471 tree = proto_item_add_subtree(item, ett_group_record);
473 /* record type */
474 record_type = tvb_get_guint8(tvb, offset);
475 proto_tree_add_item(tree, hf_record_type, tvb, offset, 1, ENC_BIG_ENDIAN);
476 offset += 1;
478 /* aux data len */
479 adl = tvb_get_guint8(tvb, offset);
480 proto_tree_add_uint(tree, hf_aux_data_len, tvb, offset, 1, adl);
481 offset += 1;
483 /*number of sources*/
484 num = tvb_get_ntohs(tvb, offset);
485 proto_tree_add_uint(tree, hf_num_src, tvb, offset, 2, num);
486 offset += 2;
488 /* multicast address */
489 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
490 maddr = tvb_get_ipv4(tvb, offset);
491 offset += 4;
493 if (num == 0) {
494 switch(record_type) {
495 case IGMP_V3_MODE_IS_INCLUDE:
496 case IGMP_V3_CHANGE_TO_INCLUDE_MODE:
497 col_append_fstr(pinfo->cinfo, COL_INFO, " / Leave group %s",
498 ip_to_str((guint8*)&maddr));
499 break;
500 case IGMP_V3_MODE_IS_EXCLUDE:
501 case IGMP_V3_CHANGE_TO_EXCLUDE_MODE:
502 col_append_fstr(pinfo->cinfo, COL_INFO,
503 " / Join group %s for any sources", ip_to_str((guint8*)&maddr));
504 break;
505 case IGMP_V3_ALLOW_NEW_SOURCES:
506 col_append_fstr(pinfo->cinfo, COL_INFO,
507 " / Group %s, ALLOW_NEW_SOURCES but no source specified (?)",
508 ip_to_str((guint8*)&maddr));
509 break;
510 case IGMP_V3_BLOCK_OLD_SOURCES:
511 col_append_fstr(pinfo->cinfo, COL_INFO,
512 " / Group %s, BLOCK_OLD_SOURCES but no source specified (?)",
513 ip_to_str((guint8*)&maddr));
514 break;
515 default:
516 col_append_fstr(pinfo->cinfo, COL_INFO,
517 " / Group %s, unknown record type (?)",
518 ip_to_str((guint8*)&maddr));
519 break;
521 } else {
522 switch(record_type) {
523 case IGMP_V3_MODE_IS_INCLUDE:
524 case IGMP_V3_CHANGE_TO_INCLUDE_MODE:
525 col_append_fstr(pinfo->cinfo, COL_INFO,
526 " / Join group %s for source%s {",
527 ip_to_str((guint8*)&maddr), (num>1) ? "s in" : "");
528 break;
529 case IGMP_V3_MODE_IS_EXCLUDE:
530 case IGMP_V3_CHANGE_TO_EXCLUDE_MODE:
531 col_append_fstr(pinfo->cinfo, COL_INFO,
532 " / Join group %s, for source%s {",
533 ip_to_str((guint8*)&maddr), (num>1) ? "s not in" : " not");
534 break;
535 case IGMP_V3_ALLOW_NEW_SOURCES:
536 col_append_fstr(pinfo->cinfo, COL_INFO,
537 " / Group %s, new source%s {",
538 ip_to_str((guint8*)&maddr), (num>1) ? "s" : "");
539 break;
540 case IGMP_V3_BLOCK_OLD_SOURCES:
541 col_append_fstr(pinfo->cinfo, COL_INFO,
542 " / Group %s, block source%s {",
543 ip_to_str((guint8*)&maddr), (num>1) ? "s" : "");
544 break;
545 default:
546 col_append_fstr(pinfo->cinfo, COL_INFO,
547 " / Group %s, unknown record type (?), sources {",
548 ip_to_str((guint8*)&maddr));
549 break;
553 /* source addresses */
554 while(num--){
555 col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s",
556 tvb_ip_to_str(tvb, offset), (num?", ":"}"));
558 proto_tree_add_item(tree, hf_saddr, tvb, offset, 4, ENC_BIG_ENDIAN);
559 offset += 4;
562 /* aux data */
563 if(adl){
564 proto_tree_add_item(tree, hf_aux_data, tvb, offset, adl*4, ENC_NA);
565 offset += adl*4;
568 proto_item_set_len(item, offset-old_offset);
569 return offset;
572 /* dissectors for version 3, rfc3376 */
573 static int
574 dissect_igmp_v3_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
576 guint16 num;
578 PRINT_IGMP_VERSION(3);
580 /* skip reserved field*/
581 offset += 1;
583 /* checksum */
584 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
585 offset += 2;
587 /* skip reserved field */
588 offset += 2;
590 /* number of group records */
591 num = tvb_get_ntohs(tvb, offset);
592 if (!num)
593 col_append_str(pinfo->cinfo, COL_INFO, " - General query");
595 proto_tree_add_uint(tree, hf_num_grp_recs, tvb, offset, 2, num);
596 offset += 2;
598 while (num--)
599 offset = dissect_v3_group_record(tvb, pinfo, tree, offset);
601 return offset;
604 static int
605 dissect_igmp_v3_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
607 guint16 num;
608 guint32 maddr;
610 PRINT_IGMP_VERSION(3);
612 num = tvb_get_ntohs(tvb, offset+9);
613 /* max resp code */
614 offset = dissect_v3_max_resp(tvb, tree, offset);
616 /* checksum */
617 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
618 offset += 2;
620 /* group address */
621 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
623 maddr = tvb_get_ipv4(tvb, offset);
624 if (! maddr) {
625 col_append_str(pinfo->cinfo, COL_INFO, ", general");
626 } else {
627 col_append_fstr(pinfo->cinfo, COL_INFO, ", specific for group %s",
628 ip_to_str((guint8*)&maddr));
630 offset +=4;
632 /* bitmask for S and QRV */
633 offset = dissect_v3_sqrv_bits(tvb, tree, offset);
635 /* qqic */
636 proto_tree_add_item(tree, hf_qqic, tvb, offset, 1, ENC_BIG_ENDIAN);
637 offset += 1;
639 /*number of sources*/
640 proto_tree_add_uint(tree, hf_num_src, tvb, offset, 2, num);
641 if (num) {
642 col_append_fstr(pinfo->cinfo, COL_INFO, ", source%s {", (num>1)?"s":"");
644 offset += 2;
646 while(num--){
647 col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s", tvb_ip_to_str(tvb, offset), (num?", ":"}"));
648 proto_tree_add_item(tree, hf_saddr, tvb, offset, 4, ENC_BIG_ENDIAN);
649 offset += 4;
652 return offset;
655 /* dissector for version 2 query and report, rfc2236 */
656 static int
657 dissect_igmp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
659 guint8 tsecs;
660 guint32 maddr;
662 PRINT_IGMP_VERSION(2);
664 /* max resp time */
665 tsecs = tvb_get_guint8(tvb, offset);
666 proto_tree_add_uint_format_value(tree, hf_max_resp, tvb,
667 offset, 1, tsecs, "%.1f sec (0x%02x)", tsecs*0.1,tsecs);
668 offset += 1;
670 /* checksum */
671 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 8);
672 offset += 2;
674 /* group address */
675 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
677 maddr = tvb_get_ipv4(tvb, offset);
678 if (! maddr) {
679 col_append_str(pinfo->cinfo, COL_INFO, ", general");
680 } else {
681 if (type == IGMP_V2_LEAVE_GROUP) {
682 col_append_fstr(pinfo->cinfo, COL_INFO,
683 " %s", ip_to_str((guint8*)&maddr));
684 } else if (type == IGMP_V1_HOST_MEMBERSHIP_QUERY) {
685 col_append_fstr(pinfo->cinfo, COL_INFO,
686 ", specific for group %s", ip_to_str((guint8*)&maddr));
687 } else { /* IGMP_V2_MEMBERSHIP_REPORT is the only case left */
688 col_append_fstr(pinfo->cinfo, COL_INFO,
689 " group %s", ip_to_str((guint8*)&maddr));
692 offset +=4;
694 return offset;
697 /* dissector for version 1 query and report, rfc1054 */
698 static int
699 dissect_igmp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
701 PRINT_IGMP_VERSION(1);
703 /* skip unused byte */
704 offset += 1;
706 /* checksum */
707 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 8);
708 offset += 2;
710 /* group address */
711 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
712 offset +=4;
714 return offset;
717 /* dissector for version 0, rfc988 */
718 static int
719 dissect_igmp_v0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
721 unsigned char code;
723 PRINT_IGMP_VERSION(0);
725 /* Code */
726 code = tvb_get_guint8(tvb, offset);
727 if (type==IGMP_V0_CREATE_GROUP_REQUEST) {
728 proto_tree_add_uint(tree, hf_group_type, tvb, offset, 1, code);
729 } else if (!(type&0x01)) {
730 if (code <5) {
731 proto_tree_add_uint(tree, hf_reply_code, tvb, offset, 1, code);
732 } else {
733 proto_tree_add_uint(tree, hf_reply_pending, tvb, offset, 1, code);
736 offset += 1;
738 /* checksum */
739 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 20);
740 offset += 2;
742 /* identifier */
743 proto_tree_add_item(tree, hf_identifier, tvb, offset, 4, ENC_BIG_ENDIAN);
744 offset += 4;
746 /* group address */
747 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
748 offset += 4;
750 /* access key */
751 proto_tree_add_item(tree, hf_access_key, tvb, offset, 8, ENC_NA);
752 offset += 8;
754 return offset;
757 /* dissector for multicast traceroute, rfc???? */
758 static int
759 dissect_igmp_mtrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int type, int offset)
761 const char *typestr, *blocks = NULL;
762 char buf[20];
764 /* All multicast traceroute packets (Query, Request and
765 * Response) have the same fixed header. Request and Response
766 * have one or more response data blocks following this fixed
767 * header. Since Query and Request share the same IGMP type,
768 * the method to differentiate between them is to check the
769 * IGMP packet length. Queries are only
770 * IGMP_TRACEROUTE_HDR_LEN bytes long.
772 if (type == IGMP_TRACEROUTE_RESPONSE) {
773 int i = (tvb_reported_length_remaining(tvb, offset) - IGMP_TRACEROUTE_HDR_LEN) / IGMP_TRACEROUTE_RSP_LEN;
774 g_snprintf(buf, sizeof buf, ", %d block%s", i, plurality(i, "", "s"));
775 typestr = "Traceroute Response";
776 blocks = buf;
777 } else if (tvb_reported_length_remaining(tvb, offset) == IGMP_TRACEROUTE_HDR_LEN)
778 typestr = "Traceroute Query";
779 else
780 typestr = "Traceroute Request";
782 col_set_str(pinfo->cinfo, COL_INFO, typestr);
783 if (blocks)
784 col_append_str(pinfo->cinfo, COL_INFO, blocks);
786 proto_tree_add_uint_format_value(tree, hf_type, tvb, offset, 1, type,
787 "%s (0x%02x)", typestr, type);
788 offset += 1;
790 /* maximum number of hops that the requester wants to trace */
791 proto_tree_add_item(tree, hf_mtrace_max_hops, tvb, offset, 1, ENC_BIG_ENDIAN);
792 offset += 1;
794 /* checksum */
795 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
796 offset += 2;
798 /* group address to be traced */
799 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
800 offset += 4;
802 /* address of multicast source for the path being traced */
803 proto_tree_add_item(tree, hf_mtrace_saddr, tvb, offset, 4, ENC_BIG_ENDIAN);
804 offset += 4;
806 /* address of multicast receiver for the path being traced */
807 proto_tree_add_item(tree, hf_mtrace_raddr, tvb, offset, 4, ENC_BIG_ENDIAN);
808 offset += 4;
810 /* address where the completed traceroute response packet gets sent */
811 proto_tree_add_item(tree, hf_mtrace_rspaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
812 offset += 4;
814 /* for multicasted responses, TTL at which to multicast the response */
815 proto_tree_add_item(tree, hf_mtrace_resp_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
816 offset += 1;
818 /* unique identifier for this traceroute request (for e.g. duplicate/delay detection) */
819 proto_tree_add_item(tree, hf_mtrace_q_id, tvb, offset, 3, ENC_BIG_ENDIAN);
820 offset += 3;
822 /* If this was Query, we only had the fixed header */
823 if (tvb_reported_length_remaining(tvb, offset) == 0)
824 return offset;
826 /* Loop through the response data blocks */
827 while (tvb_reported_length_remaining(tvb, offset) >= IGMP_TRACEROUTE_RSP_LEN) {
828 proto_item *bi;
829 proto_tree *block_tree;
831 bi = proto_tree_add_text(tree, tvb, offset, IGMP_TRACEROUTE_RSP_LEN,
832 "Response data block: %s -> %s, Proto: %s, Forwarding Code: %s",
833 tvb_ip_to_str(tvb, offset + 4),
834 tvb_ip_to_str(tvb, offset + 8),
835 val_to_str_const(tvb_get_guint8(tvb, offset + 28), mtrace_rtg_vals, "Unknown"),
836 val_to_str_const(tvb_get_guint8(tvb, offset + 31), mtrace_fwd_code_vals, "Unknown"));
837 block_tree = proto_item_add_subtree(bi, ett_mtrace_block);
839 /* Query Arrival Time */
840 proto_tree_add_item(block_tree, hf_mtrace_q_arrival, tvb, offset, 4, ENC_BIG_ENDIAN);
841 offset += 4;
843 /* Incoming Interface Address */
844 proto_tree_add_item(block_tree, hf_mtrace_q_inaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
845 offset += 4;
847 /* Outgoing Interface Address */
848 proto_tree_add_item(block_tree, hf_mtrace_q_outaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
849 offset += 4;
851 /* Previous-Hop Router Address */
852 proto_tree_add_item(block_tree, hf_mtrace_q_prevrtr, tvb, offset, 4, ENC_BIG_ENDIAN);
853 offset += 4;
855 /* Input packet count on incoming interface */
856 proto_tree_add_item(block_tree, hf_mtrace_q_inpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
857 offset += 4;
859 /* Output packet count on outgoing interface */
860 proto_tree_add_item(block_tree, hf_mtrace_q_outpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
861 offset += 4;
863 /* Total number of packets for this source-group pair */
864 proto_tree_add_item(block_tree, hf_mtrace_q_total, tvb, offset, 4, ENC_BIG_ENDIAN);
865 offset += 4;
867 /* Routing protocol in use between this and previous-hop router */
868 proto_tree_add_item(block_tree, hf_mtrace_q_rtg_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
869 offset += 1;
871 /* TTL that a packet is required to be forwarded */
872 proto_tree_add_item(block_tree, hf_mtrace_q_fwd_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
873 offset += 1;
875 /* Must be zeroed and ignored bit, S bit and src network mask length */
876 proto_tree_add_item(block_tree, hf_mtrace_q_mbz, tvb, offset, 1, ENC_BIG_ENDIAN);
877 proto_tree_add_item(block_tree, hf_mtrace_q_s, tvb, offset, 1, ENC_BIG_ENDIAN);
878 proto_tree_add_item(block_tree, hf_mtrace_q_src_mask, tvb, offset, 1, ENC_BIG_ENDIAN);
879 offset += 1;
881 /* Forwarding information/error code */
882 proto_tree_add_item(block_tree, hf_mtrace_q_fwd_code, tvb, offset, 1, ENC_BIG_ENDIAN);
883 offset += 1;
886 return offset;
889 static void
890 dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
892 proto_tree *tree;
893 proto_item *item;
894 int offset = 0;
895 unsigned char type;
896 guint32 dst;
898 item = proto_tree_add_item(parent_tree, proto_igmp, tvb, offset, -1, ENC_NA);
899 tree = proto_item_add_subtree(item, ett_igmp);
901 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IGMP");
902 col_clear(pinfo->cinfo, COL_INFO);
904 type = tvb_get_guint8(tvb, offset);
906 /* version 0 */
907 if ((type&0xf0)==0){
908 offset = dissect_igmp_v0(tvb, pinfo, tree, type, offset);
911 switch (type) {
912 case IGMP_V1_HOST_MEMBERSHIP_QUERY: /* 0x11 v1/v2/v3 */
913 if ( tvb_reported_length(tvb)>=12 ) {
914 /* version 3 */
915 offset = dissect_igmp_v3_query(tvb, pinfo, tree, type, offset);
916 } else {
917 /* v1 and v2 differs in second byte of header */
918 if (tvb_get_guint8(tvb, offset+1)) {
919 offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
920 } else {
921 offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
924 break;
926 case IGMP_V1_HOST_MEMBERSHIP_REPORT: /* 0x12 v1 only */
927 offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
928 break;
930 case IGMP_DVMRP:
931 offset = dissect_dvmrp(tvb, pinfo, parent_tree, offset);
932 break;
934 case IGMP_V1_PIM_ROUTING_MESSAGE:
935 offset = dissect_pimv1(tvb, pinfo, parent_tree, offset);
936 break;
938 case IGMP_V2_MEMBERSHIP_REPORT:
939 case IGMP_V2_LEAVE_GROUP:
940 offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
941 break;
943 case IGMP_TRACEROUTE_RESPONSE:
944 case IGMP_TRACEROUTE_QUERY_REQ:
945 offset = dissect_igmp_mtrace(tvb, pinfo, tree, type, offset);
946 break;
948 case IGMP_V3_MEMBERSHIP_REPORT:
949 offset = dissect_igmp_v3_report(tvb, pinfo, tree, type, offset);
950 break;
952 case IGMP_TYPE_0x23:
953 dst = g_htonl(MC_ALL_IGMPV3_ROUTERS);
954 if (!memcmp(pinfo->dst.data, &dst, 4)) {
955 offset = dissect_msnip(tvb, pinfo, parent_tree, offset);
957 break;
959 case IGMP_TYPE_0x24:
960 dst = g_htonl(MC_ALL_ROUTERS);
961 if (!memcmp(pinfo->dst.data, &dst, 4)) {
962 offset = dissect_mrdisc(tvb, pinfo, parent_tree, offset);
964 dst = g_htonl(MC_ALL_IGMPV3_ROUTERS);
965 if (!memcmp(pinfo->dst.data, &dst, 4)) {
966 offset = dissect_msnip(tvb, pinfo, parent_tree, offset);
968 break;
970 case IGMP_TYPE_0x25:
971 if ( tvb_reported_length(tvb)>=8 ) {
972 /* if len of igmp packet>=8 we assume it is MSNIP */
973 offset = dissect_msnip(tvb, pinfo, parent_tree, offset);
974 } else {
975 /* ok its not MSNIP, check if it might be MRDISC */
976 dst = g_htonl(MC_ALL_ROUTERS);
977 if (!memcmp(pinfo->dst.data, &dst, 4)) {
978 offset = dissect_mrdisc(tvb, pinfo, parent_tree, offset);
981 break;
983 case IGMP_TYPE_0x26:
984 dst = g_htonl(MC_ALL_ROUTERS);
985 if (!memcmp(pinfo->dst.data, &dst, 4)) {
986 offset = dissect_mrdisc(tvb, pinfo, parent_tree, offset);
988 break;
990 case IGMP_IGAP_JOIN:
991 case IGMP_IGAP_QUERY:
992 case IGMP_IGAP_LEAVE:
993 offset = dissect_igap(tvb, pinfo, parent_tree, offset);
994 break;
996 case IGMP_RGMP_HELLO:
997 case IGMP_RGMP_BYE:
998 case IGMP_RGMP_JOIN:
999 case IGMP_RGMP_LEAVE:
1000 dst = g_htonl(MC_RGMP);
1001 if (!memcmp(pinfo->dst.data, &dst, 4)) {
1002 offset = dissect_rgmp(tvb, pinfo, parent_tree, offset);
1004 break;
1006 default:
1007 offset = dissect_igmp_unknown(tvb, pinfo, tree, type, offset);
1008 break;
1011 proto_item_set_len(item, offset);
1014 void
1015 proto_register_igmp(void)
1017 static hf_register_info hf[] = {
1018 { &hf_type,
1019 { "Type", "igmp.type", FT_UINT8, BASE_HEX,
1020 VALS(commands), 0, "IGMP Packet Type", HFILL }},
1022 { &hf_version,
1023 { "IGMP Version", "igmp.version", FT_UINT8, BASE_DEC,
1024 NULL, 0, NULL, HFILL }},
1026 { &hf_group_type,
1027 { "Type Of Group", "igmp.group_type", FT_UINT8, BASE_DEC,
1028 VALS(vs_group_type), 0, "IGMP V0 Type Of Group", HFILL }},
1030 { &hf_reply_code,
1031 { "Reply", "igmp.reply", FT_UINT8, BASE_DEC,
1032 VALS(vs_reply_code), 0, "IGMP V0 Reply", HFILL }},
1034 { &hf_reply_pending,
1035 { "Reply Pending", "igmp.reply.pending", FT_UINT8, BASE_DEC,
1036 NULL, 0, "IGMP V0 Reply Pending, Retry in this many seconds", HFILL }},
1038 { &hf_checksum,
1039 { "Checksum", "igmp.checksum", FT_UINT16, BASE_HEX,
1040 NULL, 0, "IGMP Checksum", HFILL }},
1042 { &hf_checksum_bad,
1043 { "Bad Checksum", "igmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
1044 NULL, 0x0, "Bad IGMP Checksum", HFILL }},
1046 { &hf_identifier,
1047 { "Identifier", "igmp.identifier", FT_UINT32, BASE_DEC,
1048 NULL, 0, "IGMP V0 Identifier", HFILL }},
1050 { &hf_access_key,
1051 { "Access Key", "igmp.access_key", FT_BYTES, BASE_NONE,
1052 NULL, 0, "IGMP V0 Access Key", HFILL }},
1054 { &hf_max_resp,
1055 { "Max Resp Time", "igmp.max_resp", FT_UINT8, BASE_DEC,
1056 NULL, 0, "Max Response Time", HFILL }},
1058 { &hf_suppress,
1059 { "S", "igmp.s", FT_BOOLEAN, 8,
1060 TFS(&tfs_s), IGMP_V3_S, "Suppress Router Side Processing", HFILL }},
1062 { &hf_qrv,
1063 { "QRV", "igmp.qrv", FT_UINT8, BASE_DEC,
1064 NULL, IGMP_V3_QRV_MASK, "Querier's Robustness Value", HFILL }},
1066 { &hf_qqic,
1067 { "QQIC", "igmp.qqic", FT_UINT8, BASE_DEC,
1068 NULL, 0, "Querier's Query Interval Code", HFILL }},
1070 { &hf_num_src,
1071 { "Num Src", "igmp.num_src", FT_UINT16, BASE_DEC,
1072 NULL, 0, "Number Of Sources", HFILL }},
1074 { &hf_saddr,
1075 { "Source Address", "igmp.saddr", FT_IPv4, BASE_NONE,
1076 NULL, 0, NULL, HFILL }},
1078 { &hf_num_grp_recs,
1079 { "Num Group Records", "igmp.num_grp_recs", FT_UINT16, BASE_DEC,
1080 NULL, 0, "Number Of Group Records", HFILL }},
1082 { &hf_record_type,
1083 { "Record Type", "igmp.record_type", FT_UINT8, BASE_DEC,
1084 VALS(vs_record_type), 0, NULL, HFILL }},
1086 { &hf_aux_data_len,
1087 { "Aux Data Len", "igmp.aux_data_len", FT_UINT8, BASE_DEC,
1088 NULL, 0, "Aux Data Len, In units of 32bit words", HFILL }},
1090 { &hf_maddr,
1091 { "Multicast Address", "igmp.maddr", FT_IPv4, BASE_NONE,
1092 NULL, 0, NULL, HFILL }},
1094 { &hf_aux_data,
1095 { "Aux Data", "igmp.aux_data", FT_BYTES, BASE_NONE,
1096 NULL, 0, "IGMP V3 Auxiliary Data", HFILL }},
1098 { &hf_max_resp_exp,
1099 { "Exponent", "igmp.max_resp.exp", FT_UINT8, BASE_HEX,
1100 NULL, IGMP_MAX_RESP_EXP, "Maximum Response Time, Exponent", HFILL }},
1102 { &hf_max_resp_mant,
1103 { "Mantissa", "igmp.max_resp.mant", FT_UINT8, BASE_HEX,
1104 NULL, IGMP_MAX_RESP_MANT, "Maximum Response Time, Mantissa", HFILL }},
1106 { &hf_mtrace_max_hops,
1107 { "# hops", "igmp.mtrace.max_hops", FT_UINT8, BASE_DEC,
1108 NULL, 0, "Maximum Number of Hops to Trace", HFILL }},
1110 { &hf_mtrace_saddr,
1111 { "Source Address", "igmp.mtrace.saddr", FT_IPv4, BASE_NONE,
1112 NULL, 0, "Multicast Source for the Path Being Traced", HFILL }},
1114 { &hf_mtrace_raddr,
1115 { "Receiver Address", "igmp.mtrace.raddr", FT_IPv4, BASE_NONE,
1116 NULL, 0, "Multicast Receiver for the Path Being Traced", HFILL }},
1118 { &hf_mtrace_rspaddr,
1119 { "Response Address", "igmp.mtrace.rspaddr", FT_IPv4, BASE_NONE,
1120 NULL, 0, "Destination of Completed Traceroute Response", HFILL }},
1122 { &hf_mtrace_resp_ttl,
1123 { "Response TTL", "igmp.mtrace.resp_ttl", FT_UINT8, BASE_DEC,
1124 NULL, 0, "TTL for Multicasted Responses", HFILL }},
1126 { &hf_mtrace_q_id,
1127 { "Query ID", "igmp.mtrace.q_id", FT_UINT24, BASE_DEC,
1128 NULL, 0, "Identifier for this Traceroute Request", HFILL }},
1130 { &hf_mtrace_q_arrival,
1131 { "Query Arrival", "igmp.mtrace.q_arrival", FT_UINT32, BASE_DEC,
1132 NULL, 0, "Query Arrival Time", HFILL }},
1134 { &hf_mtrace_q_inaddr,
1135 { "In itf addr", "igmp.mtrace.q_inaddr", FT_IPv4, BASE_NONE,
1136 NULL, 0, "Incoming Interface Address", HFILL }},
1138 { &hf_mtrace_q_outaddr,
1139 { "Out itf addr", "igmp.mtrace.q_outaddr", FT_IPv4, BASE_NONE,
1140 NULL, 0, "Outgoing Interface Address", HFILL }},
1142 { &hf_mtrace_q_prevrtr,
1143 { "Previous rtr addr", "igmp.mtrace.q_prevrtr", FT_IPv4, BASE_NONE,
1144 NULL, 0, "Previous-Hop Router Address", HFILL }},
1146 { &hf_mtrace_q_inpkt,
1147 { "In pkts", "igmp.mtrace.q_inpkt", FT_UINT32, BASE_DEC,
1148 NULL, 0, "Input packet count on incoming interface", HFILL }},
1150 { &hf_mtrace_q_outpkt,
1151 { "Out pkts", "igmp.mtrace.q_outpkt", FT_UINT32, BASE_DEC,
1152 NULL, 0, "Output packet count on outgoing interface", HFILL }},
1154 { &hf_mtrace_q_total,
1155 { "S,G pkt count", "igmp.mtrace.q_total", FT_UINT32, BASE_DEC,
1156 NULL, 0, "Total number of packets for this source-group pair", HFILL }},
1158 { &hf_mtrace_q_rtg_proto,
1159 { "Rtg Protocol", "igmp.mtrace.q_rtg_proto", FT_UINT8, BASE_DEC,
1160 VALS(mtrace_rtg_vals), 0, "Routing protocol between this and previous hop rtr", HFILL }},
1162 { &hf_mtrace_q_fwd_ttl,
1163 { "FwdTTL", "igmp.mtrace.q_fwd_ttl", FT_UINT8, BASE_DEC,
1164 NULL, 0, "TTL required for forwarding", HFILL }},
1166 { &hf_mtrace_q_mbz,
1167 { "MBZ", "igmp.mtrace.q_mbz", FT_UINT8, BASE_HEX,
1168 NULL, 0x80, "Must be zeroed on transmission and ignored on reception", HFILL }},
1170 { &hf_mtrace_q_s,
1171 { "S", "igmp.mtrace.q_s", FT_UINT8, BASE_HEX,
1172 NULL, 0x40, "Set if S,G packet count is for source network", HFILL }},
1174 { &hf_mtrace_q_src_mask,
1175 { "Src Mask", "igmp.mtrace.q_src_mask", FT_UINT8, BASE_HEX,
1176 NULL, 0x3F, "Source mask length. 63 when forwarding on group state", HFILL }},
1178 { &hf_mtrace_q_fwd_code,
1179 { "Forwarding Code", "igmp.mtrace.q_fwd_code", FT_UINT8, BASE_HEX,
1180 VALS(mtrace_fwd_code_vals), 0, "Forwarding information/error code", HFILL }},
1183 static gint *ett[] = {
1184 &ett_igmp,
1185 &ett_group_record,
1186 &ett_sqrv_bits,
1187 &ett_max_resp,
1188 &ett_mtrace_block,
1191 proto_igmp = proto_register_protocol("Internet Group Management Protocol",
1192 "IGMP", "igmp");
1193 proto_register_field_array(proto_igmp, hf, array_length(hf));
1194 proto_register_subtree_array(ett, array_length(ett));
1197 void
1198 proto_reg_handoff_igmp(void)
1200 dissector_handle_t igmp_handle;
1202 igmp_handle = create_dissector_handle(dissect_igmp, proto_igmp);
1203 dissector_add_uint("ip.proto", IP_PROTO_IGMP, igmp_handle);
1207 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1209 * Local variables:
1210 * c-basic-offset: 4
1211 * tab-width: 8
1212 * indent-tabs-mode: t
1213 * End:
1215 * vi: set shiftwidth=4 tabstop=8 noexpandtab:
1216 * :indentSize=4:tabSize=8:noTabs=false: