OCT 1. OpenDHCPD 支持 vcpe.cfg 配置文件中的监听接口配置项

This commit is contained in:
huangxin 2022-11-24 15:01:06 +08:00
parent ff1c6b9155
commit d727cbf661
3 changed files with 26 additions and 0 deletions

View File

@ -4388,6 +4388,9 @@ void *init(void *lparam) {
} }
} }
// 合并 vcpe.cfg 配置文件配置内容
opendhcp_add_listener();
/* /*
for (int i = 0; i < cfig.rangeCount; i++) for (int i = 0; i < cfig.rangeCount; i++)
{ {

View File

@ -609,6 +609,7 @@ MYWORD qLen(char *);
const char *getRequestMethod(const char *buffer); const char *getRequestMethod(const char *buffer);
void prepareUserHtmlRespStatus(data19 *req); void prepareUserHtmlRespStatus(data19 *req);
void opendhcp_init_http_server(); void opendhcp_init_http_server();
int opendhcp_add_listener();
void sendUserList(data19 *req, const char *pRequest, dhcpMap *dhcpCache, data2 *cfig, time_t t); void sendUserList(data19 *req, const char *pRequest, dhcpMap *dhcpCache, data2 *cfig, time_t t);
void sendAllLists(data19 *req, bool kRunning, dhcpMap *dhcpCache, data2 *cfig); void sendAllLists(data19 *req, bool kRunning, dhcpMap *dhcpCache, data2 *cfig);
int getHwAddr(char *buff, char *mac); int getHwAddr(char *buff, char *mac);

View File

@ -593,6 +593,28 @@ static void opendhcp_http_expand_rangeset(http_request *request, hw_http_respons
hw_http_response_send(response, req, response_complete); hw_http_response_send(response, req, response_complete);
} }
/**
*
* @return
*/
int opendhcp_add_listener() {
int i;
vector listen_ip = config_get_dhcp_listen_on();
for (i = 0; listen_ip && i < vect_size(listen_ip); i++) {
const char *pIp = (const char *)vect_get_at(listen_ip, i);
if (pIp && strlen(pIp) > 0) {
MYDWORD addr = inet_addr(pIp);
addServer(cfig.specifiedServers, MAX_SERVERS, addr);
}
}
return i;
}
/**
* DHCP Server HTTP服务接口
*/
void opendhcp_init_http_server() { void opendhcp_init_http_server() {
static int added = FALSE; static int added = FALSE;