net: implement ListenConfig with explicit option limits - #82
Open
yohimik wants to merge 1 commit into
Open
Conversation
This was referenced Sep 5, 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.
ListenConfig.Listen and ListenPacket currently return a not-implemented error. This stops callers that use a zero ListenConfig even though the netdev can listen.
Use the existing TCP and UDP listen paths. Check context before and after address lookup, before a socket is created. Reject Control and explicit TCP keep-alive settings with an error that wraps errors.ErrUnsupported. UDP ignores TCP keep-alive settings. The netdev has no raw socket control hook. It also has no lookup cancellation hook, so a lookup in progress must return before cancellation is reported. Default socket options and MPTCP fallback stay as provided by the existing netdev.
This replaces the local fork patch 895d524. That patch ignored context and Control. The new tests fail on that patch for both cases.
Validation uses released TinyGo 0.43.0-net.1, Go 1.26.7, and an isolated TINYGOROOT with this net tree. No LLVM build is required. Five tests pass on Linux arm64 and Linux amd64. The amd64 tests ran under emulation on an arm64 host. Tests cover a real TCP exchange, UDP receive, listening after context cancellation following creation, netdev delegation, cancellation before and during lookup, expired context, and rejected options. The native tests use getsockname directly to stay independent of #80. Test processes had an external 20-second timeout. Run tools/test-listenconfig.sh with a released compiler to build the tests in an isolated root.
The Crier record describes the original listener failure and a historical Linux arm64 run with 142 passing tests. That run used local listener, shutdown, and cookiejar patches. It predates later Crier changes. It is not validation of this branch or of a new Crier release.
Related work and scope
This PR is based on net main. It needs no change from those PRs to build or to run these Linux tests.
Current integration status
Darwin fcntl work is in tinygo-org/tinygo#5612. tinygo-org/tinygo#5632 is closed and remains a history reference only. The integer and pointer tests were offered on #5612. Builder socket and spawn symbols in tinygo-org/tinygo#5636 are an independent prerequisite at e8394f67. The direct syscall test needs no net update, so that PR does not wait for this net series. tinygo-org/tinygo#5634 is limited to process support.
Current Crier evidence
The Crier report separates the original size comparison from a new CI-built candidate test. The original stripped Linux ARM64 result is 13,829,248 bytes versus Go's 30,277,794 bytes. Two render fixtures exceed pixel tolerance.
Candidate
e7d34c8c126e0eecd2ce711915f2f88d112d833a, with net0f460803, passed all 24 fork CI checks. Its downloaded compiler artifacts, with no source overlays, build unchanged Crier7edaff9. Linux ARM64 E2E passed 143 cases with no failures or skips. Darwin ARM64 passed 142 with no failures and one platform trust-store skip. Darwin startup now works. A separate Darwin local-TLS matrix passes certificate rejection, plaintext refusal, update to a Go 1.1.0 target, and offline rollback. Both platforms pass spawn, signal, cookiejar, os/fcntl, and network probes.These are combined-candidate results, not proof that this PR alone supplies all features. No new pixel or stripped-size comparison, amd64 execution, or current Dispat acceptance is claimed. WaitDelay and the recorded net limits remain open. No fork release was published.