0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-13 17:19:11 +00:00

Fix build with --disable-https ()

rebased
This commit is contained in:
Emmanuel Vasilakis 2023-08-31 11:26:06 +03:00 committed by GitHub
parent e9989c5193
commit b798d1b2f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 27 additions and 11 deletions

View file

@ -47,7 +47,7 @@ char *get_agent_claimid()
extern struct registry registry;
/* rrd_init() and post_conf_load() must have been called before this function */
CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, const char **msg)
CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, const char **msg __maybe_unused)
{
if (!force || !netdata_cloud_enabled) {
netdata_log_error("Refusing to claim agent -> cloud functionality has been disabled");

View file

@ -650,7 +650,7 @@ AC_C_BIGENDIAN([],
[AC_MSG_ERROR([Could not find out system endiannnes])])
AC_CHECK_SIZEOF(void *)
if test "$ac_cv_sizeof_void_p" = 8; then
if test "$ac_cv_sizeof_void_p" = 8; then
AC_MSG_RESULT(Detected 64-bit Build Environment)
LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT"
else

View file

@ -506,7 +506,7 @@ static inline void storage_engine_store_metric(
}
size_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance);
static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
#ifdef ENABLE_DBENGINE
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
return rrdeng_disk_space_max(db_instance);
@ -516,7 +516,7 @@ static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backen
}
size_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance);
static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
#ifdef ENABLE_DBENGINE
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
return rrdeng_disk_space_used(db_instance);
@ -527,7 +527,7 @@ static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backe
}
time_t rrdeng_global_first_time_s(STORAGE_INSTANCE *db_instance);
static inline time_t storage_engine_global_first_time_s(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
static inline time_t storage_engine_global_first_time_s(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
#ifdef ENABLE_DBENGINE
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
return rrdeng_global_first_time_s(db_instance);
@ -537,7 +537,7 @@ static inline time_t storage_engine_global_first_time_s(STORAGE_ENGINE_BACKEND b
}
size_t rrdeng_currently_collected_metrics(STORAGE_INSTANCE *db_instance);
static inline size_t storage_engine_collected_metrics(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
static inline size_t storage_engine_collected_metrics(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
#ifdef ENABLE_DBENGINE
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
return rrdeng_currently_collected_metrics(db_instance);

View file

@ -1855,7 +1855,9 @@ void rrdhost_status(RRDHOST *host, time_t now, RRDHOST_STATUS *s) {
s->stream.since = host->sender->last_state_since_t;
s->stream.peers = socket_peers(host->sender->rrdpush_sender_socket);
#ifdef ENABLE_HTTPS
s->stream.ssl = SSL_connection(&host->sender->ssl);
#endif
memcpy(s->stream.sent_bytes_on_this_connection_per_type,
host->sender->sent_bytes_on_this_connection_per_type,

View file

@ -2,6 +2,7 @@
#include "exporting_engine.h"
#ifdef ENABLE_HTTPS
/**
* Check if TLS is enabled in the configuration
*
@ -9,14 +10,16 @@
* @param options an instance data structure.
* @return Returns 1 if TLS should be enabled, 0 otherwise.
*/
static int exporting_tls_is_enabled(EXPORTING_CONNECTOR_TYPE type, EXPORTING_OPTIONS options)
static int exporting_tls_is_enabled(EXPORTING_CONNECTOR_TYPE type __maybe_unused, EXPORTING_OPTIONS options __maybe_unused)
{
return (type == EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP ||
type == EXPORTING_CONNECTOR_TYPE_JSON_HTTP ||
type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP ||
type == EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE) &&
options & EXPORTING_OPTION_USE_TLS;
}
#endif
/**
* Discard response

View file

@ -1942,6 +1942,7 @@ void timing_action(TIMING_ACTION action, TIMING_STEP step) {
}
}
#ifdef ENABLE_HTTPS
int hash256_string(const unsigned char *string, size_t size, char *hash) {
EVP_MD_CTX *ctx;
ctx = EVP_MD_CTX_create();
@ -1966,6 +1967,7 @@ int hash256_string(const unsigned char *string, size_t size, char *hash) {
EVP_MD_CTX_destroy(ctx);
return 1;
}
#endif
// Returns 1 if an absolute period was requested or 0 if it was a relative period
bool rrdr_relative_window_to_absolute(time_t *after, time_t *before, time_t *now_ptr, bool unittest_running) {

View file

@ -299,7 +299,12 @@ while [ -n "${1}" ]; do
"--nightly-channel") RELEASE_CHANNEL="nightly" ;;
"--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-freeipmi)}" | sed 's/$/ --enable-plugin-freeipmi/g')" ;;
"--disable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-plugin-freeipmi)}" | sed 's/$/ --disable-plugin-freeipmi/g')" ;;
"--disable-https") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-https)}" | sed 's/$/ --disable-plugin-https/g')" ;;
"--disable-https")
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-openssl)}" | sed 's/$/ --disable-openssl/g')"
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-exporting-kinesis)}" | sed 's/$/ --disable-exporting-kinesis/g')"
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-h2o)}" | sed 's/$/ --disable-h2o/g')"
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-cloud)}" | sed 's/$/ --disable-cloud/g')" ;;
"--disable-dbengine")
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
;;

View file

@ -515,7 +515,7 @@ static inline bool rrdpush_sender_validate_response(RRDHOST *host, struct sender
return false;
}
static bool rrdpush_sender_connect_ssl(struct sender_state *s) {
static bool rrdpush_sender_connect_ssl(struct sender_state *s __maybe_unused) {
#ifdef ENABLE_HTTPS
RRDHOST *host = s->host;
bool ssl_required = host->destination && host->destination->ssl;
@ -1181,7 +1181,7 @@ static void rrdpush_sender_thread_cleanup_callback(void *ptr) {
freez(s);
}
void rrdpush_initialize_ssl_ctx(RRDHOST *host) {
void rrdpush_initialize_ssl_ctx(RRDHOST *host __maybe_unused) {
#ifdef ENABLE_HTTPS
static SPINLOCK sp = NETDATA_SPINLOCK_INITIALIZER;
spinlock_lock(&sp);

View file

@ -242,7 +242,9 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
#ifdef ENABLE_HTTPS
cleanup:
#endif
worker_is_idle();
return w;
}
@ -499,12 +501,12 @@ void *socket_listen_main_static_threaded(void *ptr) {
if(!api_sockets.opened)
fatal("LISTENER: no listen sockets available.");
#ifdef ENABLE_HTTPS
netdata_ssl_validate_certificate = !config_get_boolean(CONFIG_SECTION_WEB, "ssl skip certificate verification", !netdata_ssl_validate_certificate);
if(!netdata_ssl_validate_certificate_sender)
netdata_log_info("SSL: web server will skip SSL certificates verification.");
#ifdef ENABLE_HTTPS
netdata_ssl_initialize_ctx(NETDATA_SSL_WEB_SERVER_CTX);
#endif

View file

@ -50,6 +50,7 @@ static inline int web_client_cork_socket(struct web_client *w __maybe_unused) {
return 0;
}
#ifdef ENABLE_HTTPS
static inline void web_client_enable_wait_from_ssl(struct web_client *w) {
if (w->ssl.ssl_errno == SSL_ERROR_WANT_READ)
web_client_enable_ssl_wait_receive(w);
@ -60,6 +61,7 @@ static inline void web_client_enable_wait_from_ssl(struct web_client *w) {
web_client_disable_ssl_wait_send(w);
}
}
#endif
static inline int web_client_uncork_socket(struct web_client *w __maybe_unused) {
#ifdef TCP_CORK