lwip: Add dhcp servers post processing hook

In order to access DHCP messages from clients in different states
and possibly to implement custom handlers that alter the current state,
e.g. reject a client with specific hostname using NAK.
This commit is contained in:
David Cermak
2022-01-26 07:18:48 +01:00
parent e3d71c984a
commit 05911fd4a1
2 changed files with 22 additions and 1 deletions
+7 -1
View File
@@ -955,6 +955,7 @@ static void handle_dhcp(void *arg,
u16_t dhcps_msg_cnt = 0;
u8_t *p_dhcps_msg = NULL;
u8_t *data;
s16_t state;
#if DHCPS_DEBUG
DHCPS_LOG("dhcps: handle_dhcp-> receive a packet\n");
@@ -1026,7 +1027,12 @@ static void handle_dhcp(void *arg,
DHCPS_LOG("dhcps: handle_dhcp-> parse_msg(p)\n");
#endif
switch (parse_msg(pmsg_dhcps, tlen - 240)) {
state = parse_msg(pmsg_dhcps, tlen - 240);
#ifdef LWIP_HOOK_DHCPS_POST_STATE
state = LWIP_HOOK_DHCPS_POST_STATE(pmsg_dhcps, malloc_len, state);
#endif /* LWIP_HOOK_DHCPS_POST_STATE */
switch (state) {
case DHCPS_STATE_OFFER://1
#if DHCPS_DEBUG
DHCPS_LOG("dhcps: handle_dhcp-> DHCPD_STATE_OFFER\n");