Handling for inet_lookup compilation error - #196
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds compatibility handling for Linux socket-lookup helper signature changes.
Changes:
- Detects lookup-helper arity from kernel headers.
- Adapts four socket lookup call sites.
- Tests both detected API variants.
Show a summary per file
| File | Description |
|---|---|
src/glb-redirect/Makefile |
Adds header probing and diagnostic target. |
src/glb-redirect/ipt_GLBREDIRECT.c |
Adds compatibility macro and updates calls. |
src/glb-redirect/script/test |
Tests both probe outcomes. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
robschn
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The helpers
inet_lookup_established(),__inet6_lookup_established(),inet_lookup_listener(), andinet6_lookup_listener()dropped theirstruct inet_hashinfo *hashinfoparameter — the globaltcp_hashinfois nowreached internally via the network namespace, so callers no longer pass
&tcp_hashinfo. Because distributions may backport this change independently ofthe mainline version, a
LINUX_VERSION_CODEcheck alone is not reliable.torvalds/linux@cb16f4b6c73d
Changes
ipt_GLBREDIRECT.c: introduce aGLB_TCP_HASHINFO_ARGmacro that expandsto
&tcp_hashinfo,on kernels that still expect the argument, or to nothing onkernels that dropped it. The four call sites now use the macro instead of a
hard-coded
&tcp_hashinfo,. The macro is selected by a build-time probe (seebelow), with a
LINUX_VERSION_CODEfallback only when the headers can't beread. This mirrors the existing autodetection already used for the
__cookie_v[46]_check()arity change.Makefile: probeinclude/net/inet_hashtables.hfor theinet_lookup_establisheddeclaration and emit-DGLB_INET_LOOKUP_HAS_HASHINFO_ARGor-DGLB_INET_LOOKUP_NO_HASHINFO_ARGdepending on whether the
inet_hashinfoparameter is present. Also adds aprint-lookup-arghelper target that echoes the resolved flag.script/test: add alookup_arg_detection_check()step that drives theMakefile probe against fixture headers for both the old and new API forms,
asserting the correct macro is selected. This covers both detection branches
regardless of the host kernel and needs only
make+awk(no full kernelbuild).
Why autodetection instead of a version check
The mainline-vs-backport ambiguity means a fixed version boundary can be wrong
on distro kernels. The header probe is deterministic and authoritative; the
LINUX_VERSION_CODEfallback is only a last resort for when the kernel headerscan't be read at build time.
Testing
compile_checkbuilds the module + userspace target against the runningkernel.
lookup_arg_detection_checkvalidates the probe classifies both header formscorrectly (old form with the
inet_hashinfoparameter → "has arg"; new formwithout it → "no arg").
argument.