2 * Routines for IGMP/RGMP packet disassembly
3 * Copyright 2006 Jaap Keuter
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
15 This is a setup for RGMP dissection, a simple protocol bolted on IGMP.
20 #include <epan/packet.h>
21 #include <epan/expert.h>
22 #include "packet-igmp.h"
24 void proto_register_rgmp(void);
25 void proto_reg_handoff_rgmp(void);
27 static int proto_rgmp
;
29 static int hf_reserved
;
30 static int hf_checksum
;
31 static int hf_checksum_status
;
36 static expert_field ei_checksum
;
38 static dissector_handle_t rgmp_handle
;
40 #define MC_RGMP 0xe0000019
42 static const value_string rgmp_types
[] = {
43 {IGMP_RGMP_LEAVE
, "Leave"},
44 {IGMP_RGMP_JOIN
, "Join"},
45 {IGMP_RGMP_BYE
, "Bye"},
46 {IGMP_RGMP_HELLO
, "Hello"},
50 /* This function is only called from the IGMP dissector */
52 dissect_rgmp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void* data _U_
)
58 uint32_t dst
= g_htonl(MC_RGMP
);
60 /* Shouldn't be destined for us */
61 if ((pinfo
->dst
.type
!= AT_IPv4
) || memcmp(pinfo
->dst
.data
, &dst
, 4))
64 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "RGMP");
65 col_clear(pinfo
->cinfo
, COL_INFO
);
67 item
= proto_tree_add_item(parent_tree
, proto_rgmp
, tvb
, offset
, -1, ENC_NA
);
68 tree
= proto_item_add_subtree(item
, ett_rgmp
);
70 type
= tvb_get_uint8(tvb
, offset
);
71 col_add_str(pinfo
->cinfo
, COL_INFO
,
72 val_to_str(type
, rgmp_types
, "Unknown Type: 0x%02x"));
73 proto_tree_add_uint(tree
, hf_type
, tvb
, offset
, 1, type
);
77 proto_tree_add_item(tree
, hf_reserved
, tvb
, offset
, 1, ENC_NA
);
80 igmp_checksum(tree
, tvb
, hf_checksum
, hf_checksum_status
, &ei_checksum
, pinfo
, 0);
83 proto_tree_add_item(tree
, hf_maddr
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
91 proto_register_rgmp(void)
93 static hf_register_info hf
[] = {
95 { "Type", "rgmp.type", FT_UINT8
, BASE_HEX
,
96 VALS(rgmp_types
), 0, "RGMP Packet Type", HFILL
}
100 { "Reserved", "rgmp.reserved", FT_UINT8
, BASE_HEX
,
101 NULL
, 0, "RGMP Reserved", HFILL
}
105 { "Checksum", "rgmp.checksum", FT_UINT16
, BASE_HEX
,
106 NULL
, 0, NULL
, HFILL
}
109 { &hf_checksum_status
,
110 { "Checksum Status", "rgmp.checksum.status", FT_UINT8
, BASE_NONE
,
111 VALS(proto_checksum_vals
), 0x0, NULL
, HFILL
}
115 { "Multicast group address", "rgmp.maddr", FT_IPv4
, BASE_NONE
,
116 NULL
, 0, NULL
, HFILL
}
120 static int *ett
[] = {
124 static ei_register_info ei
[] = {
125 { &ei_checksum
, { "rgmp.bad_checksum", PI_CHECKSUM
, PI_ERROR
, "Bad checksum", EXPFILL
}},
128 expert_module_t
* expert_rgmp
;
130 proto_rgmp
= proto_register_protocol("Router-port Group Management Protocol", "RGMP", "rgmp");
131 proto_register_field_array(proto_rgmp
, hf
, array_length(hf
));
132 proto_register_subtree_array(ett
, array_length(ett
));
133 expert_rgmp
= expert_register_protocol(proto_rgmp
);
134 expert_register_field_array(expert_rgmp
, ei
, array_length(ei
));
136 rgmp_handle
= register_dissector("rgmp", dissect_rgmp
, proto_rgmp
);
140 proto_reg_handoff_rgmp(void)
142 dissector_add_uint("igmp.type", IGMP_RGMP_HELLO
, rgmp_handle
);
143 dissector_add_uint("igmp.type", IGMP_RGMP_BYE
, rgmp_handle
);
144 dissector_add_uint("igmp.type", IGMP_RGMP_JOIN
, rgmp_handle
);
145 dissector_add_uint("igmp.type", IGMP_RGMP_LEAVE
, rgmp_handle
);
149 * Editor modelines - https://www.wireshark.org/tools/modelines.html
154 * indent-tabs-mode: nil
157 * vi: set shiftwidth=4 tabstop=8 expandtab:
158 * :indentSize=4:tabSize=8:noTabs=true: