incorrect response time calculated
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(
strncpy(src, addr, 15);
src[15] = '\0';
addr = inet_ntoa(
strncpy(dst, addr, 15);
dst[15] = '\0';
if (is_local_
incoming = 0;
else if (is_local_
incoming = 1;
else
return 1;
when judge a packet as inbound or outbound package, add local port:
if (is_local_
incoming = 0;
else if (is_local_
incoming = 1;