From adc00d1813e646b30c286a6e7d2b17ade75c3dd7 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 24 Jan 2022 09:58:06 +0100 Subject: [PATCH] lwip: Fix fuzzer layers after dhcps update --- components/lwip/test_afl_host/esp_attr.h | 1 + components/lwip/test_afl_host/network_mock.c | 7 +++++-- components/lwip/test_afl_host/test_dhcp_server.c | 9 ++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/lwip/test_afl_host/esp_attr.h b/components/lwip/test_afl_host/esp_attr.h index 3ed81f776d..3044f875be 100644 --- a/components/lwip/test_afl_host/esp_attr.h +++ b/components/lwip/test_afl_host/esp_attr.h @@ -7,3 +7,4 @@ #define SSIZE_MAX INT_MAX #undef assert #define assert(x) +#define sys_prot_t int diff --git a/components/lwip/test_afl_host/network_mock.c b/components/lwip/test_afl_host/network_mock.c index d5a990dd03..8f77a6af6e 100644 --- a/components/lwip/test_afl_host/network_mock.c +++ b/components/lwip/test_afl_host/network_mock.c @@ -1,11 +1,10 @@ #include "no_warn_host.h" #include "lwip/opt.h" -#include "lwip/def.h" #include "lwip/pbuf.h" #include "lwip/udp.h" #include "esp_netif.h" +#include "lwip/timeouts.h" #include -#include const ip_addr_t ip_addr_any; const ip_addr_t ip_addr_broadcast; @@ -234,3 +233,7 @@ void mem_free(void *rmem) { free(rmem); } + +void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) +{ +} diff --git a/components/lwip/test_afl_host/test_dhcp_server.c b/components/lwip/test_afl_host/test_dhcp_server.c index deb340f548..e788310d46 100644 --- a/components/lwip/test_afl_host/test_dhcp_server.c +++ b/components/lwip/test_afl_host/test_dhcp_server.c @@ -29,8 +29,9 @@ int main(int argc, char** argv) dhcp_test_init_di(); IP4_ADDR(&server_ip, 192,168,4,1); - dhcps_set_new_lease_cb(dhcp_test_dhcps_cb); - dhcps_start(&mynetif, server_ip); + dhcps_t *dhcps = dhcps_new(); + dhcps_set_new_lease_cb(dhcps, dhcp_test_dhcps_cb); + dhcps_start(dhcps, &mynetif, server_ip); #ifdef INSTR_IS_OFF p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); @@ -62,7 +63,9 @@ int main(int argc, char** argv) p->tot_len = len; p->next = NULL; - dhcp_test_handle_dhcp(NULL, NULL, p, &ip_addr_any, 0); + dhcp_test_handle_dhcp(dhcps, NULL, p, &ip_addr_any, 0); } + dhcps_stop(dhcps, &mynetif); + dhcps_delete(dhcps); return 0; }