Not logged inTalkContributionsCreate accountLog in

Networking

From nexOS Wiki
RTL8139 Ethernet, ARP/TCP/HTTP stubs, DNS stub, browser integration

New in Phase 3. nexOS speaks to QEMU’s user-mode network via an RTL8139 driver (net.c/net.h, 169 lines). The stack is minimal and stubby by design — enough for PING/FETCH/BROWSER demos, not a full TCP/IP implementation.

Contents

[hide]

Hardware and QEMU

ItemValue
NICRTL8139, I/O base 0x300, IRQ11
MAC52:54:00:12:34:56 (QEMU default range)
IPIP_ADDR 0x5DB8D822, gateway 0x0A000202, DNS 0x0A000203
QEMU-device rtl8139,netdev=n0 -netdev user,id=n0
Buffers4×1536 packet buffers + 2048 eth buffer

Driver (net.c / net.h)

net_init(): program 0x300+0x38/0x3C, publish 4 pkt buffer addresses,
            enable (0xC000/0x2000).
net_poll(): read status 0x300+0x3C; if 0x2000 set, pkt_ready=1.
            Called every 10 PIT ticks (10 Hz) from main loop.

Protocols

FunctionWhat it does
net_arp_request(gw)Build 64-byte ARP request in eth_buf, transmit via 0x30/0x32/0x34 ports
send_tcp_syn / send_tcp_ackCraft minimal TCP SYN/ACK (ports, seq/ack, checksum via pseudo-header)
net_http_get(ip, path, buf, sz)SYN → busy-wait → ACK → build GET path HTTP/1.0 packet; stub returns length
net_dns_resolve(host, ip)Stub: always returns IP_ADDR, 0 success

Terminal and browser integration

PING   -> net_arp_request(net_get_gw()); "ARP SENT"
FETCH  -> net_http_get(0x5DB8D822, "/", http_buf, &sz);
          copy to browser_buf (2048), browser_len = n;
          "FETCH OK, SEE BROWSER" + browser_open = 1
BROWSER -> toggle browser_open; "BROWSER OPEN/CLOSED"

The browser window (draw_browser_window()) strips <tags> and wraps at 44 columns × 8 rows. Empty state shows “WELCOME TO nexOS WEB / OPEN TERMINAL, TYPE FETCH”.

Limits

  • No RX parsing, no retransmit, no real DNS, no TLS.
  • HTTP is a transmit stub; QEMU user-net will not return a real page without a fuller stack.
  • Polling only — RTL8139 IRQ11 is defined but the driver polls status instead of handling the IRQ.