Browse Source

Fix build with --disable-https (#15395)

rebased
Emmanuel Vasilakis 1 year ago
parent
commit
b798d1b2f7

+ 1 - 1
claim/claim.c

@@ -47,7 +47,7 @@ char *get_agent_claimid()
 extern struct registry registry;
 extern struct registry registry;
 
 
 /* rrd_init() and post_conf_load() must have been called before this function */
 /* 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) {
     if (!force || !netdata_cloud_enabled) {
         netdata_log_error("Refusing to claim agent -> cloud functionality has been disabled");
         netdata_log_error("Refusing to claim agent -> cloud functionality has been disabled");

+ 1 - 1
configure.ac

@@ -650,7 +650,7 @@ AC_C_BIGENDIAN([],
     [AC_MSG_ERROR([Could not find out system endiannnes])])
     [AC_MSG_ERROR([Could not find out system endiannnes])])
 
 
 AC_CHECK_SIZEOF(void *)
 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)
     AC_MSG_RESULT(Detected 64-bit Build Environment)
     	LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT"
     	LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT"
 else 
 else 

+ 4 - 4
database/rrd.h

@@ -506,7 +506,7 @@ static inline void storage_engine_store_metric(
 }
 }
 
 
 size_t rrdeng_disk_space_max(STORAGE_INSTANCE *db_instance);
 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
 #ifdef ENABLE_DBENGINE
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
         return rrdeng_disk_space_max(db_instance);
         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);
 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
 #ifdef ENABLE_DBENGINE
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
         return rrdeng_disk_space_used(db_instance);
         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);
 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
 #ifdef ENABLE_DBENGINE
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
         return rrdeng_global_first_time_s(db_instance);
         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);
 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
 #ifdef ENABLE_DBENGINE
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
     if(likely(backend == STORAGE_ENGINE_BACKEND_DBENGINE))
         return rrdeng_currently_collected_metrics(db_instance);
         return rrdeng_currently_collected_metrics(db_instance);

+ 2 - 0
database/rrdhost.c

@@ -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.since = host->sender->last_state_since_t;
         s->stream.peers = socket_peers(host->sender->rrdpush_sender_socket);
         s->stream.peers = socket_peers(host->sender->rrdpush_sender_socket);
+#ifdef ENABLE_HTTPS
         s->stream.ssl = SSL_connection(&host->sender->ssl);
         s->stream.ssl = SSL_connection(&host->sender->ssl);
+#endif
 
 
         memcpy(s->stream.sent_bytes_on_this_connection_per_type,
         memcpy(s->stream.sent_bytes_on_this_connection_per_type,
                host->sender->sent_bytes_on_this_connection_per_type,
                host->sender->sent_bytes_on_this_connection_per_type,

+ 4 - 1
exporting/send_data.c

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

+ 2 - 0
libnetdata/libnetdata.c

@@ -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) {
 int hash256_string(const unsigned char *string, size_t size, char *hash) {
     EVP_MD_CTX *ctx;
     EVP_MD_CTX *ctx;
     ctx = EVP_MD_CTX_create();
     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);
     EVP_MD_CTX_destroy(ctx);
     return 1;
     return 1;
 }
 }
+#endif
 
 
 // Returns 1 if an absolute period was requested or 0 if it was a relative period
 // 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) {
 bool rrdr_relative_window_to_absolute(time_t *after, time_t *before, time_t *now_ptr, bool unittest_running) {

+ 6 - 1
netdata-installer.sh

@@ -299,7 +299,12 @@ while [ -n "${1}" ]; do
     "--nightly-channel") RELEASE_CHANNEL="nightly" ;;
     "--nightly-channel") RELEASE_CHANNEL="nightly" ;;
     "--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-freeipmi)}" | sed 's/$/ --enable-plugin-freeipmi/g')" ;;
     "--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-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")
     "--disable-dbengine")
       NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
       NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-dbengine)}" | sed 's/$/ --disable-dbengine/g')"
       ;;
       ;;

+ 2 - 2
streaming/sender.c

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

+ 3 - 1
web/server/static/static-threaded.c

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

+ 2 - 0
web/server/web_client.c

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