From 26899318268f23a048d6234b80d7cb2e0aaeaf98 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 22 Oct 2026 22:34:07 +0200 Subject: [PATCH] Inject allocation failures through the actual pool symbol --- tests/Makefile.am | 2 +- tests/test_etcp_windows.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index ebaf812c..3229371e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1012,7 +1012,7 @@ test_etcp_session_LDFLAGS = $(test_clock_ldflags) test_etcp_windows_SOURCES = test_etcp_windows.c $(test_clock_sources) test_etcp_windows_LDADD = $(LIBUTUN) $(COMMON_LIBS) -test_etcp_windows_LDFLAGS = $(test_clock_ldflags) -Wl,--wrap=etcp_encrypt_send -Wl,--wrap=memory_pool_alloc -Wl,--wrap=bbr_main +test_etcp_windows_LDFLAGS = $(test_clock_ldflags) -Wl,--wrap=etcp_encrypt_send -Wl,--wrap=memory_pool_alloc_impl -Wl,--wrap=bbr_main test_etcp_router_tcp_SOURCES = test_etcp_router_tcp.c test_etcp_router_tcp_LDADD = $(LIBUTUN) $(COMMON_LIBS) diff --git a/tests/test_etcp_windows.c b/tests/test_etcp_windows.c index adda5dfd..0afcdad2 100644 --- a/tests/test_etcp_windows.c +++ b/tests/test_etcp_windows.c @@ -25,10 +25,10 @@ int __wrap_etcp_encrypt_send(struct ETCP_DGRAM* pkt) { return pkt->data_len; } -void* __real_memory_pool_alloc(struct memory_pool* pool); -void* __wrap_memory_pool_alloc(struct memory_pool* pool) { +void* __real_memory_pool_alloc_impl(struct memory_pool* pool, const char* location); +void* __wrap_memory_pool_alloc_impl(struct memory_pool* pool, const char* location) { if (pool == inst.pkt_pool && fail_alloc) { fail_alloc--; return NULL; } - return __real_memory_pool_alloc(pool); + return __real_memory_pool_alloc_impl(pool, location); } void __real_bbr_main(struct bbr*, const struct bbr_rate_sample*, uint32_t*, uint32_t*, uint32_t, uint32_t, int);