|
OpenVAS Scanner
7.0.1~git
|
Manages the launching of plugins within processes. More...
#include "pluginlaunch.h"#include "../misc/network.h"#include "../misc/nvt_categories.h"#include "pluginload.h"#include "pluginscheduler.h"#include "plugs_req.h"#include "processes.h"#include "sighand.h"#include "utils.h"#include <errno.h>#include <gvm/base/prefs.h>#include <gvm/util/nvticache.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <sys/time.h>#include <sys/wait.h>#include <unistd.h>
Go to the source code of this file.
Data Structures | |
| struct | running |
| Structure to represent a process in the sense of a running NVT. More... | |
Macros | |
| #define | G_LOG_DOMAIN "sd main" |
| GLib log domain. More... | |
| #define | MAX_PROCESSES 32 |
| 'Hard' limit of the max. number of concurrent plugins per host. More... | |
Functions | |
| static void | update_running_processes (kb_t kb) |
| static int | common (GSList *list1, GSList *list2) |
| static GSList * | required_ports_in_list (const char *oid, GSList *list) |
| static int | simult_ports (const char *oid, const char *next_oid) |
| static int | next_free_process (kb_t kb, struct scheduler_plugin *upcoming) |
| void | pluginlaunch_init (const char *host) |
| void | pluginlaunch_disable_parallel_checks (void) |
| void | pluginlaunch_enable_parallel_checks (void) |
| void | pluginlaunch_stop () |
| static int | plugin_timeout (nvti_t *nvti) |
| int | plugin_launch (struct scan_globals *globals, struct scheduler_plugin *plugin, struct in6_addr *ip, GSList *vhosts, kb_t kb, nvti_t *nvti) |
| void | pluginlaunch_wait (kb_t kb) |
| Waits and 'pushes' processes until num_running_processes is 0. More... | |
| static int | timeout_running_processes () |
| Return shortest timeout of the running processes. More... | |
| void | pluginlaunch_wait_for_free_process (kb_t kb) |
| Waits and 'pushes' processes until the number of running processes has changed. More... | |
Variables | |
| static struct running | processes [MAX_PROCESSES] |
| static int | num_running_processes |
| static int | max_running_processes |
| static int | old_max_running_processes |
| static GSList * | non_simult_ports = NULL |
| const char * | hostname = NULL |
Manages the launching of plugins within processes.
Definition in file pluginlaunch.c.
| #define G_LOG_DOMAIN "sd main" |
GLib log domain.
Definition at line 52 of file pluginlaunch.c.
| #define MAX_PROCESSES 32 |
'Hard' limit of the max. number of concurrent plugins per host.
Definition at line 57 of file pluginlaunch.c.
|
static |
Definition at line 168 of file pluginlaunch.c.
Referenced by simult_ports().

|
static |
If another NVT with same port requirements is running, wait.
Definition at line 242 of file pluginlaunch.c.
References MAX_PROCESSES, scheduler_plugin::oid, pid, process_alive(), processes, simult_ports(), and update_running_processes().
Referenced by plugin_launch().


| int plugin_launch | ( | struct scan_globals * | globals, |
| struct scheduler_plugin * | plugin, | ||
| struct in6_addr * | ip, | ||
| GSList * | vhosts, | ||
| kb_t | kb, | ||
| nvti_t * | nvti | ||
| ) |
Definition at line 343 of file pluginlaunch.c.
References nasl_plugin_launch(), next_free_process(), num_running_processes, scheduler_plugin::oid, running::pid, pid, running::plugin, PLUGIN_STATUS_UNRUN, plugin_timeout(), pluginlaunch_wait_for_free_process(), processes, scheduler_plugin::running_state, and running::timeout.
Referenced by launch_plugin().


|
static |
Definition at line 319 of file pluginlaunch.c.
References ACT_SCANNER.
Referenced by plugin_launch().

| void pluginlaunch_disable_parallel_checks | ( | void | ) |
Definition at line 290 of file pluginlaunch.c.
References max_running_processes.
Referenced by get_next_in_range().

| void pluginlaunch_enable_parallel_checks | ( | void | ) |
Definition at line 296 of file pluginlaunch.c.
References max_running_processes, and old_max_running_processes.
Referenced by get_next_in_range().

| void pluginlaunch_init | ( | const char * | host | ) |
Definition at line 265 of file pluginlaunch.c.
References get_max_checks_number(), hostname, MAX_PROCESSES, max_running_processes, non_simult_ports, num_running_processes, old_max_running_processes, and processes.
Referenced by attack_host().


| void pluginlaunch_stop | ( | ) |
Definition at line 302 of file pluginlaunch.c.
References MAX_PROCESSES, num_running_processes, pid, running::plugin, PLUGIN_STATUS_DONE, processes, scheduler_plugin::running_state, and terminate_process().
Referenced by attack_host(), handle_scan_stop_signal(), and launch_plugin().


| void pluginlaunch_wait | ( | kb_t | kb | ) |
Waits and 'pushes' processes until num_running_processes is 0.
Definition at line 370 of file pluginlaunch.c.
References num_running_processes, and update_running_processes().
Referenced by attack_host().


| void pluginlaunch_wait_for_free_process | ( | kb_t | kb | ) |
Waits and 'pushes' processes until the number of running processes has changed.
Definition at line 403 of file pluginlaunch.c.
References max_running_processes, num_running_processes, timeout_running_processes(), and update_running_processes().
Referenced by attack_host(), and plugin_launch().


|
static |
Definition at line 188 of file pluginlaunch.c.
References oid.
Referenced by simult_ports().

|
static |
Definition at line 220 of file pluginlaunch.c.
References common(), non_simult_ports, oid, and required_ports_in_list().
Referenced by next_free_process().


|
static |
Return shortest timeout of the running processes.
Definition at line 384 of file pluginlaunch.c.
References MAX_PROCESSES, pid, processes, and running::timeout.
Referenced by pluginlaunch_wait_for_free_process().

|
static |
Definition at line 82 of file pluginlaunch.c.
References MAX_PROCESSES, name, num_running_processes, scheduler_plugin::oid, oid, pid, running::plugin, PLUGIN_STATUS_DONE, process_alive(), processes, scheduler_plugin::running_state, running::start, terminate_process(), running::timeout, and timeval().
Referenced by next_free_process(), pluginlaunch_wait(), and pluginlaunch_wait_for_free_process().


| const char* hostname = NULL |
Definition at line 76 of file pluginlaunch.c.
Referenced by _http_req(), comm_send_status(), get_hostname(), nasl_open_sock_kdc(), nasl_this_host(), nasl_this_host_name(), open_sock_opt_hn(), open_SSL_connection(), open_stream_connection_ext(), plug_add_host_fqdn(), plug_get_host_source(), pluginlaunch_init(), proto_post_wrapped(), socket_negotiate_ssl(), and v6_openbpf().
|
static |
Definition at line 73 of file pluginlaunch.c.
Referenced by pluginlaunch_disable_parallel_checks(), pluginlaunch_enable_parallel_checks(), pluginlaunch_init(), and pluginlaunch_wait_for_free_process().
|
static |
Definition at line 75 of file pluginlaunch.c.
Referenced by pluginlaunch_init(), and simult_ports().
|
static |
Definition at line 72 of file pluginlaunch.c.
Referenced by plugin_launch(), pluginlaunch_init(), pluginlaunch_stop(), pluginlaunch_wait(), pluginlaunch_wait_for_free_process(), and update_running_processes().
|
static |
Definition at line 74 of file pluginlaunch.c.
Referenced by pluginlaunch_enable_parallel_checks(), and pluginlaunch_init().
|
static |
Definition at line 71 of file pluginlaunch.c.
Referenced by next_free_process(), plugin_launch(), pluginlaunch_init(), pluginlaunch_stop(), timeout_running_processes(), and update_running_processes().