Wireshark-commits: [Wireshark-commits] master ebff85f: Clean up Internet checksum handling.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 9 Aug 2014 01:09:36 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=ebff85fdbbe9667f469e18686ad945f634be2682
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

ebff85f by Guy Harris (guy@xxxxxxxxxxxx):

    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@xxxxxxxxxxxx>
    

Actions performed:

    from  fe74e31   BOFL: fix assertion introduced in g5db1352
    adds  ebff85f   Clean up Internet checksum handling.


Summary of changes:
 epan/dissectors/packet-6lowpan.c     |    9 ++--
 epan/dissectors/packet-carp.c        |    9 ++--
 epan/dissectors/packet-cdp.c         |    6 +--
 epan/dissectors/packet-dccp.c        |   98 ++++++++++++++++------------------
 epan/dissectors/packet-eigrp.c       |   10 +---
 epan/dissectors/packet-extreme.c     |    3 +-
 epan/dissectors/packet-flip.c        |    8 ++-
 epan/dissectors/packet-foundry.c     |    1 -
 epan/dissectors/packet-gmhdr.c       |    4 +-
 epan/dissectors/packet-gre.c         |    3 +-
 epan/dissectors/packet-hip.c         |   25 +++++----
 epan/dissectors/packet-icmp.c        |    8 +--
 epan/dissectors/packet-icmpv6.c      |   15 ++----
 epan/dissectors/packet-igmp.c        |    3 +-
 epan/dissectors/packet-ip.c          |   12 +----
 epan/dissectors/packet-ip.h          |    1 -
 epan/dissectors/packet-ipv6.c        |    7 ++-
 epan/dissectors/packet-ipvs-syncd.c  |    1 -
 epan/dissectors/packet-ixiatrailer.c |    3 +-
 epan/dissectors/packet-lmp.c         |    5 +-
 epan/dissectors/packet-nhrp.c        |    8 ++-
 epan/dissectors/packet-ospf.c        |   19 +++----
 epan/dissectors/packet-pgm.c         |    3 +-
 epan/dissectors/packet-pim.c         |   18 +++----
 epan/dissectors/packet-rsvp.c        |    3 +-
 epan/dissectors/packet-tcp.c         |   16 +++---
 epan/dissectors/packet-udp.c         |   14 ++---
 epan/dissectors/packet-vrrp.c        |   15 ++----
 epan/dissectors/packet-xtp.c         |    3 +-
 epan/in_cksum.c                      |   19 +++++++
 epan/in_cksum.h                      |   16 ++++++
 31 files changed, 158 insertions(+), 207 deletions(-)