Networking

A small stack with one receiver owner.

The NIC and the protocol stack live in the kernel; ring-3 commands drive them through SYS_NET_* and SYS_TCP_*. Only one process may own the receiver at a time, which keeps the polled drivers and the single TCP connection simple.

ARP · ICMP · UDP · TCP DHCP · DNS TLS 1.3 · X25519 netconsole + netkexec

Protocol stack

NebOS does not expose sockets. A ring-3 program asks the kernel for info and configuration, acquires the receiver, then uses raw frame paths or the single TCP connection. HTTP and TLS are libraries linked into the command, not kernel services.

NebOS network stack Ring-3 curl, browser and websrv use uhttp and TLS, then sys_net syscalls, then TCP/DNS/DHCP, IPv4/ARP/ICMP, netdev drivers and the NIC. curl · browser · websrv · ping · dhcp ring-3 programs uhttp · tls.c HTTP/1.1 · redirects · chunked · TLS 1.3 kernel services sys_fs for WebDAV · netlog · netkexec SYS_NET_* · SYS_TCP_* · SYS_DNS_RESOLVE · SYS_DHCP_RUN one receiver owner · interrupt-enabled waits tcp.c · dns.c · dhcp.c TCP client + listener · one A query · DISCOVER/OFFER/REQUEST/ACK IPv4 · ARP · ICMP · UDP · netdev registry · NIC driver
Thin kernel, thick command. The kernel owns addressing, ARP, routing and the single TCP connection. HTTP, TLS and WebDAV run in ring 3, so a protocol bug kills a command rather than the kernel.

NIC drivers

netdev.c keeps a registry of struct netdev drivers; the first one whose probe succeeds becomes active. All drivers are polled and share the same transmit, receive, register-dump and reset interface. netdev with no argument shows the active driver; netdev asix switches to a named one, leaving the current driver untouched if the probe fails.

DriverHardwareTransportNotes
e1000e.cIntel 82540EM, 82577LM, 82578, 82579PCI MMIOPCI INTx disabled before MMIO; PCH D0; skips the global MAC reset while the link is up.
r8168.cRTL8111/8168PCIe MMIOC+ mode, 64-entry RX ring, polled.
ne2000.cRTL8029ISA / QEMU PCISimple DP8390 path used by make run-net.
asix.cAX88772USB bulkRuns over the USB core; usable on EHCI/xHCI dongles.

The management NIC used by netlog and netkexec prefers the ASIX dongle so a direct debug link survives netdev e1000e; otherwise it falls back to the active driver. netregs dumps registers and decoded interrupt status; netloop runs a PHY loopback self-test; netreset re-initialises the active NIC.

Link & IP layer

The static default address is 192.168.178.240. At boot, with a NIC present, a DHCP client runs with a 4-second budget (requesting the current address); if no server answers, the static address stays. The idle WM loop answers ARP/ICMP for the board's IP even when no command is running, so the board is reachable and MAC-resolvable.

DHCP & DNS

DHCP

dhcp.c is a minimal client: DISCOVER → OFFER → REQUEST → ACK. It learns the mask, gateway and DNS server (option 6), and dhcp re-runs it on demand. The configuration is retained across kexec through the boot-info BOOTINFO_FLAG_NET fields.

DNS

dns.c sends one recursive A query over UDP and handles name compression in the response. netdns shows or sets the server; host <name> resolves. Numeric hosts skip DNS entirely.

TCP

tcp.c deliberately implements one client connection, not a general socket layer: connect, send, receive and close. An 8 KB receive queue lets data arriving during a send survive; the window update is sent whenever the application drains the queue, so a full queue cannot deadlock until the peer's zero-window probe.

New SYNs and data are also handed to tcp_srv_input() from the active connection's receive/send poll loops, not only between requests, so parallel gvfs clients make progress.

TLS 1.3

tls.c is a ring-3 client with a deliberately narrow cipher suite: TLS_CHACHA20_POLY1305_SHA256 and X25519 only. It is stream-oriented over the existing TCP connection and prints the leaf SHA-256 fingerprint for manual comparison.

Do not treat HTTPS as secure authentication. The cipher suite is real, but without certificate verification the connection authenticates nothing. Use it for confidentiality on a trusted network, not for secrets against an active attacker.

sys_net ABI & ownership

sys_net.c exposes NIC info, MAC/IP/mask/ gateway/DNS getters and setters, raw frame TX/RX, decode, reply, loopback, register dump, reset, speed and MAC overrides. It also exposes the DNS and DHCP clients and the TCP/HTTP helpers.

Netconsole & netkexec

netlog.c mirrors the serial console and terminal output to UDP port 19290. The mirror is on by default and broadcasts; netconsole host <laptop-ip> narrows it, netconsole off/on toggles it, and netlog <text> sends an ad-hoc line. The producer never blocks: a full buffer drops characters and reports it.

netkexec.c receives a new kernel/rootfs over UDP port 19288 using KXN2, and a runtime command pack using KXNP. Datagrams are acknowledged with the next expected offset and verified with a 32-bit checksum before the jump or pack swap. On the host, make netmon and make net-dev wrap these protocols.

HTTP clients

The browser's helper requests identity encoding because inflating multi-megabyte pages in the UI process stalled. If a server still sends gzip, the browser's inflate hook pumps the UI while decoding.

Security posture

SurfaceStateConsequence
TLS certificatesNot verifiedEncryption without authentication; MITM is undetected.
TLS DRBGWeak (RDTSC/ticks/MAC)Not suitable for high-value secrets.
WebDAVNo authenticationAnyone on the LAN can read mounts and write /share.
NIC ownershipOne process at a timePacket-level commands are mutually exclusive; a killed owner is force-released.
Kernel/user isolationNone (identity map)A ring-3 bug can reach any mapped kernel page.

Source map