Merge remote-tracking branch 'origin/master'

# Conflicts:
#	srcs/open_dhcp/query.cpp
This commit is contained in:
dongwenze 2022-11-24 15:47:56 +08:00
commit 5d8b252fe0
3 changed files with 28 additions and 2 deletions

View File

@ -41,8 +41,6 @@ using namespace std;
#include "dhcpd.h"
#include "task_manager.h"
#define STR2INT(val) ((int)strtol((val), nullptr, 10))
void on_system_exit(void *p);
//Global Variables
timeval tv;
@ -4390,6 +4388,9 @@ void *init(void *lparam) {
}
}
// 合并 vcpe.cfg 配置文件配置内容
opendhcp_add_listener();
/*
for (int i = 0; i < cfig.rangeCount; i++)
{

View File

@ -70,6 +70,8 @@ typedef struct in_pktinfo IN_PKTINFO;
#define LPSOCKADDR sockaddr *
#define closesocket close
#define STR2INT(val) ((int)strtol((val), nullptr, 10))
struct data7//cache
{
char *mapname;
@ -607,6 +609,7 @@ MYWORD qLen(char *);
const char *getRequestMethod(const char *buffer);
void prepareUserHtmlRespStatus(data19 *req);
void opendhcp_init_http_server();
int opendhcp_add_listener();
void sendUserList(data19 *req, const char *pRequest, dhcpMap *dhcpCache, data2 *cfig, time_t t);
void sendAllLists(data19 *req, bool kRunning, dhcpMap *dhcpCache, data2 *cfig);
int getHwAddr(char *buff, char *mac);

View File

@ -603,6 +603,28 @@ static void opendhcp_http_expand_rangeset(http_request *request, hw_http_respons
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() {
static int added = FALSE;