incorrect response time calculated

Bug #1025721 reported by lazydba
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tcprstat
New
Undecided
Unassigned

Bug Description

When the watched server also act as a client, tcprstat may get wrong response time.

example:
tcprstat -l host1 -p 3306 -n 0 -t 1

if host1 also act as a client, do some communicate to a remote server on port 3306, wrong response time may be calculated.

suggested fix:

int
process_ip(pcap_t *dev, const struct ip *ip, struct timeval tv) {
    char src[16], dst[16], *addr;
    int incoming;
    unsigned len;

    addr = inet_ntoa(ip->ip_src);
    strncpy(src, addr, 15);
    src[15] = '\0';

    addr = inet_ntoa(ip->ip_dst);
    strncpy(dst, addr, 15);
    dst[15] = '\0';

    if (is_local_address(ip->ip_src))
        incoming = 0;
    else if (is_local_address(ip->ip_dst))
        incoming = 1;
    else
        return 1;

when judge a packet as inbound or outbound package, add local port:

    if (is_local_address(ip->ip_src) and src_port == 3306)
        incoming = 0;
    else if (is_local_address(ip->ip_dst) and dst_port == 3306 )
        incoming = 1;

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.