/*
* Netgrind -- IP Layer Analyser
*
- * (c) 2003 Martin Mares <mj@ucw.cz>
+ * (c) 2003--2013 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU General Public License.
#include <netinet/in.h>
#include <netinet/ip.h>
+uns accept_broken_checksums;
+
uns tcpip_calc_checksum(void *data, uns len, uns csum)
{
/* FIXME: This is awfully slow and it probably consumes most of our run time */
uns tcpip_verify_checksum(uns csum)
{
- return (csum == 0xffff);
+ if (accept_broken_checksums)
+ return 1;
+ else
+ return (csum == 0xffff);
}
struct pkt_stats stat_ip_in, stat_ip_invalid, stat_ip_uninteresting, stat_ip_fragmented, stat_ip_badsum;
fprintf(stderr, "Usage: netgrind [<switches>] <capture-files>\n\
\n\
-a TCP: Record arrival times instead of processing times\n\
+-b Accept broken checksums\n\
-c <count> Stop after processing <count> packets\n\
-d <dir> Dump connections to a given directory\n\
-D <dir> Dump connections with more details\n\
byte *histogram = NULL;
tcp_default_appl = &appl_mux;
- while ((c = getopt(argc, argv, "ac:d:D:f:h:stwx:")) >= 0)
+ while ((c = getopt(argc, argv, "abc:d:D:f:h:stwx:")) >= 0)
switch (c)
{
case 'a':
tcp_arrival_times = 1;
break;
+ case 'b':
+ accept_broken_checksums = 1;
+ break;
case 'c':
max_packets = atol(optarg);
break;
/* ip.c */
extern struct pkt_stats stat_ip_in, stat_ip_invalid, stat_ip_uninteresting, stat_ip_fragmented, stat_ip_badsum;
+extern uns accept_broken_checksums;
uns tcpip_calc_checksum(void *data, uns len, uns csum);
uns tcpip_verify_checksum(uns csum);