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

Only increase num_alive if response is not a duplicate #151

Merged
merged 1 commit into from
Jun 28, 2020

Conversation

brownowski
Copy link
Contributor

Moved code block for num_alive increment. Should only increase num_alive if response is not a duplicate.

In cases where multiple pings are sent, num_alive can increase past one for a host if a duplicate ping response is received while h->num_recv ==1.

Should only increase num_alive if response is not a duplicate.  

In cases where multiple pings are sent, num_alive can increase past one for a host if a duplicate ping response is received while h->num_recv ==1.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.541% when pulling 5883c6f on brownowski:duplicate-patch-1 into 12961d5 on schweikert:develop.

@schweikert schweikert changed the title Update fping.c Only increase num_alive if response is not a duplicate Feb 29, 2020
@schweikert
Copy link
Owner

Can you explain why moving the block makes a difference?

@brownowski
Copy link
Contributor Author

It has been a while since I submitted this patch, but this is the problem to the best of my current knowledge.

There is a problem with VMWare virtual machines where if a NIC is part of a team, duplicate packets can show up on the interface.

This means that when fping is used from within this VM, it can end up seeing multiple responses for each ping it sends out.

While the existing code does flag that there are duplicate responses, there is an error with the code with how fping counts the number of received packets when there are duplicate responses, meaning that it can increase the counter for num_alive past the number of packets it has sent, and then cause it to flag an error in its return code because the received packets number doesn't match the sent packets.

In moving this code block, I'm attempting to prevent it from counting a received ping if it detects the ping response as a duplicate so that the number of received pings will not cause it to return an error code on exit.

A workaround of sorts is to limit the ping count to 1, which causes the program to exit before the duplicates are received and avoid the error in the return code.

@schweikert schweikert merged commit f5f9415 into schweikert:develop Jun 28, 2020
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.

3 participants