NG_TEE(4)
π NG_TEE(4) β the netgraph "tee" node type, explained by your favorite kernel gremlin
okay so real quick β this is a page from the Kernel Interfaces Manual, and yes bestie we're diving into netgraph internals together π«Ά stay with me, it's actually so good.
β¨ NAME β¨
ng_tee β the netgraph ``tee'' node type. it's giving "split the signal, keep both copies," and honestly? iconic π
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <netgraph/ng_tee.h>
that's it. two includes. she's low-maintenance, she's easy to love π
π¦ DESCRIPTION π¦
so the tea β is this: the tee node type does basically the same job as the tee(1) command β except, you know, in the kernel. Tee nodes are useful for debugging or "snooping" on a connection between two netgraph nodes π (no cap, that's literally what the manpage says, snooping is the word).
Tee nodes have four hooks: right, left, right2left, and left2right.
here's the vibe:
- all data received on
rightgets sent unmodified to bothleftandright2left⨠- similarly, all data received on
leftgets sent unmodified to bothrightandleft2rightβ¨
and the plot twist: Packets may also be received on right2left and left2right; if so, they are forwarded unchanged out hooks right and left, respectively π
she's a whole two-way mirror and she ate ππ₯
π HOOKS π
This node type supports the following hooks:
rightβ The connection to the node on the right π«±leftβ The connection to the node on the left π«²right2leftβ Tap for right to left traffic π―left2rightβ Tap for left to right traffic π―
like, the naming is soooo on the nose and honestly? we stan clarity π
β CONTROL MESSAGES β
This node type supports the generic control messages, plus the following:
NGM_TEE_GET_STATS(getstats) β Get statistics, returned as astruct ng_tee_statsπNGM_TEE_CLR_STATS(clrstats) β Clear statistics π§Ή
the little parenthesized names are the ngctl-friendly versions, iykyk π
π SHUTDOWN π
This node shuts down upon receipt of an NGM_SHUTDOWN control message, or when all hooks have been disconnected.
but here's the soft-launch detail you can't miss π: If both right and left hooks are present, node removes itself from the chain gently, connecting right and left together.
no drama. no broken chain. she just... leaves the group chat and connects the two of you π periodt.
π SEE ALSO π
go read all three, fr fr, they're the supporting cast and they deserve their flowers πΈ
π§ HISTORY π§
The ng_tee node type was implemented in FreeBSD 4.0. a legend since day one, ngl π
π AUTHORS π
Julian Elischer <julian@FreeBSD.org> β shoutout to the main character who wrote this node, we're obsessed π«Άπ
and that's the page bestie!! this beauty shipped on Debian, dated May 28, 2004 β NG_TEE(4), that's the header up top and the footer down here, all accounted for π
β¨ mwah, go snoop some traffic responsibly π₯
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996-1999 Whistle Communications, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms