NG_ASYNC(4)
π NG_ASYNC β the asynchronous framing netgraph node type π
okay bestie, sit down, hydrate, and let me tell you about this lil kernel interfaces manual page (yes it's a 4-section page, we love a system call adjacent moment) π¦
β¨ NAME β¨
ng_async β the asynchronous framing netgraph node type, periodt π
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <netgraph/ng_async.h>
like, that's the whole vibe. two includes. slay. π
β¨ DESCRIPTION β¨
so the async node type does a conversion, bestie β it turns synchronous frames into asynchronous frames and back again, exactly how the PPP protocol defines it in RFC 1662. π
asynchronous framing uses flag bytes and octet-stuffing to fake a frame-oriented connection on top of an octet-oriented asynchronous serial line. it's giving "pretending to be something you're not" and honestly? iconic.
here's how the two hooks work:
- the node transmits and receives asynchronous data on the
asynchook. mbuf boundaries of incoming data are ignored (they don't matter, they're not the main character). once a complete packet has been received, it gets decoded, stripped of all its framing bytes, and transmitted out thesynchook as a single frame. clean. β¨ - the node transmits and receives synchronous frames on the
synchook. packets received on this hook get encoded as asynchronous frames and sent out onasync. received packets should start with the address and control fields, or the PPP protocol field if address and control field compression is employed, and they should contain no checksum field. π«Ά - ok and this part is important: if the first four bytes are
0xff 0x03 0xc0 0x21(that's an LCP protocol frame, iykyk) then complete control character escaping is enabled for that frame. why? because in PPP, LCP packets are always sent with no address and control field compression and all control characters escaped. no cap. π₯
this node also supports "flag sharing" for packets transmitted on async β it's an optimization where the trailing flag byte of one frame gets shared with the opening flag byte of the next. so efficient, so cute. but bestie, listen: flag sharing between frames is disabled after one second of transmit idle time. the vibe expires. β°
β¨ HOOKS β¨
this node type supports the following hooks, and there are exactly two, so pay attention:
asyncβ the asynchronous connection. typically this hook would be connected to ang_tty(4)node, which handles transmission of serial data over a tty device. πsyncβ the synchronous connection. this hook sends and receives synchronous frames. for PPP, these frames should contain address, control, and protocol fields, but no checksum field. typically this hook would be connected to an individual link hook of ang_ppp(4)type node. π
β¨ CONTROL MESSAGES β¨
this node type supports the generic control messages, plus the following ones. get ready, there's a struct. π§
NGM_ASYNC_CMD_SET_CONFIG(setconfig) β sets the node configuration, which is described by astruct ng_async_cfg:
struct ng_async_cfg {
u_char enabled; /* Turn encoding on/off */
uint16_t amru; /* Max receive async frame length */
uint16_t smru; /* Max receive sync frame length */
uint32_t accm; /* ACCM encoding */
};
let me break the fields down for you, bestie, one by one:
- the
enabledfield turns all encoding/decoding functions on or off (default disabled). when it's disabled, the node operates in a simple "pass through" mode. lowkey just vibing. π - the
amruandsmrufields are the asynchronous and synchronous MRU (maximum receive unit) values, respectively. they both default to1600. and heads up: the async MRU applies to the incoming frame length after asynchronous decoding, not before. β¨ - the
accmfield is the asynchronous character control map, which controls the escaping of characters0x00through0x1f(default0xffffffff). yes that's a lot of escaping. yes it's on purpose. π
NGM_ASYNC_CMD_GET_CONFIG(getconfig) β this command returns the current configuration structure. simple. iconic. πNGM_ASYNC_CMD_GET_STATS(getstats) β this command returns astruct ng_async_statcontaining node statistics for packet, octet, and error counts. numbers, we love numbers. π₯NGM_ASYNC_CMD_CLR_STATS(clrstats) β clears the node statistics. bye bye data. πΈ
β¨ SHUTDOWN β¨
this node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. that's it, that's the whole exit strategy. π
β¨ SEE ALSO β¨
netgraph(4)ng_ppp(4)ng_tty(4)ngctl(8)- W. Simpson, PPP in HDLC-link Framing, RFC 1662.
- W. Simpson, The Point-to-Point Protocol (PPP), RFC 1661.
go read your RFCs, bestie, they're free and they're good for you πβ¨
β¨ HISTORY β¨
the ng_async node type was implemented in FreeBSD 4.0. a classic. a legend. π«Ά
β¨ AUTHORS β¨
Archie Cobbs <archie@FreeBSD.org> β thank you for your service, king π
and that's the whole page!! this lil slice of the Debian manual, dated November 13, 2012, was brought to you by the fine folks over at Debian β so go forth, wire up your async and sync hooks, and frame some packets responsibly πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996-1999 Whistle Communications, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms