NG_VJC(4)
β¨ NG_VJC β the Van Jacobson compression netgraph node type β¨
okay bestie, sit DOWN because today we're talking about ng_vjc(4), the Kernel Interfaces Manual's own certified TCP-header-shrinking icon π
π SYNOPSIS π
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/slcompress.h>
#include <netgraph/ng_vjc.h>
πΈ DESCRIPTION πΈ
so the vjc node type does Van Jacobson compression, which is the whole girlboss move used over PPP, SLIP, and other point-to-point IP connections to squish down TCP packet headers. it's giving weight loss journey but for headers, and honestly? obsessed π¦
here's the hook layout, no cap:
- the
iphook is the uncompressed side of the node - the
vjcomp,vjuncomp, andvjiphooks are the compressed side of the node
packets that show up on ip get compressed or passed through as appropriate. packets that show up on the other three hooks get uncompressed as appropriate. this node also supports "always pass through" mode in either direction β it's flexible like that, main character energy β¨
lowkey important: Van Jacobson compression only applies to TCP packets. periodt.
only "normal" (i.e. common case) TCP packets are actually compressed, and those go out on the vjcomp hook. other TCP packets get run through the state machine but not compressed β those pop out on the vjuncomp hook. and other non-TCP IP packets are forwarded unchanged to vjip. the way that it just sorts them like thatβ¦ a system π
when you're connecting to an ng_ppp(4) node, here's the pairing, memorize it bestie:
ipβ theng_ppp(4)node'svjc_ipvjuncompβ theng_ppp(4)node'svjc_vjcompvjcompβ theng_ppp(4)node'svjc_vjuncompvjipβ theng_ppp(4)node'svjc_ip
(ok yes, the ordering looks like it's playing tricks on you β that's literally what the page says, so we're saying it too, fr fr π)
π¦ HOOKS π¦
this node type supports the following hooks, and yes we're listing all of them:
ipβ upstream (uncompressed) IP packets.vjcompβ downstream compressed TCP packets.vjuncompβ downstream uncompressed TCP packets.vjipβ downstream uncompressed IP packets.
π CONTROL MESSAGES π
this node type supports the generic control messages, plus these iconic ones:
NGM_VJC_SET_CONFIG(setconfig) β this command resets the compression state and configures it according to the suppliedstruct ngm_vjc_configargument. that structure contains the following fields:
struct ngm_vjc_config {
u_char enableComp; /* Enable compression */
u_char enableDecomp; /* Enable decompression */
u_char maxChannel; /* Number of outgoing channels - 1 */
u_char compressCID; /* OK to compress outgoing CID's */
};
- when
enableCompis set to zero, all packets received on theiphook are forwarded unchanged out thevjiphook. π - similarly, when
enableDecompis set to zero, all packets received on thevjiphook are forwarded unchanged out theiphook, and packets are not accepted on thevjcompandvjuncomphooks. - when a node is first created, both compression and decompression are disabled, so the node is operating in bi-directional "pass through" mode. brand new node, no thoughts, just vibes π
- when enabling compression,
maxChannelshould be set to the number of outgoing compression channels minus one, and is a value between 3 and 15, inclusive. (so like, 3 through 15. do not freestyle this number bestie π) - the
compressCIDfield says whether it's OK to compress the CID header field for outgoing compressed TCP packets. this value should be zero unless either (a) it is not possible for an outgoing frame to be lost, or (b) lost frames can be reliably detected and immediately reported to the peer's decompression engine (seeNGM_VJC_RECV_ERRORbelow).
NGM_VJC_GET_STATE(getstate) β this command returns the node's current state, described by thestruct slcompressstructure, which is defined in<net/slcompress.h>. she's showing you her whole state, transparent queen πNGM_VJC_CLR_STATS(clrstats) β clears the node statistics counters. stats are also cleared whenever theenableComporenableDecompfields are changed from zero to one by aNGM_VJC_SET_CONFIGcontrol message. fresh start, clean slate β¨NGM_VJC_RECV_ERROR(recverror) β when the peer has CID header field compression enabled, this message must be sent to the localvjcnode immediately after detecting that a received frame has been lost, due to a bad checksum or for any other reason.
β οΈ real talk: failing to do that can result in corrupted TCP stream data. this is not a drill, this is not optional, send the message π¨
π§ SHUTDOWN π§
this node shuts down when it receives a NGM_SHUTDOWN control message, or when all hooks have been disconnected. she leaves when everyone else leaves, that's just the rules πΈ
π₯ SEE ALSO π₯
netgraph(4),ng_iface(4),ng_ppp(4),ngctl(8)- V. Jacobson, Compressing TCP/IP Headers, RFC 1144.
- G. McGregor, The PPP Internet Control Protocol (IPCP), RFC 1332.
β HISTORY β
the ng_vjc node type was implemented in FreeBSD 4.0. a legend from day one, iykyk π
π AUTHORS π
Archie Cobbs <archie@FreeBSD.org> β the moment, the icon, the blueprint π«Ά
π BUGS π
ok so, gathering all the little gremlins:
- as the initialization routine in the kernel implementation of Van Jacobson compression initializes both compression and decompression at once, this node does not allow compression and decompression to be enabled in separate operations. so if you want to enable one while the other is already enabled, you have to first disable both, then enable both. this, of course, resets the node state. π this restriction may be lifted in a later version β manifesting it fr fr π
- when built as a loadable kernel module, this module includes the file
net/slcompress.c. although loading the module should fail ifnet/slcompress.calready exists in the kernel, currently it does not, and the duplicate copies of the file do not interfere. however, this may change in the future. so like, noted, bestie π©
and that's the whole page, mwah π this little writeup came to you from the <strong>Debian</strong> crew, dated <strong>January 19, 1999</strong>, filed under <strong>NG_VJC(4)</strong> β yes she's been serving this documentation since the 90s and she's still that girl π
π¦ 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