Fix build with --disable-https (#15395)
rebased
Emmanuel Vasilakis committed
Aug 31, 2023 at 11:26 UTC
b798d1b2f70a8e78cb437c5a5cc6ab9f9229e6e4
10 files changed
+27
-11
claim/claim.c
+1
-1
@@ -47,7 +47,7 @@ char *get_agent_claimid()
47
extern struct registry registry;
48
49
/* rrd_init() and post_conf_load() must have been called before this function */
50
-CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, const char **msg)
50
+CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, const char **msg __maybe_unused)
51
{
52
if (!force || !netdata_cloud_enabled) {
53
netdata_log_error("Refusing to claim agent -> cloud functionality has been disabled");
configure.ac
+1
-1
@@ -650,7 +650,7 @@ AC_C_BIGENDIAN([],
650
[AC_MSG_ERROR([Could not find out system endiannnes])])
651
652
AC_CHECK_SIZEOF(void *)
653
-if test "$ac_cv_sizeof_void_p" = 8; then
653
+if test "$ac_cv_sizeof_void_p" = 8; then
654
AC_MSG_RESULT(Detected 64-bit Build Environment)
655
LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT"
656
else
database/rrd.h
+4
-4
@@ -506,7 +506,7 @@ static inline void storage_engine_store_metric(
506
}
507
508
size_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance);
509
-static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
509
+static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
510
#ifdef ENABLE_DBENGINE
511
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
512
return rrdeng_disk_space_max(db_instance);
@@ -516,7 +516,7 @@ static inline size_t storage_engine_disk_space_max(STORAGE_ENGINE_BACKEND backen
516
}
517
518
size_t rrdeng_disk_space_used(STORAGE_INSTANCE *db_instance);
519
-static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
519
+static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
520
#ifdef ENABLE_DBENGINE
521
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
522
return rrdeng_disk_space_used(db_instance);
@@ -527,7 +527,7 @@ static inline size_t storage_engine_disk_space_used(STORAGE_ENGINE_BACKEND backe
527
}
528
529
time_t rrdeng_global_first_time_s(STORAGE_INSTANCE *db_instance);
530
-static inline time_t storage_engine_global_first_time_s(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
530
+static inline time_t storage_engine_global_first_time_s(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
531
#ifdef ENABLE_DBENGINE
532
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
533
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
537
}
538
539
size_t rrdeng_currently_collected_metrics(STORAGE_INSTANCE *db_instance);
540
-static inline size_t storage_engine_collected_metrics(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance) {
540
+static inline size_t storage_engine_collected_metrics(STORAGE_ENGINE_BACKEND backend __maybe_unused, STORAGE_INSTANCE *db_instance __maybe_unused) {
541
#ifdef ENABLE_DBENGINE
542
if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
543
return rrdeng_currently_collected_metrics(db_instance);
database/rrdhost.c
+2
@@ -1855,7 +1855,9 @@ void rrdhost_status(RRDHOST *host, time_t now, RRDHOST_STATUS *s) {
1855
1856
s->stream.since = host->sender->last_state_since_t;
1857
s->stream.peers = socket_peers(host->sender->rrdpush_sender_socket);
1858
+#ifdef ENABLE_HTTPS
1859
s->stream.ssl = SSL_connection(&host->sender->ssl);
1860
+#endif
1861
1862
memcpy(s->stream.sent_bytes_on_this_connection_per_type,
1863
host->sender->sent_bytes_on_this_connection_per_type,
exporting/send_data.c
+4
-1
@@ -2,6 +2,7 @@
2
3
#include "exporting_engine.h"
4
5
+#ifdef ENABLE_HTTPS
6
/**
7
* Check if TLS is enabled in the configuration
8
*
@@ -9,14 +10,16 @@
10
* @param options an instance data structure.
11
* @return Returns 1 if TLS should be enabled, 0 otherwise.
12
*/
12
-static int exporting_tls_is_enabled(EXPORTING_CONNECTOR_TYPE type, EXPORTING_OPTIONS options)
13
+static int exporting_tls_is_enabled(EXPORTING_CONNECTOR_TYPE type __maybe_unused, EXPORTING_OPTIONS options __maybe_unused)
14
{
15
+
16
return (type == EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP ||
17
type == EXPORTING_CONNECTOR_TYPE_JSON_HTTP ||
18
type == EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP ||
19
type == EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE) &&
20
options & EXPORTING_OPTION_USE_TLS;
21
}
22
+#endif
23
24
/**
25
* Discard response
libnetdata/libnetdata.c
+2
@@ -1942,6 +1942,7 @@ void timing_action(TIMING_ACTION action, TIMING_STEP step) {
1942
}
1943
}
1944
1945
+#ifdef ENABLE_HTTPS
1946
int hash256_string(const unsigned char *string, size_t size, char *hash) {
1947
EVP_MD_CTX *ctx;
1948
ctx = EVP_MD_CTX_create();
@@ -1966,6 +1967,7 @@ int hash256_string(const unsigned char *string, size_t size, char *hash) {
1967
EVP_MD_CTX_destroy(ctx);
1968
return 1;
1969
}
1970
+#endif
1971
1972
// Returns 1 if an absolute period was requested or 0 if it was a relative period
1973
bool rrdr_relative_window_to_absolute(time_t *after, time_t *before, time_t *now_ptr, bool unittest_running) {
netdata-installer.sh
+6
-1
@@ -299,7 +299,12 @@ while [ -n "${1}" ]; do
299
"--nightly-channel") RELEASE_CHANNEL="nightly" ;;
300
"--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-freeipmi)}" | sed 's/$/ --enable-plugin-freeipmi/g')" ;;
301
"--disable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-plugin-freeipmi)}" | sed 's/$/ --disable-plugin-freeipmi/g')" ;;
302
- "--disable-https") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-https)}" | sed 's/$/ --disable-plugin-https/g')" ;;
302
+ "--disable-https")
303
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-openssl)}" | sed 's/$/ --disable-openssl/g')"
304
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
305
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-exporting-kinesis)}" | sed 's/$/ --disable-exporting-kinesis/g')"
306
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-h2o)}" | sed 's/$/ --disable-h2o/g')"
307
+ NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-cloud)}" | sed 's/$/ --disable-cloud/g')" ;;
308
"--disable-dbengine")
309
NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
310
;;
streaming/sender.c
+2
-2
@@ -515,7 +515,7 @@ static inline bool rrdpush_sender_validate_response(RRDHOST *host, struct sender
515
return false;
516
}
517
518
-static bool rrdpush_sender_connect_ssl(struct sender_state *s) {
518
+static bool rrdpush_sender_connect_ssl(struct sender_state *s __maybe_unused) {
519
#ifdef ENABLE_HTTPS
520
RRDHOST *host = s->host;
521
bool ssl_required = host->destination && host->destination->ssl;
@@ -1181,7 +1181,7 @@ static void rrdpush_sender_thread_cleanup_callback(void *ptr) {
1181
freez(s);
1182
}
1183
1184
-void rrdpush_initialize_ssl_ctx(RRDHOST *host) {
1184
+void rrdpush_initialize_ssl_ctx(RRDHOST *host __maybe_unused) {
1185
#ifdef ENABLE_HTTPS
1186
static SPINLOCK sp = NETDATA_SPINLOCK_INITIALIZER;
1187
spinlock_lock(&sp);
web/server/static/static-threaded.c
+3
-1
@@ -242,7 +242,9 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
242
243
netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
244
245
+#ifdef ENABLE_HTTPS
246
cleanup:
247
+#endif
248
worker_is_idle();
249
return w;
250
}
@@ -499,12 +501,12 @@ void *socket_listen_main_static_threaded(void *ptr) {
501
if(!api_sockets.opened)
502
fatal("LISTENER: no listen sockets available.");
503
504
+#ifdef ENABLE_HTTPS
505
netdata_ssl_validate_certificate = !config_get_boolean(CONFIG_SECTION_WEB, "ssl skip certificate verification", !netdata_ssl_validate_certificate);
506
507
if(!netdata_ssl_validate_certificate_sender)
508
netdata_log_info("SSL: web server will skip SSL certificates verification.");
509
507
-#ifdef ENABLE_HTTPS
510
netdata_ssl_initialize_ctx(NETDATA_SSL_WEB_SERVER_CTX);
511
#endif
512
web/server/web_client.c
+2
@@ -50,6 +50,7 @@ static inline int web_client_cork_socket(struct web_client *w __maybe_unused) {
50
return 0;
51
}
52
53
+#ifdef ENABLE_HTTPS
54
static inline void web_client_enable_wait_from_ssl(struct web_client *w) {
55
if (w->ssl.ssl_errno == SSL_ERROR_WANT_READ)
56
web_client_enable_ssl_wait_receive(w);
@@ -60,6 +61,7 @@ static inline void web_client_enable_wait_from_ssl(struct web_client *w) {
61
web_client_disable_ssl_wait_send(w);
62
}
63
}
64
+#endif
65
66
static inline int web_client_uncork_socket(struct web_client *w __maybe_unused) {
67
#ifdef TCP_CORK