Skip to content

Commit

Permalink
Merge pull request #727 from greenbone/mergify/bp/openvas-20.08/pr-725
Browse files Browse the repository at this point in the history
Use host from the orignal hosts list when boreas is enabled (backport #725)
  • Loading branch information
jjnicola authored May 4, 2021
2 parents bdb5df6 + 41404a6 commit e37a65e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix message to the client if there is a iface problem. [#695](https://github.com/greenbone/openvas/pull/695)
- Fix SIGSEGV when no best route is found. [#702](https://github.com/greenbone/openvas/pull/702)
- Fix host count when reverse_lookup_only is enabled. [#715](https://github.com/greenbone/openvas/pull/715)
- Use host from the orignal hosts list when boreas is enabled. Backport of [PR #727](https://github.com/greenbone/openvas/pull/727). [#725](https://github.com/greenbone/openvas/pull/725)

### Removed
- Remove code from the openvas daemon era. Do not flushall redis. [#689](https://github.com/greenbone/openvas/pull/689)
Expand Down
24 changes: 19 additions & 5 deletions src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ attack_network (struct scan_globals *globals)
gboolean ad_finished = FALSE;
int err;
pthread_t tid;
struct in6_addr tmpaddr;

/* Reset the iterator. */
hosts->current = 0;
Expand All @@ -1177,11 +1178,16 @@ attack_network (struct scan_globals *globals)
{
fork_sleep (1);
}
if (host)
g_debug ("%s: Get first host to test from Queue. This host is used for "
"initialising the alive_hosts_list.",
__func__);

if (gvm_host_get_addr6 (host, &tmpaddr) == 0)
host = gvm_host_find_in_hosts (host, &tmpaddr, hosts);
if (host)
{
g_debug (
"%s: Get first host to test from Queue. This host is used for "
"initialising the alive_hosts_list.",
__func__);
}
alive_hosts_list = gvm_hosts_new (gvm_host_value_str (host));
}

Expand Down Expand Up @@ -1257,6 +1263,8 @@ attack_network (struct scan_globals *globals)

if (test_alive_hosts_only)
{
struct in6_addr tmpaddr;

/* Boolean signalling if alive detection finished. */
gboolean ad_finished = FALSE;
for (host = get_host_from_queue (alive_hosts_kb, &ad_finished);
Expand All @@ -1265,8 +1273,14 @@ attack_network (struct scan_globals *globals)
{
fork_sleep (1);
}

if (gvm_host_get_addr6 (host, &tmpaddr) == 0)
host = gvm_host_find_in_hosts (host, &tmpaddr, hosts);

if (host)
gvm_hosts_add (alive_hosts_list, host);
{
gvm_hosts_add (alive_hosts_list, host);
}
else
g_debug ("%s: got NULL host, stop/finish scan", __func__);
}
Expand Down

0 comments on commit e37a65e

Please sign in to comment.