diff --git a/CMakeLists.txt b/CMakeLists.txt index d9c87ed..cbfab3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ add_executable(ua2f target_link_libraries(ua2f mnl netfilter_queue pthread nfnetlink) if (UA2F_ENABLE_UCI) - add_compile_definitions(UA2F_USE_UCI=1) + add_compile_definitions(UA2F_ENABLE_UCI=1) target_link_libraries(ua2f uci) else () message(STATUS "UCI support is disabled.") diff --git a/src/cli.c b/src/cli.c index 30e2091..061d5f3 100644 --- a/src/cli.c +++ b/src/cli.c @@ -21,11 +21,16 @@ void try_print_info(const int argc, char *argv[]) { #else printf("Embed UA: not set\n"); #endif + +#ifdef UA2F_ENABLE_UCI if (config.use_custom_ua) { printf("Config UA: %s\n", config.custom_ua); } else { printf("Config UA: not set\n"); } +#else + printf("UCI support disabled\n"); +#endif exit(0); } diff --git a/src/config.c b/src/config.c index 63cdfae..e925bce 100644 --- a/src/config.c +++ b/src/config.c @@ -1,4 +1,4 @@ -#ifdef UA2F_USE_UCI +#ifdef UA2F_ENABLE_UCI #include #include #include @@ -40,4 +40,4 @@ void load_config() { cleanup: uci_free_context(ctx); } -#endif //UA2F_USE_UCI \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/config.h b/src/config.h index 1cc394b..c5827c8 100644 --- a/src/config.h +++ b/src/config.h @@ -1,4 +1,4 @@ -#ifdef UA2F_USE_UCI +#ifdef UA2F_ENABLE_UCI #ifndef UA2F_CONFIG_H #define UA2F_CONFIG_H @@ -14,4 +14,4 @@ void load_config(); extern struct ua2f_config config; #endif //UA2F_CONFIG_H -#endif //UA2F_USE_UCI +#endif diff --git a/src/handler.c b/src/handler.c index 6fd8429..bb9a6f6 100644 --- a/src/handler.c +++ b/src/handler.c @@ -5,10 +5,8 @@ #include "statistics.h" #include "custom.h" -#ifdef UA2F_USE_UCI - +#ifdef UA2F_ENABLE_UCI #include "config.h" - #endif #include @@ -34,7 +32,7 @@ void init_handler() { bool ua_set = false; -#ifdef UA2F_USE_UCI +#ifdef UA2F_ENABLE_UCI if (config.use_custom_ua) { memset(replacement_user_agent_string, ' ', MAX_USER_AGENT_LENGTH); strncpy(replacement_user_agent_string, config.custom_ua, strlen(config.custom_ua)); diff --git a/src/ua2f.c b/src/ua2f.c index 497c848..f6cb01a 100644 --- a/src/ua2f.c +++ b/src/ua2f.c @@ -4,7 +4,7 @@ #include "cli.h" #include "third/nfqueue-mnl.h" -#ifdef UA2F_USE_UCI +#ifdef UA2F_ENABLE_UCI #include "config.h" #endif @@ -26,11 +26,11 @@ void signal_handler(const int signum) { int main(const int argc, char *argv[]) { openlog("UA2F", LOG_PID, LOG_SYSLOG); -#ifdef UA2F_USE_UCI +#ifdef UA2F_ENABLE_UCI load_config(); #else syslog(LOG_INFO, "uci support is disabled"); -#endif //UA2F_USE_UCI +#endif try_print_info(argc, argv);