Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: RT calculation not correct under certain circumstances #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

laoar
Copy link

@laoar laoar commented Jun 5, 2017

As we can see, it will capture all the packets match with 'port' as bellow,
if (port)
sprintf(filter, "tcp port %d", port);
pcap_compile(pcap, &bpf, filter, 1, 0)

but it doesn't distinguish the src port and dst port.
If this 'server' works as 'client' and connect other server with this port,
it will generate wrong RT value.

This patch is to fix this circumstance.

As we can see, it will capture all the packets match with 'port' as bellow,
    if (port)
        sprintf(filter, "tcp port %d", port);
     pcap_compile(pcap, &bpf, filter, 1, 0)

but it doesn't distinguish the src port and dst port.
If this 'server' works as 'client' and connect other server with this port,
it will generate wrong RT value.

This patch is to fix this circumstance.
@Lowercases
Copy link
Owner

Hey @laoar , thank you for your code!

The patch looks correct -- I'll test it as I get a chance and proceed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants