Merge branch 'v1.0.1_dev' into 'master'
OCT 1. 多用户时不同用户使用不同的opendhcp.state文件 See merge request ZNJK/vcpe!3
This commit is contained in:
commit
4ec77c4c4c
|
@ -39,6 +39,7 @@ using namespace std;
|
||||||
#include "opendhcpd.h"
|
#include "opendhcpd.h"
|
||||||
#include "user_errno.h"
|
#include "user_errno.h"
|
||||||
#include "task_manager.h"
|
#include "task_manager.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
void on_system_exit(void *p);
|
void on_system_exit(void *p);
|
||||||
|
|
||||||
|
@ -305,10 +306,15 @@ int dhcpd_main(int daemon, const char *pInifile, const char *pStatusFile, const
|
||||||
strcpy(iniFile, "/etc/opendhcp.ini");
|
strcpy(iniFile, "/etc/opendhcp.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(leaFile, 0, PATH_MAX);
|
||||||
if (pStatusFile && strlen(pStatusFile) > 0) {
|
if (pStatusFile && strlen(pStatusFile) > 0) {
|
||||||
strcpy(leaFile, pStatusFile);
|
strcpy(leaFile, pStatusFile);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef USERVNI_ON
|
||||||
|
sprintf(leaFile, "/tmp/opendhcp.%d.state", cfg_get_user_vni_id());
|
||||||
|
#else
|
||||||
strcpy(leaFile, "/tmp/opendhcp.state");
|
strcpy(leaFile, "/tmp/opendhcp.state");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pIfName && strlen(pIfName) > 0) {
|
if (pIfName && strlen(pIfName) > 0) {
|
||||||
|
@ -741,8 +747,8 @@ int prepareUserHtmlRespStatus(const char **pRsps) {
|
||||||
data7 *dhcpEntry = nullptr;
|
data7 *dhcpEntry = nullptr;
|
||||||
//data7 *cache = nullptr;
|
//data7 *cache = nullptr;
|
||||||
//printf("%d=%d\n", dhcpCache.size(), cfig.dhcpSize);
|
//printf("%d=%d\n", dhcpCache.size(), cfig.dhcpSize);
|
||||||
int memSize = (int)(2048 + (135 * dhcpCache.size()) + (cfig.dhcpSize * 26));
|
int memSize = (int)(2048 + (135 * dhcpCache.size()) + (cfig.dhcpSize * 26));
|
||||||
char *pRsp = (char *)calloc(1, memSize);
|
char *pRsp = (char *)calloc(1, memSize);
|
||||||
|
|
||||||
if (!pRsp) {
|
if (!pRsp) {
|
||||||
return -ERR_MALLOC_MEMORY;
|
return -ERR_MALLOC_MEMORY;
|
||||||
|
@ -881,7 +887,7 @@ int prepareUserHtmlRespStatus(const char **pRsps) {
|
||||||
fp += sprintf(fp, "</tr>\n");
|
fp += sprintf(fp, "</tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fp += sprintf(fp, "</table></td></tr></table>\n</body>\n</html>");
|
fp += sprintf(fp, "</table></td></tr></table>\n</body>\n</html>");
|
||||||
//MYBYTE x = sprintf(tempbuff, "%u", (fp - contentStart));
|
//MYBYTE x = sprintf(tempbuff, "%u", (fp - contentStart));
|
||||||
//memcpy((contentStart - 12), tempbuff, x);
|
//memcpy((contentStart - 12), tempbuff, x);
|
||||||
//pRsp->bytes = (int)(fp - pRsp->dp);
|
//pRsp->bytes = (int)(fp - pRsp->dp);
|
||||||
|
@ -4424,7 +4430,11 @@ void *init(void *lparam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!leaFile[0]) {
|
if (!leaFile[0]) {
|
||||||
|
#ifdef USERVNI_ON
|
||||||
|
sprintf(leaFile, "%s%d/%s", filePATH, cfg_get_user_vni_id(), "opendhcp.state");
|
||||||
|
#else
|
||||||
sprintf(leaFile, "%s%s", filePATH, "opendhcp.state");
|
sprintf(leaFile, "%s%s", filePATH, "opendhcp.state");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!icoFile[0]) {
|
if (!icoFile[0]) {
|
||||||
|
|
Loading…
Reference in New Issue