fix(net): enforce TCP device binding across routing and accept - #2320
Merged
fslongjin merged 2 commits intoSep 22, 2026
Merged
Conversation
Implement TCP SO_BINDTODEVICE using the shared namespace-aware binding state. Include the device dimension in port reservations, propagate physical ingress metadata, and preserve the SYN-time binding on accepted connections while updating future listener slots and overflow lookup atomically per interface. Constrain active IPv4 source and route selection, relocate only inactive wildcard-bound sockets to their selected stack owner, preserve the reserved port, and narrow the reservation only after connect succeeds. Pin smoltcp to the device metadata and connection-snapshot implementation in DragonOS-Community/smoltcp#31. Remove the duplicate SelfConnected transport so self-connect obeys normal packet routing, device changes, retransmission and shutdown. Queue FIN after submitted data without waiting for ACKs, defer only external cork data, serialize cork enqueue with shutdown, and combine local shutdown poll bits with transport state. Add device-binding and listener inheritance regressions. Synchronize self-connect assertions on actual readable/half-close events and cover MSG_MORE data before EOF. Keep native IPv6 cross-interface routed output outside this change. Validation: make fmt and make kernel; 148 guest tests in a fresh QEMU snapshot without a peer host-route workaround; 20 additional five-case handshake runs; 10 nginx start/quit rounds including dual-stack HTTP and process/listener cleanup; smoltcp 646 library tests and six feature configurations. Three-role adversarial review completed and the reservation rollback race corrected. Signed-off-by: longjin <longjin@dragonos.org>
Member
Author
|
@codex review |
Update Cargo.toml and Cargo.lock to 9805dae47858c7247303d9d6d19ca504632c1e4a, merged by DragonOS-Community/smoltcp#31 into dragonos/v0.12.0. The merged tree is identical to the previously validated dependency revision. Verified locked Cargo dependency resolution. Signed-off-by: longjin <longjin@dragonos.org>
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.
Summary
Fix TCP
SO_BINDTODEVICEend to end. The option previously reported success without constraining TCP traffic. With two interfaces on the fixture subnet, SYN-ACKs consequently used the wrong output interface and the original three handshake tests timed out before reaching their accept assertions.Dependency and scope
Dependency DragonOS-Community/smoltcp#31 is merged. Both Cargo files pin merge commit
9805dae47858c7247303d9d6d19ca504632c1e4aondragonos/v0.12.0. Its source tree is identical to the previously tested revision; locked Cargo dependency resolution passed after the revision update.This fixes the IPv4 device-binding failure. Native IPv6 cross-interface routed output and existing scope-id limitations are not implemented here. Passing IPv6 loopback regressions does not imply that broader capability.
Validation
make fmt,make kernel, and staged diff whitespace check passed.Full gVisor coverage was not run. Synthetic-peer loop-warning messages can still occur; this PR does not claim to eliminate every fixture routing warning.