Skip to content

False positive results #2

@cristiancundari

Description

@cristiancundari

Hi, I just noticed that to check if a ping was successful it is not enough to verify that ping_result.returncode == 0
Sometimes the gateway replay to pinging outside the network with "Destination unreachable". In this case the returncode is still 0 because it received a packet back but from the gateway and not from the actual host.

Here I found a related thread on stackoverflow

I think to solve the issue we can change the success check to something like:
if ping_result.returncode == 0 and "byte=" in ping_result.stdout.decode("utf-8"):

So that it will check the presence of the text "byte=" in the ping output or something along that line

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions