mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-12 01:58:17 +00:00
Fix code format
This commit is contained in:
@ -635,9 +635,9 @@ typedef struct afl_state {
|
|||||||
u64 stats_last_stats_ms, stats_last_plot_ms, stats_last_ms, stats_last_execs;
|
u64 stats_last_stats_ms, stats_last_plot_ms, stats_last_ms, stats_last_execs;
|
||||||
|
|
||||||
/* StatsD */
|
/* StatsD */
|
||||||
u64 statsd_last_send_ms;
|
u64 statsd_last_send_ms;
|
||||||
struct sockaddr_in statsd_server;
|
struct sockaddr_in statsd_server;
|
||||||
int statsd_sock;
|
int statsd_sock;
|
||||||
|
|
||||||
double stats_avg_exec;
|
double stats_avg_exec;
|
||||||
|
|
||||||
|
@ -369,6 +369,7 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
|
|||||||
|
|
||||||
afl->afl_env.afl_statsd_host =
|
afl->afl_env.afl_statsd_host =
|
||||||
(u8 *)get_afl_env(afl_environment_variables[i]);
|
(u8 *)get_afl_env(afl_environment_variables[i]);
|
||||||
|
|
||||||
} else if (!strncmp(env, "AFL_STATSD_PORT",
|
} else if (!strncmp(env, "AFL_STATSD_PORT",
|
||||||
|
|
||||||
afl_environment_variable_len)) {
|
afl_environment_variable_len)) {
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#define METRIC_PREFIX "fuzzing"
|
#define METRIC_PREFIX "fuzzing"
|
||||||
|
|
||||||
int statsd_socket_init(afl_state_t *afl) {
|
int statsd_socket_init(afl_state_t *afl) {
|
||||||
|
|
||||||
/* Default port and host.
|
/* Default port and host.
|
||||||
Will be overwritten by AFL_STATSD_PORT and AFL_STATSD_HOST environment
|
Will be overwritten by AFL_STATSD_PORT and AFL_STATSD_HOST environment
|
||||||
variable, if they exists.
|
variable, if they exists.
|
||||||
@ -20,7 +21,12 @@ int statsd_socket_init(afl_state_t *afl) {
|
|||||||
u16 port = STATSD_DEFAULT_PORT;
|
u16 port = STATSD_DEFAULT_PORT;
|
||||||
char *host = STATSD_DEFAULT_HOST;
|
char *host = STATSD_DEFAULT_HOST;
|
||||||
|
|
||||||
if (afl->afl_env.afl_statsd_port) { port = atoi(afl->afl_env.afl_statsd_port); }
|
if (afl->afl_env.afl_statsd_port) {
|
||||||
|
|
||||||
|
port = atoi(afl->afl_env.afl_statsd_port);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (afl->afl_env.afl_statsd_host) { host = afl->afl_env.afl_statsd_host; }
|
if (afl->afl_env.afl_statsd_host) { host = afl->afl_env.afl_statsd_host; }
|
||||||
|
|
||||||
int sock;
|
int sock;
|
||||||
@ -47,7 +53,8 @@ int statsd_socket_init(afl_state_t *afl) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&(afl->statsd_server.sin_addr), &((struct sockaddr_in *)result->ai_addr)->sin_addr,
|
memcpy(&(afl->statsd_server.sin_addr),
|
||||||
|
&((struct sockaddr_in *)result->ai_addr)->sin_addr,
|
||||||
sizeof(struct in_addr));
|
sizeof(struct in_addr));
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
|
|
||||||
@ -59,8 +66,9 @@ int statsd_send_metric(afl_state_t *afl) {
|
|||||||
|
|
||||||
char buff[MAX_STATSD_PACKET_SIZE] = {0};
|
char buff[MAX_STATSD_PACKET_SIZE] = {0};
|
||||||
|
|
||||||
/* afl->statsd_sock is set once in the initialisation of afl-fuzz and reused each time
|
/* afl->statsd_sock is set once in the initialisation of afl-fuzz and reused
|
||||||
If the sendto later fail, we reset it to 0 to be able to recreates it.
|
each time If the sendto later fail, we reset it to 0 to be able to recreates
|
||||||
|
it.
|
||||||
*/
|
*/
|
||||||
if (!afl->statsd_sock) {
|
if (!afl->statsd_sock) {
|
||||||
|
|
||||||
@ -75,7 +83,8 @@ int statsd_send_metric(afl_state_t *afl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
statsd_format_metric(afl, buff, MAX_STATSD_PACKET_SIZE);
|
statsd_format_metric(afl, buff, MAX_STATSD_PACKET_SIZE);
|
||||||
if (sendto(afl->statsd_sock, buff, strlen(buff), 0, (struct sockaddr *)&afl->statsd_server,
|
if (sendto(afl->statsd_sock, buff, strlen(buff), 0,
|
||||||
|
(struct sockaddr *)&afl->statsd_server,
|
||||||
sizeof(afl->statsd_server)) == -1) {
|
sizeof(afl->statsd_server)) == -1) {
|
||||||
|
|
||||||
if (!close(afl->statsd_sock)) { perror("Cannot close socket"); }
|
if (!close(afl->statsd_sock)) { perror("Cannot close socket"); }
|
||||||
|
Reference in New Issue
Block a user