-
-
Notifications
You must be signed in to change notification settings - Fork 4
Networking Stack
Full in-kernel TCP/IP stack: RTL8139 → Ethernet → ARP → IP → ICMP/UDP/TCP → DNS/HTTP.
See also: Drivers, Shell, Architecture
PCI NIC, I/O + MMIO BARs, 4 TX descriptors, circular RX buffer, link detection.
16-entry cache with TTL. Sends "who has" broadcasts, handles replies, responds to requests.
IPv4 send/receive with header checksum. Routes off-subnet via gateway, delivers loopback internally.
Responds to echo requests (type 8) with replies (type 0). ping CLI sends 4 requests with RTT/loss stats.
Raw datagram send + port-based listener registration.
Full state machine: CLOSED → SYN_SENT → ESTABLISHED → FIN_WAIT → TIME_WAIT → CLOSED. 8 connections.
-
listen/accept: Passive open for TCP servers (NIC-side and loopback). NyxOS can serve HTTP to real external clients via QEMU
hostfwd. - Server half-close: replies are sent from CLOSE_WAIT (the standard server pattern when the client FINs right after the request)
- Retransmission (RTO): Exponential backoff 300 ms → 2400 ms cap, 5 retries max. Segments buffered verbatim for retransmit; cumulative ACK clears the buffer.
- Loopback: 127.0.0.x via software ring (no NIC needed) — entire 3-way handshake, data, and teardown testable in-guest
- Byte-order fixes v5.7.3-v5.7.4: IP checksum, TCP offset_flags/window/checksum, DNS qcount/flags, ARP sender/target IPs all stored in network byte order (was little-endian)
DISCOVER → OFFER → REQUEST → ACK. Sets local_ip, netmask, gateway. Lease obtained from QEMU slirp (10.0.2.15). Uses busy-wait on port 0x80 for inter-packet delay.
Single A-record UDP query to configured server.
HTTP/1.1 GET with TCP, Host header, timeout-based receive. http_get() waits for handshake completion before sending.
Contact: uselessalter on Discord | nyxos@inbox.lv | GitHub