NG_SPPP(4)

✨ NG_SPPP ✨ β€” like, the ng_sppp situation, explained

okay bestie so this is a page from the Kernel Interfaces Manual (section 4, we love a kernel interfaces moment πŸ’…) and it's all about the ng_sppp netgraph node type. yes it's giving very specific. yes it's iconic. let's go πŸ¦‹


🌸 NAME 🌸

ng_sppp β€” the sppp netgraph node type. that's the whole vibe. it's a netgraph node and its whole personality is being the sppp one. periodt.


✨ SYNOPSIS ✨

#include <netgraph/ng_sppp.h>

that's it, that's the include. short and slay. πŸ’–


πŸŽ€ DESCRIPTION πŸŽ€

so an sppp node is a netgraph(4) interface to the original sppp(4) network module for synchronous lines. rn sppp(4) supports PPP and Cisco HDLC protocols, no cap.

you can think of an sppp node as an alternative kernel mode PPP implementation to the net/mpd port + ng_ppp(4), and also as an alternative to the ng_cisco(4) node. it's got fewer features than net/mpd + ng_ppp(4), lowkey true, BUT it is significantly easier to use in the majority of simple configurations, and it lets the administrator not install the net/mpd port at all. king behaviour honestly πŸ‘‘

with sppp you do not need any other nodes β€” not even an ng_iface(4) node. literally none. the way that it's self-sufficient?? obsessed.

when an sppp node is created, a new interface appears, and you can reach it via ifconfig(8). these interfaces are named sppp0, sppp1, etc. when a node is shut down, the corresponding interface is removed and its name becomes available for reuse by future sppp nodes. new nodes always take the first unused interface. the node itself gets assigned the same name as its interface, unless that name already exists β€” in which case the node just stays unnamed. it's giving mysterious. πŸ™ˆ

the sppp node also lets drivers written to the old sppp(4) interface be rewritten using the newer, more powerful netgraph(4) interface, and still behave in a compatible manner without supporting both network modules. glow-up achieved ✨

an sppp node has a single hook named downstream. usually it's connected directly to a device driver hook.

and β€” cute bonus β€” sppp nodes support the Berkeley Packet Filter, bpf(4). 🫢


πŸ’… HOOKS πŸ’…

this node type supports the following hooks:

  • downstream β€” the connection to the synchronous line. that's the one. the only one. main character hook energy.

πŸ‘‘ CONTROL MESSAGES πŸ‘‘

this node type supports the generic control messages, plus this extra one:

  • NGM_SPPP_GET_IFNAME (getifname) β€” returns the name of the associated interface as a NUL-terminated ASCII string. normally this is the same as the name of the node. so like, it's the node name, but make it official.

🌈 SHUTDOWN 🌈

this node shuts down upon receipt of a NGM_SHUTDOWN control message. the associated interface gets removed and becomes available for use by future sppp nodes. bye babe, your name is free real estate now πŸ¦‹

unlike most other node types β€” and like ng_iface(4) does β€” an sppp node does not go away when all hooks have been disconnected. rather, an explicit NGM_SHUTDOWN control message is required.

⚠️ fr fr: disconnecting everything is NOT enough. you have to send the NGM_SHUTDOWN message yourself or this node is staying. it's clingy. it's fine.

πŸ“ EXAMPLES πŸ“

okay so, say you have the cx(4) device β€” you could run PPP over it with just one command:

ngctl mkpeer cx0: sppp rawdata downstream

and boom πŸ’₯ now you have the sppp0 interface (assuming this was the first sppp node), which you can access via ifconfig(8) as a normal network interface, or via spppcontrol(8) as an sppp(4) interface. one command. ate. πŸ”₯


🧚 SEE ALSO 🧚

bpf(4), cx(4), netgraph(4), ng_cisco(4), ng_iface(4), ng_ppp(4), sppp(4), ifconfig(8), ngctl(8), spppcontrol(8)

and for complex networking topologies you may want to look at the net/mpd port. iykyk πŸ’œ


⭐ HISTORY ⭐

the sppp node type was implemented for FreeBSD 5.0. it was included in the system since FreeBSD 5.3. a whole era. a legacy. πŸ’«


πŸ’– AUTHORS πŸ’–

Copyright (C) 2003-2004 Roman Kurakin <rik@cronyx.ru>


and that's the whole page, bestie πŸŽ€ this lil kernel interfaces manual moment came to you courtesy of Debian, dated February 3, 2005, under the name NG_SPPP(4) β€” mwah, slay, go configure something πŸ’…βœ¨

πŸ“¦ where this page comes from