mirror of
https://github.com/Zxilly/UA2F.git
synced 2026-01-04 17:47:32 +00:00
fix: cli missing macro define
This commit is contained in:
parent
7c23c9dba7
commit
de2f9f4dec
@ -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.")
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#ifdef UA2F_USE_UCI
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#include <uci.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
@ -40,4 +40,4 @@ void load_config() {
|
||||
cleanup:
|
||||
uci_free_context(ctx);
|
||||
}
|
||||
#endif //UA2F_USE_UCI
|
||||
#endif
|
||||
@ -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
|
||||
|
||||
@ -5,10 +5,8 @@
|
||||
#include "statistics.h"
|
||||
#include "custom.h"
|
||||
|
||||
#ifdef UA2F_USE_UCI
|
||||
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#include "config.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include <libnetfilter_queue/pktbuff.h>
|
||||
@ -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));
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user