diff options
| author | Ha Thach <[email protected]> | 2022-11-18 21:42:39 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-18 21:42:39 +0700 |
| commit | 95fb11fcffd27a055561d2171aa99199982bb563 (patch) | |
| tree | 54932f50146ae201df61e0df7c177907e40564ce /lib | |
| parent | 2dc7a623616aee3986ef7751ad9299de08a073e5 (diff) | |
| parent | 3f3f6eee1c1b1bec43933488b27772a9f848c529 (diff) | |
Merge pull request #1712 from kripton/fixDhserver
dhserver: Support DHCP clients that don't send the MESSAGETYPE as first option
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/networking/dhserver.c | 6 |
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); |
