The network stack
The stack is EDOS’s own, from the Ethernet frame up. It talks to the real internet through QEMU’s user networking, and to a real LAN on Intel e1000e hardware.
Layers
Section titled “Layers”| Layer | What exists |
|---|---|
| Ethernet | frame RX and TX against the e1000e driver |
| ARP | resolution and a cache |
| IPv4 | routing to a default gateway, plus fragment reassembly |
| ICMP | echo request and reply, which is what ping uses |
| UDP | datagram sockets |
| TCP | a state machine with retransmission, delayed ACK and TIME-WAIT, driven by a dedicated tcp-retransmit kernel thread |
| DHCP | client; configures the interface at boot |
| DNS | resolver |
DHCP runs as soon as the NIC is up. On a guest boot that is roughly a millisecond after the driver reports ready:
[0.808125] <cpu-2:e1000e:k:6> e1000e: initialized, MAC 52:54:00:12:34:56[0.808210] <cpu-2:e1000e:k:6> net: dhcp: sending DISCOVER[0.808449] <cpu-2:e1000e:k:6> net: dhcp: received OFFER 10.0.2.15[0.808546] <cpu-2:e1000e:k:6> net: dhcp: received ACK, IP 10.0.2.15From the shell
Section titled “From the shell”/ $ ping 10.0.2.2PING 10.0.2.2Reply from 10.0.2.2: seq=0 time=0.12ms--- ping statistics ---4 packets sent, 4 receivedrtt min/avg/max = 0.08/0.09/0.12 ms
/ $ dns example.comexample.com -> 172.66.147.243
/ $ wget http://example.comwget: saved to 'index.html' (559 bytes)ping, dns, dnsprobe, http, wget and tcptest all ship in /bin.
Logging in over SSH
Section titled “Logging in over SSH”sshd is an SSH-2 server: curve25519-sha256 key exchange, an ssh-ed25519
host key generated on first run, aes128-ctr with hmac-sha2-256, password
authentication, and a session channel carrying a pty and a shell. A stock
OpenSSH client connects with no options.
$ ssh edgar@edosedgar@edos's password:EDOS 0.8.0 shellType 'help' for commands./ $ uname -aEDOS 0.8.0 x86_64edos-init starts it, but only on a system that has an /etc/sshd.conf to
configure it; the shipped image has none, so a machine whose owner never asked
for SSH does not listen. There is no bignum arithmetic anywhere in the system,
which is why the host key is ed25519 and there is no RSA option.
The crypto is the ordinary crates from crates.io, unmodified: sha2, hmac,
aes, ctr, x25519-dalek, ed25519-dalek. They compile for
x86_64-unknown-edos as they are, and the kernel’s own randomness reaches them
through getrandom.
The driver
Section titled “The driver”e1000e, verified on real Intel I219, I218 and I217 parts as well as in QEMU. RX and TX
are interrupt-driven; the e1000e kernel thread owns the rings, and tcp-retransmit
owns the timers.
Capturing traffic
Section titled “Capturing traffic”make run-capture # writes /tmp/edos.pcapOpen the result in Wireshark. This is the fastest way to tell a stack bug from a driver bug.
Locking
Section titled “Locking”The stack’s locks are ranked between 240 and 270: the stack itself, then the port table, then a socket, then a connection. They are always taken in that order. See lock order.