NG_DEFLATE(4)

πŸ’… ng_deflate β€” the Deflate PPP compression netgraph node type, bestie πŸ’–

okay so like. welcome to the ng_deflate(4) manual page, part of the Kernel Interfaces Manual (that's the 4 section, iykyk). it's giving very "networking girlie who reads RFCs for fun" energy and honestly? we love that for us. πŸ¦‹


✨ SYNOPSIS ✨

#include <sys/types.h>
#include <netgraph/ng_deflate.h>

no cap, that's the whole vibe. two includes and you're in. πŸŽ€


🌸 DESCRIPTION 🌸

so the deflate node type implements the Deflate sub-protocols of the Compression Control Protocol (CCP). that's the compression girl. she compresses. periodt. πŸ”₯

the node has exactly two hooks: comp for compression and decomp for decompression. and the way that only one of them can be connected at the same time, because whichever one you plug in is literally specifying the node's operation mode? iconic behavior honestly. 🫢

typically those hooks get connected to the ng_ppp(4) node type hook of the same name β€” so comp goes to comp, decomp goes to decomp, matching outfits, bestie coordination. πŸ’œ

⚠️ okay important: the corresponding ng_ppp(4) node hook must be switched to NG_PPP_DECOMPRESS_FULL mode to permit sending uncompressed frames. don't skip that step, it's not optional, no cap.

πŸŽ€ HOOKS πŸŽ€

this node type supports the following hooks, and there are literally two, so no excuses:

  • comp β€” connection to ng_ppp(4) comp hook. incoming frames are compressed (if possible) and sent back out the same hook. like a lil glow-up pipeline. ✨
  • decomp β€” connection to ng_ppp(4) decomp hook. incoming frames are decompressed (if they are compressed), and sent back out the same hook. reverse glow-up. πŸ”„

only one hook can be connected at the same time, and that's what specifies the node's operation mode. one at a time, bestie, she's monogamous. πŸ’…


πŸ’Œ CONTROL MESSAGES πŸ’Œ

this node type supports the generic control messages, plus the following, and ngl this is the main character section:

  • NGM_DEFLATE_CONFIG (config) β€” this command resets and configures the node for a session (i.e., for compression or decompression). it takes a struct ng_deflate_config as an argument:
struct ng_deflate_config {
        u_char  enable;                 /* node enabled */
        u_char  windowBits;             /* log2(Window size) */
};

the enabled field enables traffic flow through the node. the windowBits specify compression windows size as negotiated by the Compression Control Protocol (CCP) in PPP. yes, it's log2 of the window size, do not come for me. 😭

  • NGM_DEFLATE_RESETREQ (resetreq) β€” this message contains no arguments, and is bi-directional. so if an error is detected during decompression, this message is sent by the node to the originator of the NGM_DEFLATE_CONFIG message 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. a whole relationship-repair arc, honestly. 🫢

  • NGM_DEFLATE_GET_STATS (getstats) β€” this control message obtains statistics for a given hook. the statistics are returned in struct ng_deflate_stats:
struct ng_deflate_stats {
        uint64_t        FramesPlain;
        uint64_t        FramesComp;
        uint64_t        FramesUncomp;
        uint64_t        InOctets;
        uint64_t        OutOctets;
        uint64_t        Errors;
};
  • NGM_DEFLATE_CLR_STATS (clrstats) β€” this control message clears statistics for a given hook. bye bye numbers. 🧹
  • NGM_DEFLATE_GETCLR_STATS (getclrstats) β€” this control message obtains and clears statistics for a given hook. read it and yeet it. the multitasking queen. πŸ‘‘

🌈 SHUTDOWN 🌈

this node shuts down upon receipt of a NGM_SHUTDOWN control message, or when hook have been disconnected. (yes, that's the original wording, we're keeping it fr fr β€” the hook gets disconnected and the node simply ✨ departs ✨.) πŸ¦‹


πŸ‘€ SEE ALSO πŸ‘€


πŸ’– AUTHORS πŸ’–

Alexander Motin <mav@alkar.net> β€” legend behavior, we stan. πŸ‘‘


πŸ’€ BUGS πŸ’€

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. 😭

⚠️ not me telling you this is a real documented caveat and not a vibe: packet loss here can hurt more than the protocol says it should. dramatic but true.

and that's the page, bestie!! 🫢 this was ng_deflate(4) from the Debian crew, dated December 23, 2006 β€” yeah, she's an elder icon and she still eats. πŸ’…βœ¨ πŸŽ€

πŸ“¦ where this page comes from