Merge pull request #1712 from kripton/fixDhserver

dhserver: Support DHCP clients that don't send the MESSAGETYPE as first option
This commit is contained in:
Ha Thach 2022-11-18 21:42:39 +07:00 committed by GitHub
commit 95fb11fcff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -240,7 +240,11 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const
unsigned n = p->len;
if (n > sizeof(dhcp_data)) n = sizeof(dhcp_data);
memcpy(&dhcp_data, p->payload, n);
switch (dhcp_data.dp_options[2])
ptr = find_dhcp_option(dhcp_data.dp_options, sizeof(dhcp_data.dp_options), DHCP_MESSAGETYPE);
if (ptr == NULL) return;
switch (ptr[2])
{
case DHCP_DISCOVER:
entry = entry_by_mac(dhcp_data.dp_chaddr);