summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJannis Achstetter <[email protected]>2022-11-01 23:42:58 +0100
committerJannis Achstetter <[email protected]>2022-11-01 23:42:58 +0100
commit3f3f6eee1c1b1bec43933488b27772a9f848c529 (patch)
tree51505535fc3b5aaea1f4c8b7420ba6ad3a0a7661 /lib
parent28f49c088bb0c498d730d80943017172061cfd05 (diff)
dhserver: Support DHCP clients that don't send the MESSAGETYPE as first option
Signed-off-by: Jannis Achstetter <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/networking/dhserver.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/networking/dhserver.c b/lib/networking/dhserver.c
index 590739236..def431f75 100644
--- a/lib/networking/dhserver.c
+++ b/lib/networking/dhserver.c
@@ -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);