aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rip.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-11-17 20:16:06 -0500
committerAnders Broman <a.broman58@gmail.com>2015-11-18 07:33:08 +0000
commit4adeb424f5cdb74ca1f98cd4b87bd72e4d811f03 (patch)
tree6c73d6e0795cc5181ad53242581e4c7f2282081f /epan/dissectors/packet-rip.c
parent13297438d98e3388d650fc55c2a77d5b52367e1f (diff)
create_dissector_handle -> new_create_dissector_handle
Picking off "easy" dissectors that only have one or two exit points at most. Change-Id: I9c7d1c092bbae896ec0c2832617891346927f2e1 Reviewed-on: https://code.wireshark.org/review/11932 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-rip.c')
-rw-r--r--epan/dissectors/packet-rip.c89
1 files changed, 44 insertions, 45 deletions
diff --git a/epan/dissectors/packet-rip.c b/epan/dissectors/packet-rip.c
index e5919689f3..ddebafe185 100644
--- a/epan/dissectors/packet-rip.c
+++ b/epan/dissectors/packet-rip.c
@@ -172,8 +172,8 @@ static void dissect_ip_rip_vektor(tvbuff_t *tvb, int offset, guint8 version,
static gint dissect_rip_authentication(tvbuff_t *tvb, int offset,
proto_tree *tree);
-static void
-dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
proto_tree *rip_tree = NULL;
@@ -195,51 +195,50 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(command, command_vals, "Unknown command (%u)"));
- if (tree) {
- ti = proto_tree_add_item(tree, hfi_rip, tvb, 0, -1, ENC_NA);
- rip_tree = proto_item_add_subtree(ti, ett_rip);
-
- proto_tree_add_uint(rip_tree, &hfi_rip_command, tvb, 0, 1, command);
- proto_tree_add_uint(rip_tree, &hfi_rip_version, tvb, 1, 1, version);
- if (version == RIPv2 && pref_display_routing_domain == TRUE)
- proto_tree_add_uint(rip_tree, &hfi_rip_routing_domain, tvb, 2, 2,
- tvb_get_ntohs(tvb, 2));
-
- /* skip header */
- offset = RIP_HEADER_LENGTH;
-
- /* zero or more entries */
- while (tvb_reported_length_remaining(tvb, offset) > trailer_len ) {
- family = tvb_get_ntohs(tvb, offset);
- switch (family) {
- case AFVAL_UNSPEC: /* Unspecified */
- /*
- * There should be one entry in the request, and a metric
- * of infinity, meaning "show the entire routing table".
- */
- dissect_unspec_rip_vektor(tvb, offset, version, rip_tree);
- break;
- case AFVAL_IP: /* IP */
- dissect_ip_rip_vektor(tvb, offset, version, rip_tree);
- break;
- case 0xFFFF:
- if( offset == RIP_HEADER_LENGTH ) {
- trailer_len=dissect_rip_authentication(tvb, offset, rip_tree);
- is_md5_auth = TRUE;
- break;
- }
- if(is_md5_auth && tvb_reported_length_remaining(tvb, offset) == 20)
- break;
- /* Intentional fall through: auth Entry MUST be the first! */
- default:
- proto_tree_add_expert_format(rip_tree, pinfo, &ei_rip_unknown_address_family, tvb, offset,
- RIP_ENTRY_LENGTH, "Unknown address family %u", family);
- break;
+ ti = proto_tree_add_item(tree, hfi_rip, tvb, 0, -1, ENC_NA);
+ rip_tree = proto_item_add_subtree(ti, ett_rip);
+
+ proto_tree_add_uint(rip_tree, &hfi_rip_command, tvb, 0, 1, command);
+ proto_tree_add_uint(rip_tree, &hfi_rip_version, tvb, 1, 1, version);
+ if (version == RIPv2 && pref_display_routing_domain == TRUE)
+ proto_tree_add_uint(rip_tree, &hfi_rip_routing_domain, tvb, 2, 2,
+ tvb_get_ntohs(tvb, 2));
+
+ /* skip header */
+ offset = RIP_HEADER_LENGTH;
+
+ /* zero or more entries */
+ while (tvb_reported_length_remaining(tvb, offset) > trailer_len ) {
+ family = tvb_get_ntohs(tvb, offset);
+ switch (family) {
+ case AFVAL_UNSPEC: /* Unspecified */
+ /*
+ * There should be one entry in the request, and a metric
+ * of infinity, meaning "show the entire routing table".
+ */
+ dissect_unspec_rip_vektor(tvb, offset, version, rip_tree);
+ break;
+ case AFVAL_IP: /* IP */
+ dissect_ip_rip_vektor(tvb, offset, version, rip_tree);
+ break;
+ case 0xFFFF:
+ if( offset == RIP_HEADER_LENGTH ) {
+ trailer_len=dissect_rip_authentication(tvb, offset, rip_tree);
+ is_md5_auth = TRUE;
+ break;
}
-
- offset += RIP_ENTRY_LENGTH;
+ if(is_md5_auth && tvb_reported_length_remaining(tvb, offset) == 20)
+ break;
+ /* Intentional fall through: auth Entry MUST be the first! */
+ default:
+ proto_tree_add_expert_format(rip_tree, pinfo, &ei_rip_unknown_address_family, tvb, offset,
+ RIP_ENTRY_LENGTH, "Unknown address family %u", family);
+ break;
}
+
+ offset += RIP_ENTRY_LENGTH;
}
+ return tvb_captured_length(tvb);
}
static void
@@ -388,7 +387,7 @@ proto_register_rip(void)
prefs_register_bool_preference(rip_module, "display_routing_domain", "Display Routing Domain field", "Display the third and forth bytes of the RIPv2 header as the Routing Domain field (introduced in RFC 1388 [January 1993] and obsolete as of RFC 1723 [November 1994])", &pref_display_routing_domain);
- rip_handle = create_dissector_handle(dissect_rip, proto_rip);
+ rip_handle = new_create_dissector_handle(dissect_rip, proto_rip);
}
void