Commit Graph

12 Commits

Author SHA1 Message Date
Guy Harris
57bfcb4ebe Add a routine to do the "checksum with pseudo-header" stuff for IPv4.
Clean up some other stuff while we're at it.
2011-06-17 01:09:16 -07:00
Guy Harris
d18bb2331d Use nextproto6_cksum() for XXX-over-IPv6 checksums.
Get rid of duplicated checksums with IPv6 pseudo-headers.
2011-06-17 00:51:47 -07:00
Guy Harris
94a4b46080 Go with Wireshark's Internet checksum routine.
The Wireshark routine is based on the BSD in-kernel portable checksum
routine (thus BSD-licensed); it takes a vector of pointers and lengths
and checksums the concatenation of the buffers in question (just as the
BSD in-kernel routine checksums a chain of mbufs).

This simplifies the "with a pseudo-header" checksums; hopefully it'll
fix up the problems being seen on some big-endian platforms, which might
be due to hand-calculating some or all of the checksum and doing so
incorrectly.  It also gets rid of some code that might be dereferencing
unaligned pointers.
2011-06-13 14:08:51 -07:00
Guy Harris
e8b5237589 Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from
packets, rather than just dereferencing pointers into the packet; there
is no guarantee that the packet data will be aligned on the right
boundary, and there is no guarantee that, if they're not, a direct
access will work correctly.
2010-02-21 00:27:00 -08:00
guy
7ea513de6d From Gerrit Renker:
don't compute checksums when the snapshot length is less than
	the packet length;

	combine duplicate code;

	eliminate unnecessary test.
2007-11-09 00:44:09 +00:00
hannes
8e396b5731 from Gerrit Renker <gerrit@erg.abdn.ac.uk>:
add support for variable-length checksum in DCCP, as per section 9 of RFC 4340.
remove duplicated code in dccp6_cksum (which just repeated the code of in_cksum
fix a bug in dccp.h -- the fields of CCVAL and CSCOV were swapped (see section 5.1 of RFC 4340)
fix a typo in the display of incorrect checksums
  old output `cksum xDEAD (incorrect (->  xBEEF)',
  new output `cksum xDEAD (incorrect -> xBEEF)'
2006-11-02 09:05:23 +00:00
guy
a328f56b0f From Andrea Bittau: fetch the service code in network byte order. 2006-02-19 05:08:25 +00:00
guy
5667a87a62 From Gisle Vanem: don't use GCC features such as the ability to declare
variables in the middle of the block., and #if out dccp_hdr_data()
(which is unused, and defined in such a fashion that it doesn't work on
MSVC++, with the structure name and the function name the same).
2005-12-05 21:36:24 +00:00
guy
67f9b71406 The ANSI C Committee sayeth "Thou shalt not add to a pointer to void,
for a void hath no size".
2005-11-08 02:48:14 +00:00
hannes
81f0351619 from Ian Mc Donald <imcdnzl AT gmail.com>:
displaying ACKs for close packets
2005-11-04 00:45:39 +00:00
guy
639afca94d Add RCS IDs. 2005-09-20 06:25:19 +00:00
guy
1c902dcdf3 From Ian McDonald and Arnaldo Carvalho de Melo: DCCP support. 2005-09-20 06:01:20 +00:00