diff --git a/CMakeLists.txt b/CMakeLists.txt index 5911606..d50b1c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,11 @@ if (USED_OPENDHCPD) ADD_SUBDIRECTORY(srcs/open_dhcp) endif () +if (USED_OPENDHCPDDNS) + MESSAGE("Select Option USED_OPENDHCPDDNS") + ADD_SUBDIRECTORY(srcs/dual_server) +endif () + if (USED_LWIP OR VCPE_AGENT) ADD_SUBDIRECTORY(srcs/lwip) endif () diff --git a/srcs/CMakeLists.txt b/srcs/CMakeLists.txt index 8b80869..1289713 100644 --- a/srcs/CMakeLists.txt +++ b/srcs/CMakeLists.txt @@ -40,6 +40,10 @@ if (USED_OPENDHCPD) ADD_DEFINITIONS(-DOPENDHCPD_ON) endif () +if (USED_OPENDHCPDDNS) + ADD_DEFINITIONS(-DOPENDHCPDDNS_ON) +endif () + ADD_EXECUTABLE(${PROJECT_TARGET} ${VCPE_SRC} ${VCPE_HEADS} vcpe_main.c) if (VCPE_AGENT) @@ -50,7 +54,9 @@ if (USED_LWIP) TARGET_LINK_LIBRARIES(${PROJECT_TARGET} lwip_linux) endif () -if (USED_OPENDHCPD) +if (USED_OPENDHCPDDNS) + TARGET_LINK_LIBRARIES(${PROJECT_TARGET} dualserverd) +else () TARGET_LINK_LIBRARIES(${PROJECT_TARGET} opendhcpd) endif () diff --git a/srcs/vcpe_main.c b/srcs/vcpe_main.c index f412c92..8e86845 100644 --- a/srcs/vcpe_main.c +++ b/srcs/vcpe_main.c @@ -10,7 +10,14 @@ #include "user_info.h" #include "lwip/tcpip.h" #endif + +#ifdef OPENDHCPD_ON #include "open_dhcp/dhcpd.h" +#endif + +#ifdef OPENDHCPDDNS_ON +#include "dual_server/dualsvr.h" +#endif #if LWIP_ON static void test_init(void *arg) { /* remove compiler warning */ @@ -20,7 +27,6 @@ static void test_init(void *arg) { /* remove compiler warning */ srand((unsigned int)time(0)); - sys_sem_signal(init_sem); } @@ -28,7 +34,7 @@ static void lwip_init_env() { err_t err; sys_sem_t init_sem; - err = sys_sem_new(&init_sem, 0); + err = sys_sem_new(&init_sem, 0); LWIP_UNUSED_ARG(err); tcpip_init(test_init, &init_sem); sys_sem_wait(&init_sem); @@ -37,7 +43,10 @@ static void lwip_init_env() { #endif int main(int argc, char **argv) { -#if OPENDHCPD_ON + +#ifdef OPENDHCPDDNS_ON + return dual_server_main(argc, argv); +#elif OPENDHCPDDNS return dhcpd_main(argc, argv); #else uv_setup_args(argc, argv);