Просмотр исходного кода

Merge branch 'bugfix/lwip_afl_host_test_mock' into 'master'

LUpdate AFL host test mock

Closes IDF-4953

See merge request espressif/esp-idf!17962
Zim Kalinowski 3 лет назад
Родитель
Сommit
4967ee40c6

+ 1 - 0
components/lwip/include/apps/dhcpserver/dhcpserver.h

@@ -7,6 +7,7 @@
 #define __DHCPS_H__
 
 #include "sdkconfig.h"
+#include <stdbool.h>
 #include "lwip/ip_addr.h"
 #include "lwip/err.h"
 

+ 6 - 1
components/lwip/port/esp32/freertos/sys_arch.c

@@ -37,10 +37,15 @@
 #include "lwip/def.h"
 #include "lwip/sys.h"
 #include "lwip/mem.h"
-#include "arch/sys_arch.h"
 #include "lwip/stats.h"
+#include "arch/sys_arch.h"
+#include "arch/vfs_lwip.h"
+#ifdef __linux__
+#include "esp32_mock.h"
+#else // __linux__
 #include "esp_log.h"
 #include "esp_compiler.h"
+#endif // __linux__
 
 static const char* TAG = "lwip_arch";
 

+ 4 - 1
components/lwip/port/esp32/include/arch/sys_arch.h

@@ -33,11 +33,14 @@
 #ifndef __SYS_ARCH_H__
 #define __SYS_ARCH_H__
 
+#ifdef __linux__
+#include "esp32_mock.h"
+#else
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/queue.h"
 #include "freertos/semphr.h"
-#include "arch/vfs_lwip.h"
+#endif // __linux__
 
 #ifdef __cplusplus
 extern "C" {

+ 9 - 4
components/lwip/port/esp32/include/lwipopts.h

@@ -8,17 +8,22 @@
 #ifndef LWIP_HDR_ESP_LWIPOPTS_H
 #define LWIP_HDR_ESP_LWIPOPTS_H
 
-#include <stdlib.h>
+#include "sdkconfig.h"
+#include <string.h>     // For memcpy
+#include <stdlib.h>     // For malloc/free
 #include <unistd.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/select.h>
-#include "esp_task.h"
-#include "esp_random.h"
-#include "sdkconfig.h"
 #include "netif/dhcp_state.h"
 #include "sntp/sntp_get_set_time.h"
+#ifdef __linux__
+#include "esp32_mock.h"
+#else
+#include "esp_task.h"
+#include "esp_random.h"
+#endif // __linux__
 
 
 /*

+ 7 - 13
components/lwip/port/esp32/include/netif/dhcp_state.h

@@ -1,21 +1,15 @@
-// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 
 #ifndef _DHCP_STATE_H_
 #define _DHCP_STATE_H_
 
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif

+ 57 - 20
components/lwip/test_afl_host/Makefile

@@ -1,35 +1,72 @@
-COMPONENTS_DIR=../..
-COMPILER_ICLUDE_DIR=$(shell echo `which xtensa-esp32-elf-gcc | xargs dirname | xargs dirname`/xtensa-esp32-elf)
-CFLAGS=-std=gnu99 -Og -ggdb -ffunction-sections -fdata-sections -nostdlib -Wall  -Werror=all -Wno-int-to-pointer-cast -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-macro-redefined -Wno-constant-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wno-incompatible-pointer-types  -Wextra \
--Wno-unused-parameter -Wno-sign-compare -Wno-address   -Wno-unused-variable -DESP_PLATFORM -D IDF_VER=\"v3.1\" -MMD -MP -DWITH_POSIX -DLWIP_NO_CTYPE_H=1
-INC_DIRS=-I . -I ./build/config -I $(COMPONENTS_DIR)/newlib/platform_include -I $(COMPONENTS_DIR)/newlib/include -I $(COMPONENTS_DIR)/driver/include -I $(COMPONENTS_DIR)/esp32/include -I $(COMPONENTS_DIR)/ethernet/include -I $(COMPONENTS_DIR)/freertos/esp_additions/include -I $(COMPONENTS_DIR)/freertos/esp_additions/include/freertos -I $(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel/include -I $(COMPONENTS_DIR)/heap/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include  -I $(COMPONENTS_DIR)/lwip/include/apps -I $(COMPONENTS_DIR)/lwip/lwip/src/include/netif -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/port/esp32/include -I $(COMPONENTS_DIR)/lwip/lwip/src/include/posix -I $(COMPONENTS_DIR)/lwip/include/apps/ping -I $(COMPONENTS_DIR)/lwip/include/apps/sntp  -I $(COMPONENTS_DIR)/soc/esp32/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/esp_rom/include  -I $(COMPONENTS_DIR)/esp_common/include -I $(COMPONENTS_DIR)/esp_hw_support/include -I $(COMPONENTS_DIR)/xtensa/include -I $(COMPONENTS_DIR)/xtensa/esp32/include -I $(COMPONENTS_DIR)/esp_wifi/include -I $(COMPONENTS_DIR)/esp_event/include -I $(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel/portable/xtensa/include  -I $(COMPONENTS_DIR)/esp_system/include -I $(COMPONENTS_DIR)/esp_timer/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/soc/include -I $(COMPONENTS_DIR)/soc/src/esp32/include -I $(COMPONENTS_DIR)/soc/esp32/include -I $(COMPONENTS_DIR)/esp_netif/include -I $(COMPONENTS_DIR)/esp_eth/include -I $(COMPONENTS_DIR)/esp_netif/lwip -I $(COMPONENTS_DIR)/hal/include -I $(COMPONENTS_DIR)/hal/esp32/include -I $(COMPILER_ICLUDE_DIR)/include -I $(COMPONENTS_DIR)/bootloader_support/include
+LWIP_COMPONENT_DIR=../
+
+CFLAGS=-D IDF_VER=\"v3.1\" \
+		-DESP_PLATFORM \
+		-DLWIP_NO_CTYPE_H=1 \
+		-DWITH_POSIX \
+		-fdata-sections \
+		-ffunction-sections \
+		-ggdb \
+		-MMD \
+		-MP \
+		-nostdlib \
+		-Og \
+		-std=gnu99 \
+		-Wall \
+		-Werror=all \
+		-Wextra \
+		-Wno-address \
+		-Wno-constant-conversion \
+		-Wno-error=deprecated-declarations \
+		-Wno-error=unused-function \
+		-Wno-error=unused-variable \
+		-Wno-incompatible-pointer-types \
+		-Wno-incompatible-pointer-types-discards-qualifiers \
+		-Wno-int-to-pointer-cast \
+		-Wno-macro-redefined \
+		-Wno-sign-compare \
+		-Wno-typedef-redefinition \
+		-Wno-unused-parameter \
+		-Wno-unused-variable
+
+INC_DIRS=-I . \
+		-I ./build/config \
+		-I $(LWIP_COMPONENT_DIR)/include/apps \
+		-I $(LWIP_COMPONENT_DIR)/include/apps/ping \
+		-I $(LWIP_COMPONENT_DIR)/include/apps/sntp \
+		-I $(LWIP_COMPONENT_DIR)/lwip/src/include \
+		-I $(LWIP_COMPONENT_DIR)/lwip/src/include/netif \
+		-I $(LWIP_COMPONENT_DIR)/lwip/src/include/posix \
+		-I $(LWIP_COMPONENT_DIR)/lwip/src/include/posix \
+		-I $(LWIP_COMPONENT_DIR)/port/esp32/include
+
 TEST_NAME=test
 FUZZ=afl-fuzz
 GEN_CFG=generate_config
 LD=$(CC)
 ifeq ($(MODE),dhcp_client)
-    DEPENDENCY_INJECTION=-include dhcp_di.h
-    OBJECTS=dhcp.o def.o network_mock.o test_dhcp_client.o
-    SAMPLE_PACKETS=in_dhcp_client
+	DEPENDENCY_INJECTION=-include dhcp_di.h
+	OBJECTS=dhcp.o def.o esp32_mock.o test_dhcp_client.o
+	SAMPLE_PACKETS=in_dhcp_client
 else ifeq ($(MODE),dhcp_server)
-    DEPENDENCY_INJECTION=-include dhcpserver_di.h
-    OBJECTS=dhcpserver.o def.o test_dhcp_server.o network_mock.o esp_netif_loopback_mock.o
-    SAMPLE_PACKETS=in_dhcp_server
+	DEPENDENCY_INJECTION=-include dhcpserver_di.h
+	OBJECTS=dhcpserver.o def.o esp32_mock.o test_dhcp_server.o
+	SAMPLE_PACKETS=in_dhcp_server
 else ifeq ($(MODE),dns)
-    CFLAGS+=-DNOT_MOCK_DNS
-    DEPENDENCY_INJECTION=-include dns_di.h
-    OBJECTS=dns.o def.o test_dns.o network_mock.o
-    SAMPLE_PACKETS=in_dns
+	CFLAGS+=-DNOT_MOCK_DNS
+	DEPENDENCY_INJECTION=-include dns_di.h
+	OBJECTS=dns.o def.o esp32_mock.o test_dns.o
+	SAMPLE_PACKETS=in_dns
 else
-    $(error Please specify MODE: dhcp_server, dhcp_client, dns)
+	$(error Please specify MODE: dhcp_server, dhcp_client, dns)
 endif
 
 ifeq ($(INSTR),off)
-    CC=gcc
-    CFLAGS+=-DINSTR_IS_OFF
-    TEST_NAME=test_sim
+	CC=gcc
+	CFLAGS+=-DINSTR_IS_OFF
+	TEST_NAME=test_sim
 else
-    CC=afl-clang-fast
+	CC=afl-clang-fast
 endif
 
 CFLAGS+=$(INC_DIRS)

+ 2 - 0
components/lwip/test_afl_host/dhcp_di.h

@@ -1,4 +1,6 @@
 #include "no_warn_host.h"
+#include <stdlib.h>     // For abort()
+#include <stdio.h>      // For printf()
 #include "lwip/opt.h"
 #include "lwip/stats.h"
 #include "lwip/mem.h"

+ 0 - 1
components/lwip/test_afl_host/dhcpserver_di.h

@@ -5,7 +5,6 @@
 #include "no_warn_host.h"
 #include "lwip/pbuf.h"
 #include "lwip/udp.h"
-#include "esp_netif.h"
 
 #ifndef BUILDING_DEF
 

+ 181 - 126
components/lwip/test_afl_host/network_mock.c → components/lwip/test_afl_host/esp32_mock.c

@@ -1,87 +1,97 @@
-#include "no_warn_host.h"
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#ifndef NOT_MOCK_DNS
+#include "lwip/dns.h"
+#endif
+#include "lwip/etharp.h"
+#include "lwip/mem.h"
+#include "lwip/netif.h"
 #include "lwip/opt.h"
 #include "lwip/pbuf.h"
+#include "lwip/timeouts.h"
 #include "lwip/udp.h"
-#include "esp_netif.h"
 #include "lwip/timeouts.h"
-#include <string.h>
+#include "esp32_mock.h"
+#include "no_warn_host.h"
+
+#define ESP_OK          0
+
+/* ---------------------------------------------------- Variables ------------------------------------------------------
+ *
+ * ------------------------------------------------------------------------------------------------------------------ */
 
+// -------------------- LWIP Globals -----------------------
+
+// ip_addr.h
 const ip_addr_t ip_addr_any;
 const ip_addr_t ip_addr_broadcast;
 const ip_addr_t ip_addr_any_type;
+// ip.h
 struct ip_globals ip_data;
+// netif.h
 struct netif *netif_list;
-struct udp_pcb mock_pcb;
+
+// ---------------- AFL Host Test Globals ------------------
+
+// dns_di.h
 uint32_t g_random_numbers[8] = {0};
 uint32_t g_random_numbers_cnt = 0;
 
+// ----------------------- Locals --------------------------
 
-struct pbuf* pbuf_skip(struct pbuf* in, u16_t in_offset, u16_t* out_offset)
-{
-    u16_t offset_left = in_offset;
-    struct pbuf* q = in;
+struct udp_pcb mock_pcb;
 
-    /* get the correct pbuf */
-    while ((q != NULL) && (q->len <= offset_left)) {
-        offset_left -= q->len;
-        q = q->next;
-    }
-    if (out_offset != NULL) {
-        *out_offset = offset_left;
-    }
-    return q;
-}
+/* ---------------------------------------------------- LWIP Mock ------------------------------------------------------
+ *
+ * ------------------------------------------------------------------------------------------------------------------ */
 
-int pbuf_try_get_at(const struct pbuf* p, u16_t offset)
-{
-    u16_t q_idx;
-    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+// --------------------- lwip/dns.h ------------------------
 
-    /* return requested data if pbuf is OK */
-    if ((q != NULL) && (q->len > q_idx)) {
-        return ((u8_t*)q->payload)[q_idx];
-    }
-    return -1;
+#ifndef NOT_MOCK_DNS
+void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
+{
 }
+#endif
 
-void pbuf_put_at(struct pbuf* p, u16_t offset, u8_t data)
-{
-    u16_t q_idx;
-    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+// -------------------- lwip/etharp.h ----------------------
 
-    /* write requested data if pbuf is OK */
-    if ((q != NULL) && (q->len > q_idx)) {
-        ((u8_t*)q->payload)[q_idx] = data;
-    }
+err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
+{
+    return ESP_OK;
 }
 
-u8_t pbuf_get_at(const struct pbuf* p, u16_t offset)
-{
-    u16_t q_idx;
-    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+// --------------------- lwip/mem.h ------------------------
 
-    /* return requested data if pbuf is OK */
-    if ((q != NULL) && (q->len > q_idx)) {
-        return ((u8_t*)q->payload)[q_idx];
-    }
-    return 0;
+void * mem_malloc(mem_size_t size)
+{
+    return malloc(size);
 }
 
-err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
+void * mem_calloc(size_t nr, mem_size_t size)
 {
-    return ERR_OK;
+    return calloc(nr, size);
 }
 
-err_t pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)
+void mem_free(void *rmem)
 {
-    return ERR_OK;
+    free(rmem);
 }
 
-struct udp_pcb * udp_new_ip_type(u8_t type)
+// -------------------- lwip/netif.h -----------------------
+
+void netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
+                    const ip4_addr_t *gw)
 {
-    return &mock_pcb;
 }
 
+// --------------------- lwip/pbuf.h -----------------------
+
 struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
 {
     struct pbuf * p;
@@ -94,6 +104,18 @@ struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
     return p;
 }
 
+void pbuf_realloc(struct pbuf *p, u16_t size)
+{
+    if (p != NULL)
+    {
+        uint8_t *buf = malloc(size);
+        free(p->payload);
+        p->payload = buf;
+        p->len = size;
+        p->tot_len = size;
+    }
+}
+
 u8_t pbuf_free(struct pbuf *p)
 {
     if (p) {
@@ -107,71 +129,6 @@ u8_t pbuf_free(struct pbuf *p)
     return 1;
 }
 
-err_t udp_sendto(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port)
-{
-    return ESP_OK;
-}
-
-void udp_remove(struct udp_pcb *pcb)
-{
-    if (pcb == NULL)
-    {
-       free(pcb);
-    }
-}
-
-struct udp_pcb *udp_new(void)
-{
-    return malloc(sizeof(struct udp_pcb));
-}
-
-err_t udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
-{
-    return ESP_OK;
-}
-
-void udp_recv(struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg)
-{
-}
-
-void udp_disconnect(struct udp_pcb *pcb)
-{
-}
-
-#ifndef NOT_MOCK_DNS
-void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
-{
-}
-#endif
-
-uint32_t esp_random(void)
-{
-    // Preparation for injecting favorable random numbers
-    return g_random_numbers[g_random_numbers_cnt++ % 8];
-}
-
-err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
-{
-    return ESP_OK;
-}
-
-void netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
-                    const ip4_addr_t *gw)
-{
-}
-
-void pbuf_realloc(struct pbuf *p, u16_t size)
-{
-    if (p != NULL)
-    {
-        uint8_t *buf = malloc(size);
-        free(p->payload);
-        p->payload = buf;
-        p->len = size;
-        p->tot_len = size;
-    }
-}
-
 u16_t pbuf_copy_partial(const struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
 {
     struct pbuf *p;
@@ -209,40 +166,138 @@ u16_t pbuf_copy_partial(const struct pbuf *buf, void *dataptr, u16_t len, u16_t
     return copied_total;
 }
 
-err_t udp_connect(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
+err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
+{
+    return ERR_OK;
+}
+
+err_t pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)
+{
+    return ERR_OK;
+}
+
+struct pbuf* pbuf_skip(struct pbuf* in, u16_t in_offset, u16_t* out_offset)
+{
+    u16_t offset_left = in_offset;
+    struct pbuf* q = in;
+
+    /* get the correct pbuf */
+    while ((q != NULL) && (q->len <= offset_left)) {
+        offset_left -= q->len;
+        q = q->next;
+    }
+    if (out_offset != NULL) {
+        *out_offset = offset_left;
+    }
+    return q;
+}
+
+u8_t pbuf_get_at(const struct pbuf* p, u16_t offset)
+{
+    u16_t q_idx;
+    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+
+    /* return requested data if pbuf is OK */
+    if ((q != NULL) && (q->len > q_idx)) {
+        return ((u8_t*)q->payload)[q_idx];
+    }
+    return 0;
+}
+
+int pbuf_try_get_at(const struct pbuf* p, u16_t offset)
+{
+    u16_t q_idx;
+    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+
+    /* return requested data if pbuf is OK */
+    if ((q != NULL) && (q->len > q_idx)) {
+        return ((u8_t*)q->payload)[q_idx];
+    }
+    return -1;
+}
+
+void pbuf_put_at(struct pbuf* p, u16_t offset, u8_t data)
+{
+    u16_t q_idx;
+    struct pbuf* q = pbuf_skip(p, offset, &q_idx);
+
+    /* write requested data if pbuf is OK */
+    if ((q != NULL) && (q->len > q_idx)) {
+        ((u8_t*)q->payload)[q_idx] = data;
+    }
+}
+
+// ------------------- lwip/timeouts.h ---------------------
+
+void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
+{
+}
+
+void sys_untimeout(sys_timeout_handler handler, void *arg)
+{
+}
+
+// --------------------- lwip/udp.h ------------------------
+
+struct udp_pcb *udp_new(void)
+{
+    return malloc(sizeof(struct udp_pcb));
+}
+
+struct udp_pcb * udp_new_ip_type(u8_t type)
+{
+    return &mock_pcb;
+}
+
+void udp_remove(struct udp_pcb *pcb)
+{
+    if (pcb == NULL)
+    {
+       free(pcb);
+    }
+}
+
+err_t udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
 {
     return ESP_OK;
 }
 
-err_t udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
+err_t udp_connect(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
 {
     return ESP_OK;
 }
 
-err_t udp_sendto_if_src(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, const ip_addr_t *src_ip)
+err_t udp_sendto(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port)
 {
     return ESP_OK;
 }
 
-void * mem_malloc(mem_size_t size)
+void udp_disconnect(struct udp_pcb *pcb)
 {
-    return malloc(size);
 }
 
-void * mem_calloc(size_t nr, mem_size_t size)
+void udp_recv(struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg)
 {
-    return calloc(nr, size);
 }
 
-void mem_free(void *rmem)
+err_t udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
 {
-    free(rmem);
+    return ESP_OK;
 }
 
-void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
+err_t udp_sendto_if_src(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, const ip_addr_t *src_ip)
 {
+    return ESP_OK;
 }
 
-void sys_untimeout(sys_timeout_handler handler, void *arg)
+/* ------------------------------------------------- ESP32 Port Mock ---------------------------------------------------
+ *
+ * ------------------------------------------------------------------------------------------------------------------ */
+
+// --------------------- lwipopts.h ------------------------
+
+uint32_t esp_random(void)
 {
+    // Preparation for injecting favorable random numbers
+    return g_random_numbers[g_random_numbers_cnt++ % 8];
 }

+ 35 - 0
components/lwip/test_afl_host/esp32_mock.h

@@ -0,0 +1,35 @@
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP32_MOCK_H_
+#define _ESP32_MOCK_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+/* ------------------------------------------------- ESP32 Port Mock ---------------------------------------------------
+ *
+ * ------------------------------------------------------------------------------------------------------------------ */
+
+// --------------------- lwipopts.h ------------------------
+
+#define ESP_TASK_TCPIP_STACK
+#define ESP_TASK_TCPIP_PRIO
+
+uint32_t esp_random(void);
+
+// --------------------- sys_arch.h ------------------------
+
+// Required to get linux assert.h to work ???
+#define __ASSERT_FUNC __ASSERT_FUNCTION
+
+typedef void * SemaphoreHandle_t;
+typedef void * TaskHandle_t;
+typedef void * QueueHandle_t;
+
+#define vTaskDelay(ms)      usleep((m)*0)
+
+#endif // _ESP32_MOCK_H_

+ 0 - 28
components/lwip/test_afl_host/esp_netif_loopback_mock.c

@@ -1,28 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <features.h>
-#include "esp_netif_lwip_internal.h"
-
-esp_err_t esp_netif_get_ip_info(esp_netif_t *esp_netif, esp_netif_ip_info_t *ip_info)
-{
-    return ESP_ERR_NOT_SUPPORTED;
-}
-
-esp_err_t esp_netif_dhcpc_get_status(esp_netif_t *esp_netif, esp_netif_dhcp_status_t *status)
-{
-    return ESP_ERR_NOT_SUPPORTED;
-}
-
-const char *esp_netif_get_ifkey(esp_netif_t *esp_netif)
-{
-    return esp_netif->if_key;
-}
-
-esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
-{
-    return ESP_ERR_NOT_SUPPORTED;
-}

+ 0 - 1
tools/ci/check_copyright_ignore.txt

@@ -980,7 +980,6 @@ components/lwip/port/esp32/include/arch/vfs_lwip.h
 components/lwip/port/esp32/include/arpa/inet.h
 components/lwip/port/esp32/include/debug/lwip_debug.h
 components/lwip/port/esp32/include/netdb.h
-components/lwip/port/esp32/include/netif/dhcp_state.h
 components/lwip/port/esp32/include/netif/ethernetif.h
 components/lwip/port/esp32/include/netif/openthreadif.h
 components/lwip/port/esp32/include/netif/wlanif.h