aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-08 13:15:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-08 13:15:15 +0100
commiteb737947eb2afe98f9dac1121fa37d1b746c5657 (patch)
tree02aa7752555cc4a47b1a9b423066bbdc52a7e8c5
parente0bfa35ee937940f20a5675bc7582cfc83c2866b (diff)
downloadrspamd-eb737947eb2afe98f9dac1121fa37d1b746c5657.tar.gz
rspamd-eb737947eb2afe98f9dac1121fa37d1b746c5657.zip
Reorganize includes to reduce namespace pollution.
-rw-r--r--config.h.in168
-rw-r--r--contrib/aho-corasick/acism.c1
-rw-r--r--contrib/cdb/cdb.h2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/client/rspamc.c6
-rw-r--r--src/client/rspamdclient.c2
-rw-r--r--src/client/rspamdclient.h1
-rw-r--r--src/controller.c5
-rw-r--r--src/http_proxy.c1
-rw-r--r--src/libmime/filter.c12
-rw-r--r--src/libmime/message.h1
-rw-r--r--src/libmime/smtp_proto.c1
-rw-r--r--src/libmime/smtp_utils.c3
-rw-r--r--src/libserver/buffer.c1
-rw-r--r--src/libserver/cfg_rcl.c11
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/dynamic_cfg.c1
-rw-r--r--src/libserver/fuzzy_backend.c1
-rw-r--r--src/libserver/proxy.c1
-rw-r--r--src/libserver/proxy.h1
-rw-r--r--src/libserver/roll_history.c1
-rw-r--r--src/libserver/spf.h1
-rw-r--r--src/libserver/symbols_cache.c2
-rw-r--r--src/libserver/symbols_cache.h2
-rw-r--r--src/libserver/task.c1
-rw-r--r--src/libserver/task.h2
-rw-r--r--src/libserver/worker_util.c4
-rw-r--r--src/libstat/backends/mmaped_file.c2
-rw-r--r--src/libstat/backends/sqlite3_backend.c1
-rw-r--r--src/libstat/classifiers/bayes.c1
-rw-r--r--src/libutil/addr.c11
-rw-r--r--src/libutil/addr.h15
-rw-r--r--src/libutil/aio_event.c2
-rw-r--r--src/libutil/http.c2
-rw-r--r--src/libutil/logger.c12
-rw-r--r--src/libutil/map.c1
-rw-r--r--src/libutil/map.h2
-rw-r--r--src/libutil/mem_pool.c5
-rw-r--r--src/libutil/printf.c6
-rw-r--r--src/libutil/rrd.c2
-rw-r--r--src/libutil/sqlite_utils.c1
-rw-r--r--src/libutil/str_util.c2
-rw-r--r--src/libutil/unix-std.h88
-rw-r--r--src/libutil/util.c27
-rw-r--r--src/libutil/util.h5
-rw-r--r--src/lua/lua_buffer.c2
-rw-r--r--src/lua/lua_cfg_file.c3
-rw-r--r--src/lua/lua_http.c1
-rw-r--r--src/lua/lua_rsa.c1
-rw-r--r--src/lua/lua_tcp.c1
-rw-r--r--src/lua/lua_util.c1
-rw-r--r--src/lua_worker.c1
-rw-r--r--src/plugins/fuzzy_check.c6
-rw-r--r--src/plugins/regexp.c1
-rw-r--r--src/plugins/spf.c1
-rw-r--r--src/plugins/surbl.c5
-rw-r--r--src/plugins/surbl.h1
-rw-r--r--src/rspamadm/pw.c1
-rw-r--r--src/rspamadm/rspamadm.c5
-rw-r--r--src/rspamd.c35
-rw-r--r--src/smtp_proxy.c1
-rw-r--r--test/rspamd_async_test.c4
-rw-r--r--test/rspamd_cryptobox_test.c1
-rw-r--r--test/rspamd_http_test.c6
-rw-r--r--test/rspamd_lua_test.c5
-rw-r--r--test/rspamd_mem_pool_test.c6
-rw-r--r--test/rspamd_shingles_test.c2
-rw-r--r--test/rspamd_test_suite.c2
-rw-r--r--test/rspamd_upstream_test.c2
69 files changed, 298 insertions, 217 deletions
diff --git a/config.h.in b/config.h.in
index da476a758..693a9380e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -281,53 +281,6 @@
#include <stdbool.h>
#endif
-/* queue */
-#ifdef HAVE_COMPATIBLE_QUEUE_H
-#ifdef HAVE_SYS_QUEUE_H
-#include <sys/queue.h>
-#endif
-#else
-#include "queue.h"
-#endif
-
-/* sys/socket */
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-/* sys/file.h */
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-/* sys/uio.h */
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-/* sys/mman */
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-/* netinet issues */
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-/* unix sockets */
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-
-/* netdb */
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
/* stdlib */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -343,124 +296,17 @@
#include <time.h>
#endif
-/* timedb */
-#ifdef HAVE_SYS_TIMEB_H
-#include <sys/timeb.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* sysexits */
-#ifdef HAVE_SYSEXITS_H
-#include <sysexits.h>
-#endif
-
-/* unistd */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
#endif
-
/* string */
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-/* strings */
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-/* fcntl */
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-/* Linux specific falloc.h */
-#ifdef HAVE_LINUX_FALLOC_H
-#include <linux/falloc.h>
-#endif
-
-/* poll */
-#ifdef HAVE_POLL_H
-#include <poll.h>
-#endif
-
-/* sys/stat */
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-/* sys/wait */
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-/* sys/resource.h */
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-/* math */
-#ifdef HAVE_MATH_H
-#include <math.h>
-#endif
-
-/* libutil */
-#ifdef HAVE_LIBUTIL_H
-#include <libutil.h>
-#endif
-
-/* pwd and grp */
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-
-#ifdef HAVE_GLOB_H
-#include <glob.h>
-#endif
-
-/* syslog */
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#define HAVE_DIRNAME 1
-#endif
-
-#ifdef HAVE_SEARCH_H
-#include <search.h>
-#endif
-
-#ifdef WITH_GPERF_TOOLS
-#include <google/profiler.h>
-#endif
-
-#ifdef HAVE_SCHED_YIELD
-#include <sched.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
#include <errno.h>
-#include <signal.h>
-#ifdef HAVE_SIGINFO_H
-# include <siginfo.h>
-#endif
-#include <event.h>
-#if _EVENT_NUMERIC_VERSION > 0x02000000
-# include <event2/thread.h>
-#endif
+
#include <glib.h>
@@ -478,14 +324,6 @@
typedef off_t goffset;
#endif
-#ifndef BUILD_STATIC
-#include <gmodule.h>
-#endif
-
-#ifndef NO_GMIME
-#include <gmime/gmime.h>
-#endif
-
#ifndef ALIGN
#if defined(_MSC_VER)
# define ALIGN(x) __declspec(align(x))
diff --git a/contrib/aho-corasick/acism.c b/contrib/aho-corasick/acism.c
index 64e1eb956..111704805 100644
--- a/contrib/aho-corasick/acism.c
+++ b/contrib/aho-corasick/acism.c
@@ -18,6 +18,7 @@
*/
#include "_acism.h"
+#include "unix-std.h"
#define BACK ((SYMBOL)0)
#define ROOT ((STATE) 0)
diff --git a/contrib/cdb/cdb.h b/contrib/cdb/cdb.h
index 03da9ac41..959c24f1f 100644
--- a/contrib/cdb/cdb.h
+++ b/contrib/cdb/cdb.h
@@ -9,6 +9,8 @@
#define TINYCDB_VERSION 0.77
#include "config.h"
+#include "unix-std.h"
+#include <event.h>
/*
* OpenBSD fix
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2561fa0ff..0490186df 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -85,7 +85,7 @@ SET(PLUGINSSRC plugins/surbl.c
plugins/chartable.c
plugins/fuzzy_check.c
plugins/spf.c
- plugins/dkim_check.c)
+ plugins/dkim_check.c libutil/unix-std.h)
SET(MODULES_LIST surbl regexp chartable fuzzy_check spf dkim)
SET(WORKERS_LIST normal controller smtp_proxy fuzzy lua http_proxy)
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 1d9252147..9be97cba0 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -27,6 +27,11 @@
#include "http.h"
#include "rspamdclient.h"
#include "utlist.h"
+#include "unix-std.h"
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#define DEFAULT_PORT 11333
#define DEFAULT_CONTROL_PORT 11334
@@ -1345,7 +1350,6 @@ main (gint argc, gchar **argv, gchar **env)
event_base_loop (ev_base, 0);
g_hash_table_destroy (kwattrs);
- g_mime_shutdown ();
/* Wait for children processes */
cur = g_list_first (children);
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c
index 272fe581b..58ea0ad0e 100644
--- a/src/client/rspamdclient.c
+++ b/src/client/rspamdclient.c
@@ -24,7 +24,7 @@
#include "rspamdclient.h"
#include "util.h"
#include "http.h"
-#include "keypairs_cache.h"
+#include "unix-std.h"
#ifdef HAVE_FETCH_H
#include <fetch.h>
diff --git a/src/client/rspamdclient.h b/src/client/rspamdclient.h
index 2a63b5a7f..85b51514b 100644
--- a/src/client/rspamdclient.h
+++ b/src/client/rspamdclient.h
@@ -26,6 +26,7 @@
#include "config.h"
#include "ucl.h"
+#include <event.h>
struct rspamd_client_connection;
struct rspamd_http_message;
diff --git a/src/controller.c b/src/controller.c
index 871037b32..6d14342d7 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -29,12 +29,11 @@
#include "libstat/stat_api.h"
#include "rspamd.h"
#include "libserver/worker_util.h"
-#include "utlist.h"
-
-#include "blake2.h"
#include "cryptobox.h"
#include "ottery.h"
#include "libutil/rrd.h"
+#include "unix-std.h"
+#include <math.h>
/* 60 seconds for worker's IO */
#define DEFAULT_WORKER_IO_TIMEOUT 60000
diff --git a/src/http_proxy.c b/src/http_proxy.c
index 6570e01cc..572d78578 100644
--- a/src/http_proxy.c
+++ b/src/http_proxy.c
@@ -35,6 +35,7 @@
#include "libserver/worker_util.h"
#include "keypairs_cache.h"
#include "ottery.h"
+#include "unix-std.h"
/* Rotate keys each minute by default */
#define DEFAULT_ROTATION_TIME 60.0
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index ed50efafe..ab8833a8a 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -27,15 +27,9 @@
#include "filter.h"
#include "rspamd.h"
#include "message.h"
-#include "cfg_file.h"
-#include "util.h"
-#include "expression.h"
-#include "libstat/stat_api.h"
-#include "utlist.h"
-
-#ifdef WITH_LUA
-# include "lua/lua_common.h"
-#endif
+#include "lua/lua_common.h"
+#include <math.h>
+
#define COMMON_PART_FACTOR 95
diff --git a/src/libmime/message.h b/src/libmime/message.h
index b509b23cd..e98001448 100644
--- a/src/libmime/message.h
+++ b/src/libmime/message.h
@@ -7,6 +7,7 @@
#define RSPAMD_MESSAGE_H
#include "config.h"
+#include <gmime/gmime.h>
struct rspamd_task;
struct controller_session;
diff --git a/src/libmime/smtp_proto.c b/src/libmime/smtp_proto.c
index 05d5c43d5..b6a14bdef 100644
--- a/src/libmime/smtp_proto.c
+++ b/src/libmime/smtp_proto.c
@@ -29,6 +29,7 @@
#include "smtp.h"
#include "smtp_proto.h"
#include "smtp_utils.h"
+#include "unix-std.h"
gchar *
make_smtp_error (rspamd_mempool_t *pool,
diff --git a/src/libmime/smtp_utils.c b/src/libmime/smtp_utils.c
index df50abc65..32b23bfd7 100644
--- a/src/libmime/smtp_utils.c
+++ b/src/libmime/smtp_utils.c
@@ -23,9 +23,8 @@
#include "config.h"
#include "rspamd.h"
-#include "filter.h"
#include "smtp.h"
-#include "smtp_proto.h"
+#include "unix-std.h"
void
free_smtp_session (gpointer arg)
diff --git a/src/libserver/buffer.c b/src/libserver/buffer.c
index 0875de300..4b8e3a3e5 100644
--- a/src/libserver/buffer.c
+++ b/src/libserver/buffer.c
@@ -25,6 +25,7 @@
#include "config.h"
#include "buffer.h"
#include "rspamd.h"
+#include "unix-std.h"
#ifdef HAVE_SYS_SENDFILE_H
#include <sys/sendfile.h>
#endif
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index f50b37010..57674aae3 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -31,6 +31,15 @@
#include "expression.h"
#include "composites.h"
#include "libserver/worker_util.h"
+#include "unix-std.h"
+
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#ifdef HAVE_GLOB_H
+#include <glob.h>
+#endif
struct rspamd_rcl_default_handler_data {
struct rspamd_rcl_struct_parser pd;
@@ -103,6 +112,7 @@ rspamd_rcl_logging_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
}
else if (g_ascii_strcasecmp (log_type, "syslog") == 0) {
/* Need to get facility */
+#ifdef HAVE_SYSLOG_H
cfg->log_facility = LOG_DAEMON;
cfg->log_type = RSPAMD_LOG_SYSLOG;
val = ucl_object_find_key (obj, "facility");
@@ -168,6 +178,7 @@ rspamd_rcl_logging_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
return FALSE;
}
}
+#endif
}
else if (g_ascii_strcasecmp (log_type,
"stderr") == 0 || g_ascii_strcasecmp (log_type, "console") == 0) {
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 95c984b9c..5e3bf1561 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -34,6 +34,8 @@
#include "dynamic_cfg.h"
#include "utlist.h"
#include "stat_api.h"
+#include "unix-std.h"
+#include <math.h>
#define DEFAULT_SCORE 10.0
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index eaa658b8b..cbb7913a4 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -26,6 +26,7 @@
#include "map.h"
#include "filter.h"
#include "dynamic_cfg.h"
+#include "unix-std.h"
struct config_json_buf {
GString *buf;
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index af6eb193d..41363ae13 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "rspamd.h"
#include "fuzzy_backend.h"
+#include "unix-std.h"
#include <sqlite3.h>
diff --git a/src/libserver/proxy.c b/src/libserver/proxy.c
index 09171eeb9..2eff2b08e 100644
--- a/src/libserver/proxy.c
+++ b/src/libserver/proxy.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "rspamd.h"
#include "proxy.h"
+#include "unix-std.h"
static void rspamd_proxy_backend_handler (gint fd, gshort what, gpointer data);
static void rspamd_proxy_client_handler (gint fd, gshort what, gpointer data);
diff --git a/src/libserver/proxy.h b/src/libserver/proxy.h
index 784a78dbc..a372f30e0 100644
--- a/src/libserver/proxy.h
+++ b/src/libserver/proxy.h
@@ -27,6 +27,7 @@
#include "config.h"
#include "buffer.h"
+#include <event.h>
/**
* @file proxy.h
diff --git a/src/libserver/roll_history.c b/src/libserver/roll_history.c
index 74c7c8214..6c48fc224 100644
--- a/src/libserver/roll_history.c
+++ b/src/libserver/roll_history.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "rspamd.h"
#include "roll_history.h"
+#include "unix-std.h"
static const gchar rspamd_history_magic[] = {'r', 's', 'h', '1'};
diff --git a/src/libserver/spf.h b/src/libserver/spf.h
index 473eff086..cdb7a0434 100644
--- a/src/libserver/spf.h
+++ b/src/libserver/spf.h
@@ -3,6 +3,7 @@
#include "config.h"
#include "ref.h"
+#include "addr.h"
struct rspamd_task;
struct spf_resolved;
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index eaa4dce03..5e72eb97c 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -29,6 +29,8 @@
#include "symbols_cache.h"
#include "cfg_file.h"
#include "lua/lua_common.h"
+#include "unix-std.h"
+#include <math.h>
#define msg_err_cache(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
cache->static_pool->tag.tagname, cache->cfg->checksum, \
diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h
index f6fffcc08..95f292243 100644
--- a/src/libserver/symbols_cache.h
+++ b/src/libserver/symbols_cache.h
@@ -28,7 +28,7 @@
#include "config.h"
#include "ucl.h"
#include <lua.h>
-#define MAX_SYMBOL 128
+#include <event.h>
struct rspamd_task;
struct rspamd_config;
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 6dd00b8bf..eaf845949 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -29,6 +29,7 @@
#include "lua/lua_common.h"
#include "composites.h"
#include "stat_api.h"
+#include "unix-std.h"
static GQuark
rspamd_task_quark (void)
diff --git a/src/libserver/task.h b/src/libserver/task.h
index 02f6f9ea0..ee57c0f93 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -30,6 +30,8 @@
#include "mem_pool.h"
#include "dns.h"
+#include <gmime/gmime.h>
+
enum rspamd_command {
CMD_CHECK,
CMD_SYMBOLS,
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index ddd72acb9..71656116a 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -26,6 +26,10 @@
#include "message.h"
#include "lua/lua_common.h"
#include "worker_util.h"
+#include "unix-std.h"
+#ifdef WITH_GPERF_TOOLS
+#include <google/profiler.h>
+#endif
/**
* Return worker's control structure by its type
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c
index 41d6900ce..2daf6e6cb 100644
--- a/src/libstat/backends/mmaped_file.c
+++ b/src/libstat/backends/mmaped_file.c
@@ -24,7 +24,7 @@
#include "config.h"
#include "stat_internal.h"
-#include "rspamd.h"
+#include "unix-std.h"
#define CHAIN_LENGTH 128
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c
index 26b9c56b4..a978f5753 100644
--- a/src/libstat/backends/sqlite3_backend.c
+++ b/src/libstat/backends/sqlite3_backend.c
@@ -29,6 +29,7 @@
#include "libstat/stat_internal.h"
#include "libmime/message.h"
#include "lua/lua_common.h"
+#include "unix-std.h"
#define SQLITE3_BACKEND_TYPE "sqlite3"
#define SQLITE3_SCHEMA_VERSION "1"
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 67c2e3116..b0b2be4f3 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -30,6 +30,7 @@
#include "filter.h"
#include "cfg_file.h"
#include "stat_internal.h"
+#include "math.h"
static inline GQuark
bayes_error_quark (void)
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 4a48ab7e8..1c7f4dbdf 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -26,6 +26,17 @@
#include "util.h"
#include "logger.h"
+#include "unix-std.h"
+/* pwd and grp */
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+
enum {
RSPAMD_IPV6_UNDEFINED = 0,
RSPAMD_IPV6_SUPPORTED,
diff --git a/src/libutil/addr.h b/src/libutil/addr.h
index a13c14b53..affd87158 100644
--- a/src/libutil/addr.h
+++ b/src/libutil/addr.h
@@ -24,6 +24,21 @@
#define ADDR_H_
#include "config.h"
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+/* unix sockets */
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
#include "mem_pool.h"
/**
diff --git a/src/libutil/aio_event.c b/src/libutil/aio_event.c
index 0686bbd0d..0c3a6f4fb 100644
--- a/src/libutil/aio_event.c
+++ b/src/libutil/aio_event.c
@@ -22,8 +22,10 @@
*/
#include "config.h"
+#include <event.h>
#include "aio_event.h"
#include "rspamd.h"
+#include "unix-std.h"
#ifdef HAVE_SYS_EVENTFD_H
#include <sys/eventfd.h>
diff --git a/src/libutil/http.c b/src/libutil/http.c
index fe7ac2d53..f363969b4 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -32,7 +32,7 @@
#include "ottery.h"
#include "keypair_private.h"
#include "cryptobox.h"
-#include <limits.h>
+#include "unix-std.h"
#define ENCRYPTED_VERSION " HTTP/1.0"
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index 3367829a6..b83aa5cd6 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -29,6 +29,11 @@
#include "rspamd.h"
#include "map.h"
#include "xxhash.h"
+#include "unix-std.h"
+
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
/* How much message should be repeated before it is count to be repeated one */
#define REPEATS_MIN 3
@@ -174,9 +179,11 @@ rspamd_log_open_priv (rspamd_logger_t *rspamd_log, uid_t uid, gid_t gid)
rspamd_log->enabled = TRUE;
return 0;
case RSPAMD_LOG_SYSLOG:
+#ifdef HAVE_SYSLOG_H
openlog ("rspamd", LOG_NDELAY | LOG_PID,
rspamd_log->cfg->log_facility);
rspamd_log->enabled = TRUE;
+#endif
return 0;
case RSPAMD_LOG_FILE:
rspamd_log->fd = open (rspamd_log->cfg->log_file,
@@ -212,7 +219,9 @@ rspamd_log_close_priv (rspamd_logger_t *rspamd_log, uid_t uid, gid_t gid)
/* Do nothing special */
break;
case RSPAMD_LOG_SYSLOG:
+#ifdef HAVE_SYSLOG_H
closelog ();
+#endif
break;
case RSPAMD_LOG_FILE:
if (rspamd_log->enabled) {
@@ -576,7 +585,7 @@ syslog_log_function (const gchar *log_domain,
gpointer arg)
{
rspamd_logger_t *rspamd_log = arg;
-
+#ifdef HAVE_SYSLOG_H
struct {
GLogLevelFlags glib_level;
gint syslog_level;
@@ -607,6 +616,7 @@ syslog_log_function (const gchar *log_domain,
module != NULL ? module : "",
function != NULL ? function : "",
message);
+#endif
}
/**
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 28faf13c4..6c813a133 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -32,6 +32,7 @@
#include "util.h"
#include "mem_pool.h"
#include "blake2.h"
+#include "unix-std.h"
static const gchar *hash_fill = "1";
diff --git a/src/libutil/map.h b/src/libutil/map.h
index 64421ec1b..95c7de27b 100644
--- a/src/libutil/map.h
+++ b/src/libutil/map.h
@@ -2,6 +2,8 @@
#define RSPAMD_MAP_H
#include "config.h"
+#include <event.h>
+
#include "mem_pool.h"
#include "radix.h"
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
index 849e70c03..e87a1578b 100644
--- a/src/libutil/mem_pool.c
+++ b/src/libutil/mem_pool.c
@@ -28,6 +28,11 @@
#include "logger.h"
#include "utlist.h"
#include "ottery.h"
+#include "unix-std.h"
+
+#ifdef HAVE_SCHED_YIELD
+#include <sched.h>
+#endif
/* Sleep time for spin lock in nanoseconds */
#define MUTEX_SLEEP_TIME 10000000L
diff --git a/src/libutil/printf.c b/src/libutil/printf.c
index 3813524a0..67a2f3d98 100644
--- a/src/libutil/printf.c
+++ b/src/libutil/printf.c
@@ -25,7 +25,7 @@
#include "printf.h"
#include "fstring.h"
-#include "rspamd.h"
+#include <math.h>
/**
* From FreeBSD libutil code
@@ -449,7 +449,6 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
if (*fmt == '*') {
d = (gint)va_arg (args, gint);
if (G_UNLIKELY (d < 0)) {
- msg_err ("critical error: fraction width is less than 0");
return 0;
}
frac_width = (guint)d;
@@ -466,7 +465,6 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
case '*':
d = (gint)va_arg (args, gint);
if (G_UNLIKELY (d < 0)) {
- msg_err ("critical error: size is less than 0");
return 0;
}
slen = (glong)d;
@@ -715,7 +713,7 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
continue;
case 'N':
- c = LF;
+ c = '\n';
RSPAMD_PRINTF_APPEND (&c, 1);
continue;
diff --git a/src/libutil/rrd.c b/src/libutil/rrd.c
index b7bd75d08..c5793a590 100644
--- a/src/libutil/rrd.c
+++ b/src/libutil/rrd.c
@@ -26,6 +26,8 @@
#include "rrd.h"
#include "util.h"
#include "logger.h"
+#include "unix-std.h"
+#include <math.h>
#define msg_err_rrd(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
"rrd", file->id, \
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c
index 980d07abc..0458a0a02 100644
--- a/src/libutil/sqlite_utils.c
+++ b/src/libutil/sqlite_utils.c
@@ -25,6 +25,7 @@
#include "config.h"
#include "libutil/logger.h"
#include "libutil/sqlite_utils.h"
+#include "unix-std.h"
static GQuark
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 96a26e1c1..9031305b0 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -25,8 +25,8 @@
#include "config.h"
#include "util.h"
-#include "mem_pool.h"
#include "xxhash.h"
+#include <math.h>
static const guchar lc_map[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
diff --git a/src/libutil/unix-std.h b/src/libutil/unix-std.h
new file mode 100644
index 000000000..988669c4b
--- /dev/null
+++ b/src/libutil/unix-std.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015, Vsevolod Stakhov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef RSPAMD_UNIX_STD_H_H
+#define RSPAMD_UNIX_STD_H_H
+
+#include "config.h"
+
+/*
+ * Default unix system includes
+ */
+
+/* sys/file.h */
+#ifdef HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
+/* sys/uio.h */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+/* sys/mman */
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+
+/* timedb */
+#ifdef HAVE_SYS_TIMEB_H
+#include <sys/timeb.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* sysexits */
+#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#endif
+
+/* strings */
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+/* fcntl */
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+
+#include <signal.h>
+
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+
+#endif
diff --git a/src/libutil/util.c b/src/libutil/util.c
index daf427ef3..dae26a5c0 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -27,8 +27,7 @@
#include "util.h"
#include "cfg_file.h"
#include "rspamd.h"
-#include "filter.h"
-#include "message.h"
+#include "unix-std.h"
#include "xxhash.h"
#include "ottery.h"
@@ -49,10 +48,32 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
-
+/* libutil */
+#ifdef HAVE_LIBUTIL_H
+#include <libutil.h>
+#endif
#ifdef __APPLE__
#include <mach/mach_time.h>
#endif
+#ifdef WITH_GPERF_TOOLS
+#include <google/profiler.h>
+#endif
+/* poll */
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
+#ifdef HAVE_SIGINFO_H
+#include <siginfo.h>
+#endif
+/* sys/wait */
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+/* sys/resource.h */
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
#include "blake2.h"
diff --git a/src/libutil/util.h b/src/libutil/util.h
index a78c4dfda..e563718f8 100644
--- a/src/libutil/util.h
+++ b/src/libutil/util.h
@@ -8,6 +8,11 @@
#include "addr.h"
#include "str_util.h"
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#include <event.h>
+
struct rspamd_config;
struct rspamd_main;
struct workq;
diff --git a/src/lua/lua_buffer.c b/src/lua/lua_buffer.c
index 021b13a0d..d5f4c7848 100644
--- a/src/lua/lua_buffer.c
+++ b/src/lua/lua_buffer.c
@@ -23,6 +23,8 @@
#include "lua_common.h"
#include "buffer.h"
+#include "unix-std.h"
+#include <math.h>
/* Public prototypes */
struct rspamd_io_dispatcher_s * lua_check_io_dispatcher (lua_State * L);
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index bc9bdb3ac..0a63164f5 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -23,10 +23,9 @@
*/
#include "lua_common.h"
-#include "symbols_cache.h"
#include "expression.h"
-#include "filter.h"
#include "composites.h"
+#include "unix-std.h"
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index bbea1ebce..6e0417a82 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -26,6 +26,7 @@
#include "dns.h"
#include "http.h"
#include "utlist.h"
+#include "unix-std.h"
/***
* @module rspamd_http
diff --git a/src/lua/lua_rsa.c b/src/lua/lua_rsa.c
index a85d0db71..b4b84d896 100644
--- a/src/lua/lua_rsa.c
+++ b/src/lua/lua_rsa.c
@@ -29,6 +29,7 @@
*/
#include "lua_common.h"
+#include "unix-std.h"
#ifdef HAVE_OPENSSL
#include <openssl/err.h>
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index 030f3109b..afc1fd5d9 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -26,6 +26,7 @@
#include "buffer.h"
#include "dns.h"
#include "utlist.h"
+#include "unix-std.h"
static void lua_tcp_handler (int fd, short what, gpointer ud);
/***
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index 3a7d00211..73099621f 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -27,6 +27,7 @@
#include "html.h"
#include "cfg_rcl.h"
#include "tokenizers/tokenizers.h"
+#include <math.h>
/***
* @module rspamd_util
diff --git a/src/lua_worker.c b/src/lua_worker.c
index c378ffc0b..b2a3ffc19 100644
--- a/src/lua_worker.c
+++ b/src/lua_worker.c
@@ -33,6 +33,7 @@
#include "message.h"
#include "map.h"
#include "dns.h"
+#include "unix-std.h"
#include "lua/lua_common.h"
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 6ca18aaf8..e7c932c99 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -46,13 +46,11 @@
#include "libserver/worker_util.h"
#include "fuzzy_storage.h"
#include "utlist.h"
-#include "rspamd.h"
#include "blake2.h"
#include "ottery.h"
-#include "cryptobox.h"
-#include "keypairs_cache.h"
#include "keypair_private.h"
-#include "http.h"
+#include "unix-std.h"
+#include <math.h>
#define DEFAULT_SYMBOL "R_FUZZY_HASH"
#define DEFAULT_UPSTREAM_ERROR_TIME 10
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 2fd267aa0..819bc762e 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -33,7 +33,6 @@
#include "mime_expressions.h"
#include "libutil/map.h"
#include "lua/lua_common.h"
-#include "rspamd.h"
struct regexp_module_item {
struct rspamd_expression *expr;
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index f19d2b50f..8780d8aa7 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -38,6 +38,7 @@
#include "libutil/hash.h"
#include "libutil/map.h"
#include "rspamd.h"
+#include "addr.h"
#define DEFAULT_SYMBOL_FAIL "R_SPF_FAIL"
#define DEFAULT_SYMBOL_SOFTFAIL "R_SPF_SOFTFAIL"
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 7ce58ab1d..baf0706d8 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -43,14 +43,11 @@
#include "config.h"
#include "libmime/message.h"
-#include "libutil/hash.h"
#include "libutil/map.h"
#include "rspamd.h"
#include "surbl.h"
-#include "regexp.h"
-#include "acism.h"
-
#include "utlist.h"
+#include "unix-std.h"
static struct surbl_ctx *surbl_module_ctx = NULL;
diff --git a/src/plugins/surbl.h b/src/plugins/surbl.h
index 9eab93000..320423698 100644
--- a/src/plugins/surbl.h
+++ b/src/plugins/surbl.h
@@ -3,7 +3,6 @@
#include "config.h"
#include "acism.h"
-#include "rspamd.h"
#define DEFAULT_REDIRECTOR_PORT 8080
#define DEFAULT_SURBL_WEIGHT 10
diff --git a/src/rspamadm/pw.c b/src/rspamadm/pw.c
index f72db4fa3..e090cd424 100644
--- a/src/rspamadm/pw.c
+++ b/src/rspamadm/pw.c
@@ -28,6 +28,7 @@
#include "cryptobox.h"
#include "rspamd.h"
#include "rspamadm.h"
+#include "unix-std.h"
static void rspamadm_pw (gint argc, gchar **argv);
static const char *rspamadm_pw_help (gboolean full_help);
diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c
index 80c180102..19dbea4a3 100644
--- a/src/rspamadm/rspamadm.c
+++ b/src/rspamadm/rspamadm.c
@@ -26,6 +26,11 @@
#include "rspamadm.h"
#include "rspamd.h"
#include "ottery.h"
+#include "unix-std.h"
+
+#ifdef HAVE_LIBUTIL_H
+#include <libutil.h>
+#endif
static gboolean verbose = FALSE;
static gboolean list_commands = FALSE;
diff --git a/src/rspamd.c b/src/rspamd.c
index 4faa2d36c..743c34ced 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -26,15 +26,42 @@
#include "rspamd.h"
#include "libutil/map.h"
#include "fuzzy_storage.h"
-#include "libserver/symbols_cache.h"
#include "lua/lua_common.h"
#include "libserver/worker_util.h"
#include "ottery.h"
#include "xxhash.h"
#include "utlist.h"
-#include "libstat/stat_api.h"
-#include "cryptobox.h"
-#include "regexp.h"
+#include "unix-std.h"
+/* sysexits */
+#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#endif
+/* pwd and grp */
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#include <signal.h>
+#ifdef HAVE_SIGINFO_H
+#include <siginfo.h>
+#endif
+/* sys/resource.h */
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_LIBUTIL_H
+#include <libutil.h>
+#endif
+#ifdef WITH_GPERF_TOOLS
+#include <google/profiler.h>
+#endif
+
#ifdef HAVE_OPENSSL
#include <openssl/rand.h>
#include <openssl/err.h>
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c
index 43119afa2..e93ef69ad 100644
--- a/src/smtp_proxy.c
+++ b/src/smtp_proxy.c
@@ -27,6 +27,7 @@
#include "rspamd.h"
#include "smtp.h"
#include "libserver/worker_util.h"
+#include "unix-std.h"
/*
* SMTP proxy is a simple smtp proxy worker for dns resolving and
diff --git a/test/rspamd_async_test.c b/test/rspamd_async_test.c
index 71eec712a..fcd76333f 100644
--- a/test/rspamd_async_test.c
+++ b/test/rspamd_async_test.c
@@ -22,11 +22,9 @@
*/
#include "config.h"
-#include "tests.h"
#include "rspamd.h"
#include "aio_event.h"
-#include "mem_pool.h"
-
+#include "unix-std.h"
extern struct event_base *base;
diff --git a/test/rspamd_cryptobox_test.c b/test/rspamd_cryptobox_test.c
index c7ad2921c..d01d99ee3 100644
--- a/test/rspamd_cryptobox_test.c
+++ b/test/rspamd_cryptobox_test.c
@@ -29,6 +29,7 @@
#include "fstring.h"
#include "ottery.h"
#include "cryptobox.h"
+#include "unix-std.h"
static const int mapping_size = 64 * 8192 + 1;
static const int max_seg = 32;
diff --git a/test/rspamd_http_test.c b/test/rspamd_http_test.c
index 429ae5be9..81b598a45 100644
--- a/test/rspamd_http_test.c
+++ b/test/rspamd_http_test.c
@@ -28,6 +28,12 @@
#include "tests.h"
#include "ottery.h"
#include "cryptobox.h"
+#include "unix-std.h"
+#include <math.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
static const int file_blocks = 1;
static const int pconns = 100;
diff --git a/test/rspamd_lua_test.c b/test/rspamd_lua_test.c
index caeb9814e..8b1b09383 100644
--- a/test/rspamd_lua_test.c
+++ b/test/rspamd_lua_test.c
@@ -25,6 +25,11 @@
#include "rspamd.h"
#include "util.h"
#include "lua/lua_common.h"
+#include "unix-std.h"
+
+#ifdef HAVE_GLOB_H
+#include <glob.h>
+#endif
static const char *lua_src = BUILDROOT "/test/lua/tests.lua";
diff --git a/test/rspamd_mem_pool_test.c b/test/rspamd_mem_pool_test.c
index fe5ba56b8..e8813f574 100644
--- a/test/rspamd_mem_pool_test.c
+++ b/test/rspamd_mem_pool_test.c
@@ -1,6 +1,12 @@
#include "config.h"
#include "mem_pool.h"
#include "tests.h"
+#include "unix-std.h"
+#include <math.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#define TEST_BUF "test bufffer"
#define TEST2_BUF "test bufffertest bufffer"
diff --git a/test/rspamd_shingles_test.c b/test/rspamd_shingles_test.c
index 3a1dd8ba2..2b33ad684 100644
--- a/test/rspamd_shingles_test.c
+++ b/test/rspamd_shingles_test.c
@@ -24,8 +24,8 @@
#include "config.h"
#include "rspamd.h"
#include "shingles.h"
-#include "fstring.h"
#include "ottery.h"
+#include <math.h>
static void
generate_random_string (char *begin, size_t len)
diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c
index e10ebd889..97d0565b8 100644
--- a/test/rspamd_test_suite.c
+++ b/test/rspamd_test_suite.c
@@ -1,7 +1,5 @@
#include "config.h"
#include "rspamd.h"
-#include "cfg_file.h"
-#include "regexp.h"
#include "libstat/stat_api.h"
#include "tests.h"
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c
index 9e04c4dda..e2f2c17ee 100644
--- a/test/rspamd_upstream_test.c
+++ b/test/rspamd_upstream_test.c
@@ -25,8 +25,8 @@
#include "config.h"
#include "rspamd.h"
-#include "upstream.h"
#include "ottery.h"
+#include <math.h>
const char *test_upstream_list = "microsoft.com:443:1,google.com:80:2,kernel.org:443:3";
const char *new_upstream_list = "freebsd.org:80";