mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
fix(lwip): fixed the dhcp pool error on dhcp server
This commit is contained in:
parent
32c12e57da
commit
561146f52b
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -1006,7 +1006,7 @@ static s16_t parse_msg(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len)
|
|||||||
dhcps->client_address.addr = dhcps->client_address_plus.addr;
|
dhcps->client_address.addr = dhcps->client_address_plus.addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag == false) { // search the fisrt unused ip
|
if (flag == false) { // search the first unused ip
|
||||||
if (first_address.addr < pdhcps_pool->ip.addr) {
|
if (first_address.addr < pdhcps_pool->ip.addr) {
|
||||||
flag = true;
|
flag = true;
|
||||||
} else {
|
} else {
|
||||||
@ -1399,7 +1399,7 @@ static void kill_oldest_dhcps_pool(dhcps_t *dhcps)
|
|||||||
assert(pre != NULL && pre->pnext != NULL); // Expect the list to have at least 2 nodes
|
assert(pre != NULL && pre->pnext != NULL); // Expect the list to have at least 2 nodes
|
||||||
p = pre->pnext;
|
p = pre->pnext;
|
||||||
minpre = pre;
|
minpre = pre;
|
||||||
minp = p;
|
minp = pre;
|
||||||
|
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
pdhcps_pool = p->pnode;
|
pdhcps_pool = p->pnode;
|
||||||
@ -1413,8 +1413,11 @@ static void kill_oldest_dhcps_pool(dhcps_t *dhcps)
|
|||||||
pre = p;
|
pre = p;
|
||||||
p = p->pnext;
|
p = p->pnext;
|
||||||
}
|
}
|
||||||
|
if (minp == dhcps->plist) {
|
||||||
|
dhcps->plist = minp->pnext;
|
||||||
|
} else {
|
||||||
minpre->pnext = minp->pnext;
|
minpre->pnext = minp->pnext;
|
||||||
|
}
|
||||||
free(minp->pnode);
|
free(minp->pnode);
|
||||||
minp->pnode = NULL;
|
minp->pnode = NULL;
|
||||||
free(minp);
|
free(minp);
|
||||||
|
Loading…
Reference in New Issue
Block a user