ethox 0.0.2

A standalone network stack for user-space networking and unikernels
Documentation

A standalone library for user-space networking and unikernels.

Table of contents

This is also a recommended reading order but feel free to skip ahead, each chapter tries to be somewhat self-contained.

  1. Highlights
  2. Design
  3. The wire module
  4. Overview of packet representations
  5. Ethernet
  6. Arp
  7. Ip V4/V6
  8. Udp
  9. Tcp
  10. Icmp
  11. The layers
  12. Receiving
  13. Sending
  14. Answering
  15. The eth layer
  16. Network interfaces
  17. Strucuture of a NIC
  18. Writing a nic
  19. Included software implementations
  20. Internals
  21. The managed module
  22. The storage module

Highlights

The most interesting features in overview:

  • Zero-copy and bufferless TCP (re-)transmission
  • Free choice of policy for packet queueing
  • Optional tuntap and raw socket adapters with gigabit data rates

Also, I'm very grateful for @whitequark's smoltcp. The overall structure may be quite different but the large portions of the wire module wouldn't have been possible without and lessons learned from studying it were integral to the design. (Maybe also look at her other projects if you have the time, very often delightful).

Design and relevant core concepts

This library handles network packets with a tree of callbacks. Don't expect builtin socket interface although such adaptors may be written using the library.

Nothing within ethox ever dynamically allocates memory (and there is no arbitrary recursion). It may call user callbacks where you can optionally do so but it is never required for operating. This may seem restrictive at first but in practice it simply means that setup code will explicitely pass in preallocated memory to use instead of it being a runtime choice. The philosophy of upfront, explicitely resource management also extends beyond allocation. If there is any resource that connections may compete for then it tries to partition them prior in a way that some minimum share is guaranteed for each or, where this is not clearly possible, exposes that choice to the caller.