NG_HOLE(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

✨ NG_HOLE(4) ✨ β€” the netgraph discard node type, bestie edition πŸ’…

okay so. ng_hole is a netgraph(4) node type, and honestly? she's iconic for one reason: she hears everything and says nothing. no cap. πŸ•³οΈβœ¨


πŸŽ€ SYNOPSIS πŸŽ€

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

like, you gotta include those two headers first, bestie. both of them. yes even sys/types.h. it's giving "trust the process". 🫢


πŸ’œ DESCRIPTION πŸ’œ

The hole node type silently discards all data and control messages it receives. literally all of them. it does not respond, it does not save them, it does not tell anyone β€” she just takes the message and lets it go, main character energy, no notes. πŸ¦‹

This type is used for testing and debugging. that's her whole job and she ate. πŸ’…


🌸 HOOKS 🌸

super chill about this part ngl: an ng_hole node accepts any request to connect, regardless of the hook name, as long as the name is unique. so call your hook whatever you want, bestie β€” literally whatever β€” just don't be out here duplicating names, because unique is the vibe check. 😌✨


πŸ”₯ CONTROL MESSAGES πŸ”₯

This node type supports the generic control messages, plus these three little icons πŸ‘‘:

  • NGM_HOLE_GET_STATS (getstats) β€” takes an ASCII string argument (that's the hook name, bestie) and returns the statistics associated with the hook as a struct ng_hole_hookstat. receipts, but make them a struct. πŸ“
  • NGM_HOLE_CLR_STATS (clrstats) β€” takes an ASCII string argument, the hook name, and clears the statistics associated with the hook. fresh start era. 🧹
  • NGM_HOLE_GETCLR_STATS (getclrstats) β€” identical to NGM_HOLE_GET_STATS, except that the statistics are also atomically cleared. so you get the stats and the reset in one go β€” two birds, one atomic slay. ⭐

πŸŽ€ SHUTDOWN πŸŽ€

This node shuts down when it receives a NGM_SHUTDOWN control message, or when all hooks have been disconnected. either one, whichever comes first. she's not clingy. πŸ’€


🌈 SEE ALSO 🌈

go read those too, iykyk πŸ’–


πŸ¦‹ HISTORY πŸ¦‹

The ng_hole node type was implemented in FreeBSD 4.0. vintage queen behavior, honestly. πŸ‘‘


πŸ’– AUTHORS πŸ’–

Julian Elischer <julian@FreeBSD.org> β€” we stan. thank you for the hole. 🫢✨


this page came from the Debian crew, dated May 19, 2004 β€” and that's the whole manual page, bestie. ng_hole(4), done and dusted. no cap, she's a keeper πŸ•³οΈπŸ’œπŸŽ€
πŸ“¦ where this page comes from