Inject allocation failures through the actual pool symbol

This commit is contained in:
evgeny committed 2026-10-22 22:34:07 +02:00
1 parent 133ea8d120
commit 2689931826
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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);