aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pim.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-05-02 02:47:58 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-02 09:48:38 +0000
commit27e480cf5a29563cf2ee4ff30c8bfd31b81631f9 (patch)
treea4d5667f18f464dbcc9696144c1dbf0356ffffd7 /epan/dissectors/packet-pim.c
parent6e66cdaaed5f918afb2b4e6ef5e646f22fb91810 (diff)
Handle PIMvN, for N > 2, by just adding the checksum and subtree and bailing.
Don't bother doing the checksum, as we don't know how much to checksum; don't assume setting pim_length to 0 will force it not to be checksummed, as it doesn't; and don't test twice for a version != 2. Change-Id: I1c2ed3ecf1572aef6c5af140c410f9cdd0e9c3a6 Reviewed-on: https://code.wireshark.org/review/8271 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-pim.c')
-rw-r--r--epan/dissectors/packet-pim.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c
index 519e10c841..a492b291d8 100644
--- a/epan/dissectors/packet-pim.c
+++ b/epan/dissectors/packet-pim.c
@@ -830,34 +830,39 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree_add_item(pim_tree, hf_pim_res_bytes, tvb, offset + 1, 1, ENC_NA);
}
pim_cksum = tvb_get_ntohs(tvb, offset + 2);
- length = tvb_reported_length(tvb);
- if (PIM_VER(pim_typever) == 2) {
+ if (PIM_VER(pim_typever) != 2) {
/*
- * Well, it's PIM v2, so we can check whether this is a Register
- * message, and thus can figure out how much to checksum and
- * whether to make the columns read-only.
+ * We don't know this version, so we don't know how much of the
+ * packet the checksum covers.
*/
- if (PIM_TYPE(pim_typever) == 1) {
- /*
- * Register message - the PIM header is 8 bytes long.
- * Also set the columns non-writable. Otherwise the IPv4 or
- * IPv6 dissector for the encapsulated packet that caused
- * this register will overwrite the PIM info in the columns.
- */
- pim_length = 8;
- col_set_writable(pinfo->cinfo, FALSE);
- } else {
- /*
- * Other message - checksum the entire packet.
- */
- pim_length = length;
+ proto_tree_add_uint(pim_tree, hf_pim_cksum, tvb,
+ offset + 2, 2, pim_cksum);
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
+ pimopt_tree = proto_tree_add_subtree(pim_tree, tvb, offset, -1, ett_pim_opts, &tiopt, "PIM options");
}
+ goto done;
+ }
+
+ /*
+ * Well, it's PIM v2, so we can check whether this is a Register
+ * message, and thus can figure out how much to checksum and
+ * whether to make the columns read-only.
+ */
+ length = tvb_reported_length(tvb);
+ if (PIM_TYPE(pim_typever) == 1) {
+ /*
+ * Register message - the PIM header is 8 bytes long.
+ * Also set the columns non-writable. Otherwise the IPv4 or
+ * IPv6 dissector for the encapsulated packet that caused
+ * this register will overwrite the PIM info in the columns.
+ */
+ pim_length = 8;
+ col_set_writable(pinfo->cinfo, FALSE);
} else {
/*
- * We don't know what type of message this is, so say that
- * the length is 0, to force it not to be checksummed.
+ * Other message - checksum the entire packet.
*/
- pim_length = 0;
+ pim_length = length;
}
if (!pinfo->fragmented && length >= pim_length) {
/*
@@ -909,9 +914,6 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
} else
goto done;
- if (PIM_VER(pim_typever) != 2)
- goto done;
-
/* version 2 decoder */
switch (PIM_TYPE(pim_typever)) {
case PIM_TYPE_HELLO: /*hello*/