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

Reduce timout for alive tests #400

Merged
merged 3 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Add function to get duplicated hosts from the hosts list. [#387](https://github.com/greenbone/gvm-libs/pull/387)

### Changed
- Reduce ping timeout when using test_alive_hosts_only feature. [#400](https://github.com/greenbone/gvm-libs/pull/400)

### Fixed
- Fix port list for tcp pings when using test_alive_hosts_only feature. [#392](https://github.com/greenbone/gvm-libs/pull/392)

Expand Down
7 changes: 6 additions & 1 deletion boreas/alivedetection.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ scan (alive_test_t alive_test)
g_debug (
"%s: all ping packets have been sent, wait a bit for rest of replies.",
__func__);
sleep (WAIT_FOR_REPLIES_TIMEOUT);

/* If all targets are already indentified as alive we do not need to wait for
* replies anymore.*/
if (number_of_targets
!= (int) g_hash_table_size (scanner.hosts_data->alivehosts))
sleep (WAIT_FOR_REPLIES_TIMEOUT);

stop_sniffer_thread (&scanner, sniffer_thread_id);

Expand Down
4 changes: 2 additions & 2 deletions boreas/alivedetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
/* to how many hosts are packets send to at a time. value <= 0 for no rate limit
*/
#define BURST 100
/* how long (in msec) to wait until new BURST of packets is send */
/* how long (in microseconds) to wait until new BURST of packets is send */
#define BURST_TIMEOUT 100000
/* how tong (in sec) to wait for replies after last packet was sent */
#define WAIT_FOR_REPLIES_TIMEOUT 5
#define WAIT_FOR_REPLIES_TIMEOUT 1
/* Src port of outgoing TCP pings. Used for filtering incoming packets. */
#define FILTER_PORT 9910

Expand Down