[PATCH bpf-next v3 8/8] bpf: Fix "unresolved symbol tcp_request_sock" build error

From: Michal Luczaj

Date: Sat Nov 07 2026 - 13:03:52 EST


CONFIG_WERROR=y CONFIG_NET=y CONFIG_INET=n build fails:

WARN: resolve_btfids: unresolved symbol tcp_request_sock
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[2]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1
make[1]: *** [.../Makefile:1379: vmlinux] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Handle it in the style of commit d82a532a6115 ("bpf: Fix "unresolved
symbol" build error with resolve_btfids"): force BTF generation.

Signed-off-by: Michal Luczaj <mhal@xxxxxxx>
---
Technically, since tcp_request_sock embedds inet_request_sock there's no
need to explicitly emit for inet_.
---
net/core/filter.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 6a67bc2a0c4b..b86529dead65 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -12391,6 +12391,10 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = {

BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
{
+ /* Ensure BTF for the structs exists even with CONFIG_INET=n. */
+ BTF_TYPE_EMIT(struct inet_request_sock);
+ BTF_TYPE_EMIT(struct tcp_request_sock);
+
#ifdef CONFIG_INET
if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)
return (unsigned long)sk;

--
2.56.0