OCT 更新编辑配置,增加DHCP/DNS双栈服务支持编译

This commit is contained in:
huangxin 2022-10-28 15:37:01 +08:00
parent 189f61d953
commit 31ab5d8fc6
3 changed files with 24 additions and 4 deletions

View File

@ -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 ()

View File

@ -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 ()

View File

@ -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);