ferranet 0.2.0

A modern, async-first, zero-copy datalink-layer (L2) networking library
Documentation
# Linux kernel compatibility

`ferranet` is Linux-only and talks to the kernel through `AF_PACKET` (and optionally `AF_XDP`).
This is the kernel version each capability needs. Versions are the upstream merge points; distro
backports may make a feature available on an older reported version.

## Minimum

| Use | Minimum kernel | Why |
|-----|----------------|-----|
| **Default channel** (ring backend) | **3.2** | `TPACKET_V3` RX ring (the zero-copy, block-based receive path) |
| Transmit ring | 2.6.31 | `PACKET_TX_RING` (`TPACKET_V2`) |
| Basic backend (`.basic()`) | 2.6.x | plain `AF_PACKET` `send`/`recv` — works on essentially any modern kernel |

So the out-of-the-box `Channel::builder(..).build_sync()` / `build_async()` needs **Linux ≥ 3.2**.
The `.basic()` backend works on older kernels if you ever need them.

## Per-feature

| Feature | Kernel | Notes |
|---------|--------|-------|
| `TPACKET_V3` RX ring | 3.2 | core receive path |
| `PACKET_FANOUT` (hash, load-balance) | 3.1 | multi-core RX (`build_fanout_rx`) |
| `FanoutMode::QueueMap` | 3.14 | steer by NIC RX-queue mapping |
| VLAN TPID metadata (`Frame::vlan().tpid`) | 3.14 | `TP_STATUS_VLAN_TPID_VALID`; the VLAN id itself is reported earlier |
| Drop/overflow stats (`freezes`, `is_losing`) | 3.2 | `tpacket_stats_v3` / `TP_STATUS_LOSING` ship with `TPACKET_V3` |
| Software RX timestamps (`Frame::timestamp`) | 2.6.30 | filled by the kernel for ring frames by default |
| **AF_XDP backend** (`xdp` feature) | **4.18** | `XdpSocket`; needs an XDP redirect program (see the AF_XDP docs) |
| AF_XDP `need_wakeup` | 5.4 | `XdpConfig::need_wakeup` (ignored on older kernels) |
| AF_XDP zero-copy | 4.19+ | driver-dependent; copy mode is the portable default |

Practical guidance for embedded/LTS targets: any kernel from the 4.x LTS line (4.19, 5.4, 5.10, …)
covers the full `AF_PACKET` feature set including fanout and drop detection. `AF_XDP` is the only
part that needs 4.18+ *and* NIC-driver support, which is why it is an opt-in feature.

## Capabilities

| Action | Capability |
|--------|------------|
| Open a channel (any backend) | `CAP_NET_RAW` |
| Promiscuous mode | `CAP_NET_RAW` |
| AF_XDP socket + UMEM | `CAP_NET_RAW` (and `CAP_NET_ADMIN`/`CAP_BPF` to load the redirect program) |

No capability is needed for interface enumeration (`interfaces()` reads `/sys` + `getifaddrs`). See
the crate docs for granting `CAP_NET_RAW` via `setcap` or a network namespace.

## Architecture / toolchain

- 64-bit and 32-bit targets are both supported; the block parser uses overflow-checked offset
  arithmetic so it stays sound on 32-bit (e.g. armv7).
- Builds against glibc or musl. The `libc` dependency is pure FFI bindings — no C toolchain beyond a
  linker is required.
- Rust edition 2024, MSRV 1.85 (a toolchain requirement, independent of the kernel version).