parent
3078e84918
commit
ad06f31aea
|
@ -7,6 +7,7 @@ OPTION(VCPE_AGENT "Enable vCPE agent test application" OFF)
|
|||
OPTION(USED_LWIP "PPPoE of LWIP support for vCPE" OFF)
|
||||
OPTION(USED_OPENDHCPD "DHCP server for vCPE" OFF)
|
||||
OPTION(USED_OPENDHCPDDNS "DHCP And DNS server for vCPE" OFF)
|
||||
OPTION(USED_USER_VNI "Support pass user vni id from console command line" OFF)
|
||||
|
||||
# 数据库开关
|
||||
OPTION(USED_REDIS "Add redis database support for vCPE" OFF)
|
||||
|
@ -64,40 +65,36 @@ CONFIGURE_FILE(prj_config.h.in prj_config.h)
|
|||
|
||||
MESSAGE("Git Tag: " ${VERSION_GIT_TAG})
|
||||
|
||||
IF (USED_USER_VNI)
|
||||
LIST(APPEND COMMON_DEFINE "-DUSER_VNI")
|
||||
MESSAGE("Select Option USED_USER_VNI")
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_LWIP)
|
||||
LIST(APPEND COMMON_DEFINE "-DLWIP_ON")
|
||||
MESSAGE("Select Option USED_LWIP")
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_OPENDHCPD)
|
||||
LIST(APPEND COMMON_DEFINE "-DOPENDHCPD_ON")
|
||||
MESSAGE("Select Option USED_OPENDHCPD")
|
||||
ADD_SUBDIRECTORY(srcs/open_dhcp)
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_OPENDHCPDDNS)
|
||||
LIST(APPEND COMMON_DEFINE "-DOPENDHCPDDNS_ON")
|
||||
MESSAGE("Select Option USED_OPENDHCPDDNS")
|
||||
ADD_SUBDIRECTORY(srcs/dual_server)
|
||||
ENDIF ()
|
||||
|
||||
IF (VCPE_AGENT)
|
||||
MESSAGE("Select Option VCPE_AGENT")
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_LWIP)
|
||||
MESSAGE("Select Option USED_LWIP")
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_SQLITE)
|
||||
MESSAGE("Select Option USED_SQLITE")
|
||||
ENDIF ()
|
||||
|
||||
IF (USED_OPENDHCPD)
|
||||
MESSAGE("Select Option 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 ()
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# sudo cp vcpe.service /lib/systemd/system/
|
||||
# sudo ln -s /lib/systemd/system/vcpe.service /etc/systemd/system/multi-user.target.wants/vcpe.service
|
||||
# sudo systemctl daemon-reload
|
||||
# sudo systemctl enable vcpe
|
||||
[Unit]
|
||||
Description=vCPE Service
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
User=root
|
||||
WorkingDirectory=/home/jw/vcpe/srcs
|
||||
ExecStart=/usr/bin/env /home/jw/vcpe/srcs/vcpe_main dhcpd -m -n vxlan0 -c ./config/vcpe.cfg -d ./config/ -k pqwAQ81rxg70aoy3v+Jjrw==
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -401,8 +401,12 @@ static int on_cmd7(void *pTbl[], const char *pName, void *pInfo) {
|
|||
const char *piniFile = ((arg_file_t *)pTbl[4])->filename[0];
|
||||
const char *pstatFile = ((arg_file_t *)pTbl[5])->filename[0];
|
||||
const char *pIfName = ((arg_str_t *)pTbl[6])->sval[0];
|
||||
#ifdef USER_VNI
|
||||
int *pVni = ((arg_int_t *)pTbl[7])->ival;
|
||||
const char *pKey = ((arg_str_t *)pTbl[8])->sval[0];
|
||||
#else
|
||||
const char *pKey = ((arg_str_t *)pTbl[7])->sval[0];
|
||||
#endif
|
||||
int help = get_help_cmd(pTbl, pArg)->count;
|
||||
|
||||
if (pArg->pHelp && help > 0) {
|
||||
|
@ -410,11 +414,13 @@ static int on_cmd7(void *pTbl[], const char *pName, void *pInfo) {
|
|||
return ERR_MENU_EXIT;
|
||||
}
|
||||
|
||||
#ifdef USER_VNI
|
||||
if (pVni && *pVni > 0) {
|
||||
cfg_set_user_vni_id(*pVni);
|
||||
} else {
|
||||
cfg_set_user_vni_id(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = user_init(pCfgFile, pCfgDir, pKey, 0)) != ERR_SUCCESS) {
|
||||
printf("System init error: %d\n", ret);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USER_VNI
|
||||
static int g_user_vni_id = -1;
|
||||
|
||||
void cfg_set_user_vni_id(int vni) {
|
||||
|
@ -18,6 +19,7 @@ int cfg_get_user_vni_id() {
|
|||
|
||||
return g_user_vni_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int config_get_proto_crypto_type() {
|
||||
return cfg_get_integral_value(CFG_PROTO_CRYPTO);
|
||||
|
|
|
@ -141,8 +141,10 @@ unsigned int config_get_http_server_port();
|
|||
int config_get_http_server_tcp_nodelay();
|
||||
unsigned int config_get_proto_crypto_type();
|
||||
const char *config_get_proto_crypto_key();
|
||||
#ifdef USER_VNI
|
||||
void cfg_set_user_vni_id(int vni);
|
||||
int cfg_get_user_vni_id();
|
||||
#endif
|
||||
#ifdef OPENDHCPD_ON
|
||||
unsigned int config_get_dhcp_server_lease_time();
|
||||
c_vector config_get_dhcp_server_range_set();
|
||||
|
|
|
@ -1264,8 +1264,9 @@ void opendhcp_init_http_server() {
|
|||
uv_thread_create(&uvThread, iptvCacheCb, nullptr);
|
||||
|
||||
added = TRUE;
|
||||
|
||||
#ifdef USER_VNI
|
||||
dzlog_info("User VxLan Id: [%d]\n", cfg_get_user_vni_id());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1313,11 @@ int process_iptv_multicast(const unsigned char *p, int size, const char *mac) {
|
|||
memset(pDev, 0, sizeof(IPTV_DEV_SET));
|
||||
|
||||
strcpy(pDev->iptvMAC, mac);
|
||||
#ifdef USER_VNI
|
||||
pDev->vni = cfg_get_user_vni_id();
|
||||
#else
|
||||
pDev->vni = 0;
|
||||
#endif
|
||||
pDev->isReport = 0;
|
||||
uv_rwlock_wrlock(&g_uvCacheLock);
|
||||
HASH_ADD_STR(g_iptvNewDevs, iptvMAC, pDev);
|
||||
|
|
Loading…
Reference in New Issue