From 31ab5d8fc6bd2ac14c7e50e1701db94c240325cc Mon Sep 17 00:00:00 2001 From: huangxin Date: Fri, 28 Oct 2022 15:37:01 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20=E6=9B=B4=E6=96=B0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=A2=9E=E5=8A=A0DHCP/DNS=E5=8F=8C?= =?UTF-8?q?=E6=A0=88=E6=9C=8D=E5=8A=A1=E6=94=AF=E6=8C=81=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 5 +++++ srcs/CMakeLists.txt | 8 +++++++- srcs/vcpe_main.c | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) 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);