Skip to content

ours-tun-sys ​

libs/tun-sys — a workspace crate with unsafe: TUN device ioctls that are neither in rustix nor in socket2. It has its own [lints] without forbid (see unsafe).

  • open(name, flags) — open /dev/net/tun (non-blocking) and TUNSETIFF: a queue of the device (IFF_MULTI_QUEUE), creating the device with the first one; returns the name.
  • set_offload(fd, TUN_F_*) — TUNSETOFFLOAD.
  • set_vnet_hdr_size(fd, size) — TUNSETVNETHDRSZ.

Reading and writing a queue is the safe rustix::io::read/writev in the tun and wireguard modules.

GPL-3.0-or-later