NG_PRED1(4)
π NG_PRED1 (4) β the Predictor-1 PPP compression netgraph node type, bestie edition
okay so you found a 4 page, that's a kernel interfaces manual, and this one is ng_pred1 β aka the Predictor-1 PPP compression (RFC 1978) netgraph node type π literally the little guy that squishes your PPP frames down and pops them back out.
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <netgraph/ng_pred1.h>
that's it, that's the whole vibe check. two includes and you're in π«Ά
πΈ DESCRIPTION πΈ
okay so the pred1 node type implements the Predictor-1 sub-protocols of the Compression Control Protocol (CCP). no cap, that's its whole job.
the node has two hooks, comp for compression and decomp for decompression. and here's the β¨keyβ¨ thing: only one of them can be connected at the same time, and whichever one it is? that's literally specifying the node's operation mode. main character hook energy π
typically those hooks would be connected to the ng_ppp(4) node type hook of the same name β so <mint>comp</mint> to <mint>compress</mint>, <mint>decomp</mint> to <mint>decompress</mint>, you get it, iykyk.
π HOOKS π
this node type supports the following hooks, and yes there are exactly two, count them:
compβ connection to theng_ppp(4)compress hook. incoming frames are compressed and sent back out the same hook. πdecompβ connection to theng_ppp(4)decompress hook. incoming frames are decompressed and sent back out the same hook. π
only one hook can be connected at the same time, specifying node's operation mode. pick a lane bestie, you cannot have both π
π CONTROL MESSAGES π
this node type supports the generic control messages, plus the following cuties:
NGM_PRED1_CONFIG(config) β this command resets and configures the node for a session (i.e., for compression or decompression). it takes astruct ng_pred1_configas an argument:
struct ng_pred1_config {
u_char enable; /* node enabled */
};
the enable field enables traffic flow through the node β like a little on/off switch for the vibes β
NGM_PRED1_RESETREQ(resetreq) β this message contains no arguments, and is bi-directional. if an error is detected during decompression, this message is sent by the node to the originator of theNGM_PRED1_CONFIGmessage that initiated the session. the receiver should respond by sending a PPP CCP Reset-Request to the peer. π¨
this message may also be received by this node type when a CCP Reset-Request or Reset-Ack is received by the local PPP entity. the node will respond by flushing its compression state so the sides can resynchronize. so civilised honestly π§
NGM_PRED1_GET_STATS(getstats) β this control message obtains statistics for a given hook. the statistics are returned instruct ng_pred1_stats:
struct ng_pred1_stats {
uint64_t FramesPlain;
uint64_t FramesComp;
uint64_t FramesUncomp;
uint64_t InOctets;
uint64_t OutOctets;
uint64_t Errors;
};
look at all those uint64_ts, the numbers are NUMBERS-ing π
NGM_PRED1_CLR_STATS(clrstats) β this control message clears statistics for a given hook. poof, gone, fresh start πNGM_PRED1_GETCLR_STATS(getclrstats) β this control message obtains and clears statistics for a given hook. read it and yeet it, iconic behaviour π
π¦ SHUTDOWN π¦
this node shuts down upon receipt of a NGM_SHUTDOWN control message, or when hook have been disconnected. that's it, that's the exit strategy, bye bestie π
π SEE ALSO π
netgraph(4)ng_ppp(4)ngctl(8)- D. Rand, PPP Predictor Compression Protocol, RFC 1978.
- W. Simpson, The Point-to-Point Protocol (PPP), RFC 1661.
π AUTHORS π
Alexander Motin <mav@alkar.net>
π BUGS π
ngl this one's a real one. due to nature of netgraph PPP implementation there are possible race conditions between data packet and ResetAck CCP packet in case of packet loss. as result, packet loss can produce bigger performance degradation than supposed by protocol. so likeβ¦ not a vibe, but now you know π«Ά
and that's the whole page bestie, no notes. this beauty is from the Debian crew, dated December 24, 2006, and it lives at NG_PRED1(4) β go compress something responsibly πβ¨π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2006, Alexander Motin <mav@alkar.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms