parent
de6c772acb
commit
b328506c3b
|
@ -11,13 +11,11 @@ include(ExternalProject)
|
||||||
# 判断依赖库是否存在
|
# 判断依赖库是否存在
|
||||||
FIND_PACKAGE(PkgConfig)
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
|
||||||
if (USED_LWIP OR VCPE_AGENT)
|
PKG_SEARCH_MODULE(LIBCURL REQUIRED libcurl)
|
||||||
PKG_SEARCH_MODULE(LIBCURL REQUIRED libcurl)
|
PKG_SEARCH_MODULE(LIBSSL REQUIRED libssl)
|
||||||
PKG_SEARCH_MODULE(LIBSSL REQUIRED libssl)
|
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto)
|
||||||
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto)
|
LIST(APPEND COMMON_LIBS "${LIBCURL_LDFLAGS} ${LIBSSL_LDFLAGS} ${LIBCRYPTO_LDFLAGS}")
|
||||||
LIST(APPEND COMMON_LIBS "${LIBCURL_LDFLAGS} ${LIBSSL_LDFLAGS} ${LIBCRYPTO_LDFLAGS}")
|
LIST(APPEND COMMON_LIBS "-ldl -lpthread -lzlog -lm -luv -lzmq -luuid -lconfig")
|
||||||
LIST(APPEND COMMON_LIBS "-ldl -lpthread -lzlog -lm -luv -lzmq -luuid -lconfig")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
LIST(APPEND COMMON_LIBS "-lpthread")
|
LIST(APPEND COMMON_LIBS "-lpthread")
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,18 @@ FILE(GLOB C_HEADS include/*.h include/uthash/*.h include/s2j/*.h)
|
||||||
|
|
||||||
AUX_SOURCE_DIRECTORY(json C_SRC)
|
AUX_SOURCE_DIRECTORY(json C_SRC)
|
||||||
|
|
||||||
if (USED_LWIP OR VCPE_AGENT)
|
AUX_SOURCE_DIRECTORY(args C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(args C_SRC)
|
AUX_SOURCE_DIRECTORY(init C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(init C_SRC)
|
AUX_SOURCE_DIRECTORY(misc C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(misc C_SRC)
|
AUX_SOURCE_DIRECTORY(database C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(database C_SRC)
|
AUX_SOURCE_DIRECTORY(banner C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(banner C_SRC)
|
AUX_SOURCE_DIRECTORY(configure C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(configure C_SRC)
|
AUX_SOURCE_DIRECTORY(network C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(network C_SRC)
|
AUX_SOURCE_DIRECTORY(task C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(task C_SRC)
|
AUX_SOURCE_DIRECTORY(mq C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(mq C_SRC)
|
AUX_SOURCE_DIRECTORY(cmdline C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(cmdline C_SRC)
|
AUX_SOURCE_DIRECTORY(crypto C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(crypto C_SRC)
|
AUX_SOURCE_DIRECTORY(hardware C_SRC)
|
||||||
AUX_SOURCE_DIRECTORY(hardware C_SRC)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
SET(CMAKE_C_STANDARD 99)
|
SET(CMAKE_C_STANDARD 99)
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ typedef struct __ARG_TBL_INFO {
|
||||||
static PARG_TBL_INFO g_pArgTbl = NULL;
|
static PARG_TBL_INFO g_pArgTbl = NULL;
|
||||||
static unsigned int g_nArgTbl = 0;
|
static unsigned int g_nArgTbl = 0;
|
||||||
static const char *g_toolsKey[][2] = {
|
static const char *g_toolsKey[][2] = {
|
||||||
{"cfg_all", "get all configuration information"},
|
{"cfg_all", "get all configuration information"},
|
||||||
{"mem_info", "show the memory alloc information"},
|
{"mem_info", "show the memory alloc information"},
|
||||||
{"sys_info", "show the system and hardware information"},
|
{"sys_info", "show the system and hardware information"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int get_reg_cmd(void *pTbl[]) {
|
static int get_reg_cmd(void *pTbl[]) {
|
||||||
|
@ -116,7 +116,7 @@ static int on_cmd1(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = user_init(pCfgFile, pCfgDir, pKey, 0)) != ERR_SUCCESS) {
|
if ((ret = user_init(pCfgFile, pCfgDir, pKey, 0)) != ERR_SUCCESS) {
|
||||||
|
@ -150,7 +150,7 @@ static int on_cmd2(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&msg, 0, sizeof(MQ_CMD_MSG));
|
memset(&msg, 0, sizeof(MQ_CMD_MSG));
|
||||||
|
@ -188,7 +188,8 @@ static int on_cmd2(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
cJSON_Delete(pJsonObj);
|
cJSON_Delete(pJsonObj);
|
||||||
free((void *)pJsonStr);
|
free((void *)pJsonStr);
|
||||||
return ret;
|
|
||||||
|
return (ret == ERR_SUCCESS) ? ERR_MENU_EXIT : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_cmd3(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd3(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
@ -200,7 +201,7 @@ static int on_cmd3(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
@ -216,7 +217,7 @@ static int on_cmd3(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
printf("Base64 %s: {%s} --> [%s]\n", type == 0 ? "encode" : "decode", pValue, pRet);
|
printf("Base64 %s: {%s} --> [%s]\n", type == 0 ? "encode" : "decode", pValue, pRet);
|
||||||
|
|
||||||
free((void *)pRet);
|
free((void *)pRet);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_cmd4(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd4(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
@ -228,7 +229,7 @@ static int on_cmd4(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(type, "sha256") == 0) {
|
if (strcmp(type, "sha256") == 0) {
|
||||||
|
@ -245,7 +246,7 @@ static int on_cmd4(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
printf("%s %s hash value: [%s]\n", type, pFile, pHashValue);
|
printf("%s %s hash value: [%s]\n", type, pFile, pHashValue);
|
||||||
|
|
||||||
free(pHashValue);
|
free(pHashValue);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_cmd5(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd5(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
@ -262,7 +263,7 @@ static int on_cmd5(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(alg, "3des_ecb") == 0) {
|
if (strcmp(alg, "3des_ecb") == 0) {
|
||||||
|
@ -325,7 +326,7 @@ static int on_cmd5(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
free((void *)strRet);
|
free((void *)strRet);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_cmd6(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd6(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
@ -338,7 +339,7 @@ static int on_cmd6(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (pArg->pHelp && help > 0) {
|
if (pArg->pHelp && help > 0) {
|
||||||
pArg->pHelp(pArg->argTbl, pName, NULL);
|
pArg->pHelp(pArg->argTbl, pName, NULL);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symmetric_encrypto(DES3_CBC_PKCS7PADDING, (unsigned char *)pKey, strlen(pKey), &buf, &outSize, pKeygen)
|
if (symmetric_encrypto(DES3_CBC_PKCS7PADDING, (unsigned char *)pKey, strlen(pKey), &buf, &outSize, pKeygen)
|
||||||
|
@ -354,7 +355,7 @@ static int on_cmd6(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
free((void *)pKeygen);
|
free((void *)pKeygen);
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
@ -364,7 +365,7 @@ static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
|
|
||||||
if (help > 0) {
|
if (help > 0) {
|
||||||
show_help(pName);
|
show_help(pName);
|
||||||
} else if (version > 0) {
|
} else {
|
||||||
printf("Application information: %s (Build: %s %s GCC Ver:%s) With %lu(bits) OS\n",
|
printf("Application information: %s (Build: %s %s GCC Ver:%s) With %lu(bits) OS\n",
|
||||||
BUILD_VERSION,
|
BUILD_VERSION,
|
||||||
__DATE__,
|
__DATE__,
|
||||||
|
@ -385,10 +386,11 @@ static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_SUCCESS;
|
return ERR_MENU_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menu_run(int argc, char **argv) {
|
int menu_run(int argc, char **argv) {
|
||||||
|
int ret = ERR_MENU_EXIT;
|
||||||
int i, flag = FALSE;
|
int i, flag = FALSE;
|
||||||
const char *pAppName = basename_v2(argv[0]);
|
const char *pAppName = basename_v2(argv[0]);
|
||||||
|
|
||||||
|
@ -516,11 +518,16 @@ int menu_run(int argc, char **argv) {
|
||||||
for (i = 0; i < g_nArgTbl; i++) {
|
for (i = 0; i < g_nArgTbl; i++) {
|
||||||
PARG_TBL_INFO pArg = &argTblInfo[i];
|
PARG_TBL_INFO pArg = &argTblInfo[i];
|
||||||
if (*pArg->pErrCode == 0 && pArg->pCmd) {
|
if (*pArg->pErrCode == 0 && pArg->pCmd) {
|
||||||
if (pArg->pCmd(pArg->argTbl, pAppName, pArg) != ERR_SUCCESS) {
|
|
||||||
pArg->pHelp(pArg->argTbl, pAppName, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
flag = TRUE;
|
ret = pArg->pCmd(pArg->argTbl, pAppName, pArg);
|
||||||
|
|
||||||
|
if (ret != ERR_SUCCESS && ret != ERR_MENU_EXIT) {
|
||||||
|
if (pArg->pHelp) {
|
||||||
|
pArg->pHelp(pArg->argTbl, pAppName, NULL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
flag = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +536,7 @@ int menu_run(int argc, char **argv) {
|
||||||
PARG_TBL_INFO pArg = &argTblInfo[i];
|
PARG_TBL_INFO pArg = &argTblInfo[i];
|
||||||
|
|
||||||
if (*pArg->pErrCode != 0) {
|
if (*pArg->pErrCode != 0) {
|
||||||
if (get_reg_cmd(pArg->argTbl) > 0) {
|
if (get_reg_cmd(pArg->argTbl) > 0 && pArg->pHelp) {
|
||||||
int help = get_help_cmd(pArg->argTbl, pArg)->count;
|
int help = get_help_cmd(pArg->argTbl, pArg)->count;
|
||||||
pArg->pHelp(pArg->argTbl, pAppName, help > 0 ? NULL : get_arg_err(pArg->argTbl, pArg));
|
pArg->pHelp(pArg->argTbl, pAppName, help > 0 ? NULL : get_arg_err(pArg->argTbl, pArg));
|
||||||
flag = TRUE;
|
flag = TRUE;
|
||||||
|
@ -547,5 +554,5 @@ int menu_run(int argc, char **argv) {
|
||||||
arg_freetable(argTblInfo[i].argTbl, argTblInfo[i].nArgItem);
|
arg_freetable(argTblInfo[i].argTbl, argTblInfo[i].nArgItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_SUCCESS;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,9 @@ typedef enum {
|
||||||
ERR_MISC_GET_GATEWAY = 2602,
|
ERR_MISC_GET_GATEWAY = 2602,
|
||||||
ERR_MISC_GET_MACADDR = 2603,
|
ERR_MISC_GET_MACADDR = 2603,
|
||||||
|
|
||||||
|
// 菜单相关功能
|
||||||
|
ERR_MENU_EXIT = 2700,
|
||||||
|
|
||||||
} USER_ERRNO;
|
} USER_ERRNO;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//
|
//
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
#include <zlog.h>
|
#include <zlog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -15,17 +16,36 @@
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "msg_queue.h"
|
#include "msg_queue.h"
|
||||||
#include "database.h"
|
|
||||||
|
|
||||||
#define DEFAULT_CONFIG_FILE ("agent.cfg")
|
#define DEFAULT_CONFIG_FILE ("agent.cfg")
|
||||||
#define DEFAULT_CONFIG_DIR ("config")
|
#define DEFAULT_CONFIG_DIR ("config")
|
||||||
|
|
||||||
|
static pid_t g_pid;
|
||||||
|
|
||||||
|
static void catch_system_interupt(int UNUSED(sig_num)) {
|
||||||
|
if (g_pid == uv_os_getpid()) {
|
||||||
|
printf("\nSystem close, clearing system resources..........\n");
|
||||||
|
user_uninit();
|
||||||
|
sleep(1);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pKey, int logLevel) {
|
int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pKey, int logLevel) {
|
||||||
int ret;
|
int ret;
|
||||||
UT_string *pPath;
|
UT_string *pPath;
|
||||||
char bufCfgFile[MAX_PATH];
|
char bufCfgFile[MAX_PATH];
|
||||||
char bufCfgDir[MAX_PATH];
|
char bufCfgDir[MAX_PATH];
|
||||||
|
|
||||||
|
g_pid = uv_os_getpid();
|
||||||
|
|
||||||
|
signal(SIGINT, catch_system_interupt);
|
||||||
|
signal(SIGABRT, catch_system_interupt);
|
||||||
|
signal(SIGTERM, catch_system_interupt);
|
||||||
|
signal(SIGQUIT, catch_system_interupt);
|
||||||
|
signal(SIGTSTP, catch_system_interupt);
|
||||||
|
signal(SIGHUP, catch_system_interupt);
|
||||||
|
|
||||||
// 初始化 libuv loop
|
// 初始化 libuv loop
|
||||||
get_task_manager();
|
get_task_manager();
|
||||||
|
|
||||||
|
@ -99,6 +119,7 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_uninit() {
|
void user_uninit() {
|
||||||
|
task_manager_exit();
|
||||||
zlog_fini();
|
zlog_fini();
|
||||||
mq_uninit();
|
mq_uninit();
|
||||||
uv_loop_close(get_task_manager());
|
uv_loop_close(get_task_manager());
|
||||||
|
|
|
@ -221,12 +221,12 @@ const data4 opData[] = {
|
||||||
int dhcpd_main(int argc, char **argv) {
|
int dhcpd_main(int argc, char **argv) {
|
||||||
char logBuff[256] = "";
|
char logBuff[256] = "";
|
||||||
|
|
||||||
signal(SIGINT, catch_int);
|
signal(SIGINT, catch_system_interupt);
|
||||||
signal(SIGABRT, catch_int);
|
signal(SIGABRT, catch_system_interupt);
|
||||||
signal(SIGTERM, catch_int);
|
signal(SIGTERM, catch_system_interupt);
|
||||||
signal(SIGQUIT, catch_int);
|
signal(SIGQUIT, catch_system_interupt);
|
||||||
signal(SIGTSTP, catch_int);
|
signal(SIGTSTP, catch_system_interupt);
|
||||||
signal(SIGHUP, catch_int);
|
signal(SIGHUP, catch_system_interupt);
|
||||||
|
|
||||||
//printf("%i\n", argc);
|
//printf("%i\n", argc);
|
||||||
/*
|
/*
|
||||||
|
@ -561,7 +561,7 @@ void closeConn() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void catch_int(int sig_num) {
|
void catch_system_interupt(int sig_num) {
|
||||||
char logBuff[256];
|
char logBuff[256];
|
||||||
|
|
||||||
//printf("%u=%u\n", cfig.ppid, getpid());
|
//printf("%u=%u\n", cfig.ppid, getpid());
|
||||||
|
|
|
@ -605,7 +605,7 @@ void addUserClass(MYBYTE rangeSetInd, char *userClass, MYBYTE userClassSize);
|
||||||
void addMacRange(MYBYTE rangeSetInd, char *macRange);
|
void addMacRange(MYBYTE rangeSetInd, char *macRange);
|
||||||
void addOptions(data9 *req);
|
void addOptions(data9 *req);
|
||||||
void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD*, MYDWORD*);
|
void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD*, MYDWORD*);
|
||||||
void catch_int(int sig_num);
|
void catch_system_interupt(int sig_num);
|
||||||
void checkSize(MYBYTE);
|
void checkSize(MYBYTE);
|
||||||
void closeConn();
|
void closeConn();
|
||||||
void getInterfaces(data1*);
|
void getInterfaces(data1*);
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
//
|
//
|
||||||
// Created by xajhu on 2021/6/29 0029.
|
// Created by xajhu on 2021/6/29 0029.
|
||||||
//
|
//
|
||||||
#if LWIP_ON
|
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
#include <zlog.h>
|
#include <zlog.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
#include "task_manager.h"
|
#include "task_manager.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
#if LWIP_ON
|
||||||
#include "user_info.h"
|
#include "user_info.h"
|
||||||
#include "lwip/tcpip.h"
|
#include "lwip/tcpip.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OPENDHCPD_ON
|
#ifdef OPENDHCPD_ON
|
||||||
#include "open_dhcp/dhcpd.h"
|
#include "open_dhcp/dhcpd.h"
|
||||||
|
#include "user_errno.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OPENDHCPDDNS_ON
|
#ifdef OPENDHCPDDNS_ON
|
||||||
|
@ -43,17 +45,27 @@ static void lwip_init_env() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
int ret;
|
||||||
#ifdef OPENDHCPDDNS_ON
|
#ifdef OPENDHCPDDNS_ON
|
||||||
return dual_server_main(argc, argv);
|
return dual_server_main(argc, argv);
|
||||||
#elif OPENDHCPD_ON
|
#elif OPENDHCPD_ON
|
||||||
return dhcpd_main(argc, argv);
|
// return dhcpd_main(argc, argv);
|
||||||
#else
|
//#else
|
||||||
uv_setup_args(argc, argv);
|
uv_setup_args(argc, argv);
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
menu_run(argc, argv);
|
ret = menu_run(argc, argv);
|
||||||
|
|
||||||
|
if(ret == ERR_MENU_EXIT) {
|
||||||
|
user_uninit();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
if (ret != ERR_SUCCESS) {
|
||||||
|
printf("Application setup error(%d), please used --help to show usage, exited!!!\n", ret);
|
||||||
|
user_uninit();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
#if LWIP_ON
|
#if LWIP_ON
|
||||||
lwip_init_env();
|
lwip_init_env();
|
||||||
|
|
Loading…
Reference in New Issue