Commit Graph

15 Commits

Author SHA1 Message Date
John Thacker 84141d45c2 TCP, UDP: Calculate partial (pseudo header) checksums for offload
Linux and Windows, at least, when performing Local Checksum Offload
during Generic Segmentation Offload and at other times, place the one's
complement sum of the pseudo header in the checksum field, which
provides the necessary correction when a device (or its driver,
if not supported in hardware) computes the one's complement checksum
of each inner layer buffer in the skbuff. (This is why GSO requires
equal length buffers - so that the pseudo header contribution to
the checksum is the same.)

When performing our Internet checksum calculation, we can output
the partial sum of all but the last vector, which is an intermediate
result we calculate in the process anyway. The last vector is
generally the payload, and the previous vectors are for the pseudo
header. We can then compare this partial sum to the value in the
UDP or TCP header if the overall computed checksum isn't 0.
If it matches appropriately, we can have a more informative and
less scary message.

Update the tests a bit because this causes checksums to no longer
fail and be reported malformed in the http2 reassembly example.

Fix #18864. Related to #19109
2023-11-11 10:12:49 -05:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Dario Lombardo 5a94c7d14e epan: more SPDX convertions.
Change-Id: I3c9ba4542c50321ce60cba68696d99575a735392
Reviewed-on: https://code.wireshark.org/review/25708
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09 14:41:31 +00:00
João Valverde d21295f9a6 Bump GLib minimum required version to 2.22.0
Change-Id: I0ab85be8090f234f9ca10914063f97f13c894413
Reviewed-on: https://code.wireshark.org/review/16879
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-04 16:13:41 +00:00
Anders 049fc494d0 Fix MSCV 2015RC Warning in_cksum.c(92): warning C4311: 'type cast':
pointer truncation from 'const guint16 *' to 'unsigned long'.


Even if we only require GLIB 2.16 this will fix the Windows build as we do
have a newer Glib on Windows.

Change-Id: Ie0644536783e8b298de59094fec240e249c9b27f
Reviewed-on: https://code.wireshark.org/review/8833
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-08 11:13:23 +00:00
Bill Meier 23e78cd6bd Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-10 14:50:08 +00:00
Guy Harris ebff85fdbb 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>
2014-08-09 01:09:34 +00:00
Pascal Quantin 75a67e6991 Fix warnings introduced in g2965913
Change-Id: I7b0fedf0c508404b3f2dea789f50b7b5db4e2eb7
Reviewed-on: https://code.wireshark.org/review/502
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-04 16:39:02 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Guy Harris ed71fe8caf Attempt to squelch some compiler warnings.
svn path=/trunk/; revision=37677
2011-06-16 03:56:08 +00:00
Guy Harris b07cd62d07 We deal with pointer alignment ourselves, so we ensure the casts are
safe.  Tell the compiler so.

svn path=/trunk/; revision=36796
2011-04-22 04:04:20 +00:00
Stephen Fisher 573b4d449f Add a note to the top about r35589's change of the ADDCARRY(x) macro.
svn path=/trunk/; revision=35592
2011-01-19 22:57:19 +00:00
Stephen Fisher c732e15d77 Change the ADDCARRY(x) macro to eliminate clang warning about unused
result from the ADDCARRY portion of the REDUCE macro.

-#define ADDCARRY(x)  (x > 65535 ? x -= 65535 : x)
+#define ADDCARRY(x)  {if ((x) > 65535) (x) -= 65535;}

The new code is from in_cksum.c in the Tahoe/CGI port of 4.4BSD-Lite2 (we're
using the "Portable Version" copy otherwise).


svn path=/trunk/; revision=35589
2011-01-19 22:53:38 +00:00
Guy Harris ac98f225a8 Move various checksum routines and headers to epan.
svn path=/trunk/; revision=12117
2004-09-28 00:06:32 +00:00