NG_ASYNC(4)
okay so this is NG_ASYNC(4), straight outta the Kernel Interfaces Manual, and it's the async framing netgraph node type page β yes bestie, we're doing kernel networking today π
β¨
π NAME π
ng_async β asynchronous framing netgraph node type. that's the whole name, no cap π«Ά
πΈ SYNOPSIS πΈ
slap these includes in and you're so ready:
#include <sys/types.h>
#include <netgraph/ng_async.h>
π DESCRIPTION π
okay so the async node type is out here converting between synchronous frames and asynchronous frames, exactly as defined for the PPP protocol in RFC 1662. Asynchronous framing uses flag bytes and octet-stuffing to simulate a frame-oriented connection over an octet-oriented asynchronous serial line β it's giving protocol magic β¨
The node transmits and receives asynchronous data on the async hook. Mbuf boundaries of incoming data are ignored β literally ignored, don't come for them. Once a complete packet has been received, it is decoded and stripped of all framing bytes, and transmitted out the sync hook as a single frame. slay.
Synchronous frames are transmitted and received on the sync hook. Packets received on this hook are encoded as asynchronous frames and sent out on async. Received packets should start with the address and control fields, or the PPP protocol field if address and control field compression is employed, and contain no checksum field. And if the first four bytes are 0xff 0x03 0xc0 0x21 (an LCP protocol frame), then complete control character escaping is enabled for that frame β in PPP, LCP packets are always sent with no address and control field compression and all control characters escaped. iykyk π
This node supports βflag sharingβ for packets transmitted on async. This is an optimization where the trailing flag byte of one frame is shared with the opening flag byte of the next. Flag sharing between frames is disabled after one second of transmit idle time. cute optimization, but the timer said periodt β±οΈ
π¦ HOOKS π¦
This node type supports the following hooks:
asyncβ Asynchronous connection. Typically this hook would be connected to ang_tty(4)node, which handles transmission of serial data over a tty device. so yes, serial tty business π«syncβ 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. link hook energy π
π¬ CONTROL MESSAGES π¬
This node type supports the generic control messages, plus the following:
π NGM_ASYNC_CMD_SET_CONFIG (setconfig)
Sets the node configuration, which is described by a struct 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 */
};
The enabled field enables or disables all encoding/decoding functions (default disabled). When disabled, the node operates in simple βpass throughβ mode. The amru and smru fields are the asynchronous and synchronous MRU (maximum receive unit) values, respectively. These both default to 1600; note that the async MRU applies to the incoming frame length after asynchronous decoding. The accm field is the asynchronous character control map, which controls the escaping of characters 0x00 through 0x1f (default 0xffffffff). config me up π
π NGM_ASYNC_CMD_GET_CONFIG (getconfig)
This command returns the current configuration structure. simple as that, no cap π
π NGM_ASYNC_CMD_GET_STATS (getstats)
This command returns a struct ng_async_stat containing node statistics for packet, octet, and error counts. stats girlies rise π
π§ NGM_ASYNC_CMD_CLR_STATS (clrstats)
Clears the node statistics. bye-bye counters π§Ή
π SHUTDOWN π
This node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. that's the exit strategy, bestie π«Ά
π 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.
π HISTORY π
The ng_async node type was implemented in FreeBSD 4.0. vintage but still iconic π
π AUTHORS π
Archie Cobbs <archie@FreeBSD.org> β that's the author, give them their flowers π
okay that's the whole page, bestie β this NG_ASYNC(4) manual comes from the Debian manual set and is dated November 13, 2012. mwah, go forth and frame some async data πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996-1999 Whistle Communications, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms