aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-eigrp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-08-08 18:09:00 -0700
committerGuy Harris <guy@alum.mit.edu>2014-08-09 01:09:34 +0000
commitebff85fdbbe9667f469e18686ad945f634be2682 (patch)
tree325c6cf517f4644339d26bd7f0e57ff2c4097e7b /epan/dissectors/packet-eigrp.c
parentfe74e319c0d27fb516577ce521719fba973e8113 (diff)
Clean up Internet checksum handling.
Add macros to set entries of a vec_t, one for use when you have a pointer to private data, and one for use when you have data in a tvbuff. The latter wraps the use of tvb_get_ptr(), so that you're not directly calling it in a dissector. Move ip_checksum() to epan/in_cksum.c, and add an ip_checksum_tvb() that wraps the use of tvb_get_ptr(). In the CARP dissector, give the length variable an unsigned type - there's no benefit to it being signed, and that requires some casts to be thrown around. In the DCCP dissector, check only against the coverage length to see if we have enough data, combine the "should we check the checksum?" check with the "*can* we check the checksum?" check in a single if, and throw a dissector assertion if the source network address type isn't IPv4 or IPv6. Get rid of inclues of <epan/in_cksum.h> in dissectors that don't use any of the Internet checksum routines. In the HIP dissector, make sure we have the data to calculate the checksum before doing so. Change-Id: I2f9674775dbb54c533d33082632809f7d32ec8ae Reviewed-on: https://code.wireshark.org/review/3517 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-eigrp.c')
-rw-r--r--epan/dissectors/packet-eigrp.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/epan/dissectors/packet-eigrp.c b/epan/dissectors/packet-eigrp.c
index 70e2c2a5eb..04869c7706 100644
--- a/epan/dissectors/packet-eigrp.c
+++ b/epan/dissectors/packet-eigrp.c
@@ -2395,14 +2395,6 @@ dissect_eigrp_multi_protocol_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tv
*/
#include <epan/in_cksum.h>
-static guint16 ip_checksum(const guint8 *ptr, int len)
-{
- vec_t cksum_vec[1];
-
- cksum_vec[0].ptr = ptr;
- cksum_vec[0].len = len;
- return in_cksum(&cksum_vec[0], 1);
-}
static int
dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -2455,7 +2447,7 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
size = tvb_length(tvb);
checksum = tvb_get_ntohs(tvb, 2);
- cacl_checksum = ip_checksum(tvb_get_ptr(tvb, 0, size), size);
+ cacl_checksum = ip_checksum_tvb(tvb, 0, size);
if (cacl_checksum == checksum) {
proto_tree_add_text(eigrp_tree, tvb, 2, 2,