source: tools/tracereport/error_report.c @ a1b899f

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since a1b899f was a1b899f, checked in by Shane Alcock <salcock@…>, 14 years ago

Libtrace now exports the svn revision number of the distribution
Added two new RT_TYPES that signify server restarts and client connection failures.
Updated the INSTALL documentation.
Added more option combinations to synopt_report.c
The examples directory is no longer treated as EXTRA_DIST in automake

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#include <netdb.h>
2#include <inttypes.h>
3#include <lt_inttypes.h>
4#include <stdio.h>
5#include "libtrace.h"
6#include "tracereport.h"
7
8static uint64_t rx_errors = 0;
9static uint64_t ip_errors = 0;
10static uint64_t tcp_errors = 0;
11
12void error_per_packet(struct libtrace_packet_t *packet)
13{
14        struct libtrace_ip *ip = trace_get_ip(packet);
15        struct libtrace_tcp *tcp = trace_get_tcp(packet);
16        void *link = trace_get_link(packet);
17        if (!link) {
18                ++rx_errors;
19        }
20       
21        /* This isn't quite as simple as it seems.
22         *
23         * If the packets were captured via wdcap's anonymisation module,
24         * the checksum is set to 1 when it is correct and 0 if incorrect.
25         *
26         * Earlier versions of wdcap appear to set the checksum the other
27         * way around.
28         *
29         * If a different capture method is used, there's a good chance the
30         * checksum has not been altered
31         */
32        if (ip) {
33                if (ntohs(ip->ip_sum)!=0)
34                        ++ip_errors;
35        }
36        if (tcp) {
37                if (ntohs(tcp->check)!=0)
38                        ++tcp_errors;
39        }
40}
41
42void error_report(void)
43{
44        printf("# Errors:\n");
45        printf("RX Errors: %" PRIu64 "\n",rx_errors);
46        printf("IP Checksum errors: %" PRIu64 "\n",ip_errors);
47        /*printf("TCP Checksum errors: %" PRIu64 "\n",tcp_errors); */
48}
Note: See TracBrowser for help on using the repository browser.