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

Utils / network: improvements to ping_flood() #6063

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

clebergnu
Copy link
Contributor

This contains a number of improvements to the ping_flood() utility.

It's not possible for regular users to flood ping without a interval
of less than 2 ms:

   ping: cannot flood, minimal interval for user must be >= 2 ms, use -i 0.002 (or higher)

Given that it's a fact, let's improve the odds of this function
behaving well by not causing the ping utility to simply error out in
such situations.

Signed-off-by: Cleber Rosa <[email protected]>
The implementation of ping_flood() counts on the output generated by
the ping command line utility.  But, the way and amount of data it
reads looking for the failure pattern is both too small and is
susceptible to timing issues.

In order to minimize those possibilities, let's send error
messages (which will never contain the info this function is looking
for) to another file.  It also allows to use that as an improvement to
the log messages.

Signed-off-by: Cleber Rosa <[email protected]>
The ping_flood() function is a bit delicate, and further improvements
are needed.  To make sure we introduce improvements and not
regressions, let's add some basic functional tests.

Signed-off-by: Cleber Rosa <[email protected]>
…tests

We have the name of the suite, so let's give it to users when printing
out a possible mismatch.

Signed-off-by: Cleber Rosa <[email protected]>
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.52%. Comparing base (6b55d5a) to head (e69d607).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
avocado/utils/network/interfaces.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6063      +/-   ##
==========================================
+ Coverage   54.46%   54.52%   +0.06%     
==========================================
  Files         202      202              
  Lines       21883    21884       +1     
==========================================
+ Hits        11919    11933      +14     
+ Misses       9964     9951      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clebergnu clebergnu marked this pull request as draft November 4, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review Requested
Development

Successfully merging this pull request may close these issues.

1 participant