dhserver: Support DHCP clients that don't send the MESSAGETYPE as first option

Signed-off-by: Jannis Achstetter <kripton@kripserver.net>
This commit is contained in:
Jannis Achstetter 2022-11-01 23:42:58 +01:00
parent 28f49c088b
commit 3f3f6eee1c
No known key found for this signature in database
GPG Key ID: 79895EC26DFB95B8
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);