From 5b7524e10e9ba238e570a443d4632ccc73bde31d Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Sat, 4 Jul 2020 14:24:40 +0200 Subject: [PATCH] unit: Enable DNS Avoid allocating in dns_init by enabling random source port. --- test/unit/core/test_mem.c | 3 --- test/unit/core/test_pbuf.c | 3 --- test/unit/lwipopts.h | 6 +++++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/test/unit/core/test_mem.c b/test/unit/core/test_mem.c index 2aeb20cf..601bfc7d 100644 --- a/test/unit/core/test_mem.c +++ b/test/unit/core/test_mem.c @@ -6,9 +6,6 @@ #if !LWIP_STATS || !MEM_STATS #error "This tests needs MEM-statistics enabled" #endif -#if LWIP_DNS -#error "This test needs DNS turned off (as it mallocs on init)" -#endif /* Setups/teardown functions */ diff --git a/test/unit/core/test_pbuf.c b/test/unit/core/test_pbuf.c index 1ceea08f..681d61dc 100644 --- a/test/unit/core/test_pbuf.c +++ b/test/unit/core/test_pbuf.c @@ -6,9 +6,6 @@ #if !LWIP_STATS || !MEM_STATS ||!MEMP_STATS #error "This tests needs MEM- and MEMP-statistics enabled" #endif -#if LWIP_DNS -#error "This test needs DNS turned off (as it mallocs on init)" -#endif #if !LWIP_TCP || !TCP_QUEUE_OOSEQ || !LWIP_WND_SCALE #error "This test needs TCP OOSEQ queueing and window scaling enabled" #endif diff --git a/test/unit/lwipopts.h b/test/unit/lwipopts.h index e4523fc1..09175c48 100644 --- a/test/unit/lwipopts.h +++ b/test/unit/lwipopts.h @@ -51,9 +51,13 @@ #define LWIP_HAVE_LOOPIF 1 #define TCPIP_THREAD_TEST -/* Enable DHCP to test it, disable UDP checksum to easier inject packets */ +/* Enable DHCP to test it */ #define LWIP_DHCP 1 +/* Enable DNS, with random source port to avoid alloc in dns_init */ +#define LWIP_DNS 1 +#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_RAND_SRC_PORT) + /* Minimal changes to opt.h required for tcp unit tests: */ #define MEM_SIZE 16000 #define TCP_SND_QUEUELEN 40