Skip to content

Conversation

@ryanbreen
Copy link
Owner

Summary

  • Fix TCP listeners not detecting pending connections on first poll/select/accept call
  • Add process_rx() + drain_loopback_queue() to networking syscalls (sys_poll, sys_select, sys_accept, sys_recvfrom, sys_read for TcpConnection)
  • Add first-call tests that verify the fix works without retry loops
  • Fix PTY master reference counting for fork/exec scenarios
  • Add telnetd daemon support

Test plan

  • Boot stages test passes 226/226
  • New Test 25 (first-call accept) passes without retry loop
  • New poll Phase 8 (TCP listener) passes on first call
  • New select Phase 8 (TCP listener) passes on first call
  • Technical validation: APPROVED (8/10 accuracy, 9/10 honesty)

🤖 Generated with Claude Code

ryanbreen and others added 4 commits January 16, 2026 05:18
The telnetd server was trying to exec /bin/init_shell but it wasn't
in the ext2 filesystem, causing the shell to fail to start over telnet.

Now ext2 contains:
- /bin/init_shell (32KB) - interactive shell
- /bin/telnetd (9KB) - telnet server

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…adiness

TCP listeners were not detecting pending connections on the first
poll/select/accept call because incoming SYN packets remained
unprocessed in the e1000 driver buffer. The fix ensures process_rx()
and drain_loopback_queue() are called at syscall entry.

Changes:
- Add process_rx() + drain_loopback_queue() to sys_poll, sys_select,
  sys_accept, sys_recvfrom, and sys_read for TcpConnection
- Add first-call accept test (Test 25) without retry loop
- Add TCP listener poll test (Phase 8) verifying POLLIN on first call
- Add TCP listener select test (Phase 8) verifying readiness on first call
- Fix PTY master reference counting for fork/exec scenarios
- Add telnetd to ext2 filesystem and update run.sh for interactive mode

All 226 boot stages pass. Tests verify first-call success without
retry loops, ensuring the fix actually works rather than masking
timing issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
TCP connections now use reference counting similar to PTY:
- Add refcount field to TcpConnection (AtomicUsize)
- tcp_add_ref() increments count during fork
- tcp_close() only sends FIN when last reference drops
- FdTable::clone() calls tcp_add_ref() for TCP fds

This fixes telnetd where the child closes inherited socket fds,
which was prematurely closing the parent's connection.

Also removes debug output:
- TSS RSP0 updated messages from gdt.rs
- tcp_add_ref/tcp_close debug logs from tcp.rs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit 2532624 into main Jan 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants