NG_TEE(4)

πŸ’– NG_TEE β€” the netgraph "tee" node type πŸ’–

okay bestie, gather round, because we're talking about ng_tee, which lives in the Kernel Interfaces Manual (that's section 4, for the girlies keeping score). it's a netgraph node type and it's literally the netgraph version of the tee(1) command you already know and love. no cap. 🫢


✨ SYNOPSIS ✨

#include <sys/types.h>
#include <netgraph/ng_tee.h>

🌸 DESCRIPTION 🌸

so here's the vibe: a tee node does exactly what tee(1) does, but for netgraph. it's the "let me peek at what's going on here" node. it's giving debugging. it's giving snooping on a connection between two netgraph nodes. obsessed. πŸ‘‘

every tee node has four hooks: right, left, right2left, and left2right. let's break it down:

  • anything that comes in on right gets sent unmodified to both left and right2left. two copies, one original, no edits. πŸ’…
  • same energy for the other side: anything that comes in on left gets sent unmodified to both right and left2right.

and plot twist, packets can <em>also</em> come in the other way! if you receive something on right2left, it gets forwarded unchanged out right. if you receive something on left2right, it gets forwarded unchanged out left. it's a whole bidirectional situation and she handles it. 🌈


πŸŽ€ HOOKS πŸŽ€

this node type supports these hooks, bestie:

  • right β€” the connection to the node on the right. πŸ‘‰
  • left β€” the connection to the node on the left. πŸ‘ˆ
  • right2left β€” the tap for right-to-left traffic. πŸ”
  • left2right β€” the tap for left-to-right traffic. πŸ”

πŸ’œ CONTROL MESSAGES πŸ’œ

she takes all the generic control messages, plus these two iconic extras:

  • NGM_TEE_GET_STATS (getstats) β€” get the stats, returned as a struct ng_tee_stats. numbers! data! we love to see it. πŸ“Š
  • NGM_TEE_CLR_STATS (clrstats) β€” clear the stats. reset era. ✨

πŸ’€ SHUTDOWN πŸ’€

this node shuts down when it gets an NGM_SHUTDOWN control message, or when all hooks have been disconnected.

but here's the cute part πŸ₯Ί β€” if both the right and left hooks are present, the node removes itself from the chain gently, connecting right and left together. she bows out and makes sure nobody gets dropped on the way out. main character exit, fr fr. πŸ’…


🌟 SEE ALSO 🌟


πŸ“œ HISTORY πŸ“œ

the ng_tee node type was implemented in FreeBSD 4.0. a legend since day one. πŸ‘‘


🫢 AUTHORS 🫢

Julian Elischer <julian@FreeBSD.org> β€” thank you for your service, king. πŸŽ€


and that's the whole page, bestie!! πŸ’– this version came to you from the Debian folks, dated May 28, 2004 β€” so yes, she's been iconic for a minute. go snoop on some traffic responsibly. mwah. πŸ’‹βœ¨πŸ¦‹

πŸ“¦ where this page comes from