PROPHET/OS

NAME

wireguardv: a persistent vigil

SYNOPSIS

wireguardv [config]

DESCRIPTION

A persistent vigil: the WireGuard protocol in ring 3.

Off at the start: vigil enable wireguardv switches it on, and it runs once /system/config/net/wireguard holds a key.

It reads its keys, its peer and its allowed net from a file, by default /system/config/net/wireguard, takes a carrier, runs the handshake and then carries packets: out of the carrier, sealed, over UDP, and back in the other direction.

Without the file it does not run. A tunnel without keys is worse than no tunnel, because it looks like one.

When the network under it is restarted, its carrier and its port go with it. The vigil then says so once and rests until it is started anew, instead of turning on calls that return at once.

The protocol lives here and not in the kernel: a handshake, a key exchange and a replay counter are state and decision. The arithmetic below it is another matter and belongs where it can be accelerated.

What its own crypto costs

A program has no registry, so this one registers its providers itself. Until 2026-10-15 those were the C tables, and the tunnel sealed with chacha.c and poly1305.c while the kernel next to it ran over chacha.cpu.x86_64.avx2 and poly1305.cpu.x86_64.avx512. What that cost was measured in one run of bench aead over the same packet of 1408 bytes:

| Way | MiB/s | cycles per byte | |---|---:|---:| | the tunnel's chain, 2026-10-14 (aead-tun-1408) | 191.76 | 17.27 | | the tunnel's chain, 2026-10-15 (aead-tun-1408) | 1178.72 | 3.62 | | chacha20poly1305.c, 2026-10-15 (aead-seal-1408) | 1184.90 | 3.60 |

So it paid 4,8 times the cycles of the kernel, and it pays 1,006 times them now: the program asks the machine itself. lib/os/cpu/x86_64/select_chacha.c reads CPUID and XCR0 from ring 3 and takes the vector way where the CPU and the released vector state allow it, the C way where they do not, and in both cases only after the known answers of RFC 8439 hold against the table. Read the cycles and not the rate: the same code measured 598 and 925 MiB/s two runs apart, because the machine carried other work (R12-WGV-01).

What is still not the rule: the tunnel chooses **beside** the kernel and not out of it. A program cannot be handed a provider, and a call that seals in the kernel would cost a crossing per packet.

EXAMPLE

$ wireguardv --help
wireguardv [config]
  a persistent vigil: the WireGuard protocol in ring 3. It reads
  its keys, its peer and its allowed net from a file (by default
  /system/config/net/wireguard), takes a carrier, runs the
  handshake and then carries packets: out of the carrier,
  sealed, over UDP, and back in the other direction.
  Without the file it does not run: a tunnel without keys is
  worse than no tunnel.

SEE ALSO

ip, firewall, vigil, sign