NG_GIF(4)

πŸ’– NG_GIF β€” the netgraph girlies' guide to generic tunnel interfaces πŸ’–

okay so bestie, this is a section 4 page from the Kernel Interfaces Manual, and it's about ng_gif, the netgraph node type that lets your gif(4) interfaces hang out with the whole netgraph(4) friend group. it's giving tunnel-girl crossover episode and honestly? iconic. πŸ¦‹


✨ NAME ✨

ng_gif β€” generic tunnel interface netgraph node type. no cap, that's the whole thing, that's her. πŸŽ€


✨ SYNOPSIS ✨

#include <netgraph/ng_gif.h>

like yes girl, include the header, it's right there πŸ’…


✨ DESCRIPTION ✨

so the ng_gif netgraph node type is literally the matchmaker between gif(4) interfaces and the netgraph(4) networking subsystem. once the ng_gif module gets loaded into the kernel, a node is automatically created for every single gif(4) interface in the system β€” not me getting a whole node without even asking, main character energy fr fr. 🌈

each node will attempt to name itself with the same name as the associated interface (cute, matching names, couple goals). and all ng_gif nodes are persistent for as long as the interface itself exists β€” they're not leaving until the interface leaves, periodt. πŸ’€

the hooks (there's two of them)

two hooks are supported: lower and orphans. ✌️

  • the hook name divert may be used as an alias for lower, and it's provided for compatibility with ng_ether(4). in reality the two names represent the same hook β€” so don't be out here thinking you got three hooks, bestie, you got two. πŸ™ˆ

lower is a connection to the raw gif(4) device. when it's connected, all incoming packets are diverted out this hook. writing to this hook results in a raw encapsulated packet being transmitted by the device. and here's the important lil detail: normal outgoing packets are not affected by lower being connected. ngl that's a very specific vibe and we respect it. 🌸

orphans is equivalent to lower, except that only unrecognized packets (the ones that would otherwise just be discarded, sad) are written to the hook, and normal incoming traffic is unaffected. so it's like lower but it only takes in the strays. πŸ₯Ί

⚠️ at most one of orphans and lower may be connected at any time. pick a lane bestie, you cannot have both, that's the rule. 🚫

in all cases, frames are raw packets with the address family of the packet attached to the front. (the address family is up front, like a little name tag. precious.) 🏷️

and when no hooks are connected? packets just flow normally upwards and downwards. business as usual, no drama, we love a chill default. ✨


πŸŽ€ HOOKS πŸŽ€

this node type supports the following hooks:

  • lower β€” connection to the lower device link layer.
  • orphans β€” like lower, but only receives unrecognized packets.

that's it, that's the list, short and sweet like a good text back. πŸ’Œ


πŸ’… CONTROL MESSAGES πŸ’…

this node type supports only the generic control messages. no special ones, no extras, no secret menu. it's lowkey minimalist and honestly? obsessed. 😌


πŸ”₯ EXAMPLES πŸ”₯

this command dumps all unrecognized packets received by the gif0 interface to standard output, decoded in hex and ASCII β€” yes it's giving hacker movie aesthetic, yes you can screenshot it:

nghook -a gif0: orphans

note the : β€” the node name, then a colon, then the hook name. gif0: orphans is a whole address and she's serving. πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

gif(4), netgraph(4), netintro(4), ifconfig(8), ngctl(8), nghook(8)

go read the rest of the friend group, they're all connected, iykyk. 🫢


🌟 AUTHORS 🌟

Brooks Davis <brooks@FreeBSD.org> β€” thank you for your service, king, we are forever grateful for this node type. πŸ†


and that's the whole page, bestie!! πŸ’œ this one came from the Debian build of the manual, dated September 18, 2001 β€” yes she's an elder but she still slays, a true vintage icon. go forth and hook responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from