OCT 1.增加查询地址池接口

This commit is contained in:
dongwenze 2022-12-08 15:18:18 +08:00
parent 4d848f2724
commit 8dbab1019e
1 changed files with 7 additions and 1 deletions

View File

@ -458,13 +458,16 @@ static int delete_dhcpd_rangeset(data19 *req, const char *pRequest){
if(!deleted_flag){ if(!deleted_flag){
if((st_addr == cfig.dhcpRanges[m].rangeStart) && (en_addr == cfig.dhcpRanges[m].rangeEnd)){ if((st_addr == cfig.dhcpRanges[m].rangeStart) && (en_addr == cfig.dhcpRanges[m].rangeEnd)){
deleted_flag = true; deleted_flag = true;
if(m == cfig.rangeCount-1){
memset(&cfig.dhcpRanges[m], 0, sizeof(struct data19)); memset(&cfig.dhcpRanges[m], 0, sizeof(struct data19));
}
continue; continue;
}else if(st_addr == cfig.dhcpRanges[m].rangeStart||en_addr == cfig.dhcpRanges[m].rangeEnd){ }else if(st_addr == cfig.dhcpRanges[m].rangeStart||en_addr == cfig.dhcpRanges[m].rangeEnd){
deleted_flag = false; deleted_flag = false;
break; break;
} }
}else{ }else{
cfig.dhcpRanges[m].rangeSetInd = m-1;
memcpy(&(cfig.dhcpRanges[m-1]), &(cfig.dhcpRanges[m]), sizeof(struct data19)); memcpy(&(cfig.dhcpRanges[m-1]), &(cfig.dhcpRanges[m]), sizeof(struct data19));
} }
} }
@ -560,6 +563,8 @@ static int query_dhcpd_rangeset(data19 *req){
opPointer++; opPointer++;
memcpy(op.value, opPointer, op.size); memcpy(op.value, opPointer, op.size);
printf("***op->addr=%X***\n", cfig.dhcpRanges[rangeInd].options);
printf("op.opt_code=%d\n", op.opt_code);
if(op.opt_code == DHCP_OPTION_DNS){ if(op.opt_code == DHCP_OPTION_DNS){
dnsSize = op.size; dnsSize = op.size;
do { do {
@ -582,6 +587,7 @@ static int query_dhcpd_rangeset(data19 *req){
cJSON_AddStringToObject(pRangeItem, "gateway", gateway); cJSON_AddStringToObject(pRangeItem, "gateway", gateway);
}else if(op.opt_code == DHCP_OPTION_IPADDRLEASE){ }else if(op.opt_code == DHCP_OPTION_IPADDRLEASE){
printf("***flag!!!***\n");
lease = fUInt(op.value); lease = fUInt(op.value);
cJSON_AddNumberToObject(pRangeItem, "lease", lease); cJSON_AddNumberToObject(pRangeItem, "lease", lease);