NG_TCPMSS(4)
πΈ NG_TCPMSS(4) β the girlies' guide to the netgraph TCP MSS node πΈ
okay so bestie, welcome to ng_tcpmss, straight out of the Kernel Interfaces Manual π this is the page for the netgraph node that goes in and fiddles with the TCP MSS option, and honestly? it's giving surgeon but make it packets π
β¨ NAME β¨
ng_tcpmss β netgraph node to adjust TCP MSS option
like, that's literally her whole job. she adjusts the MSS option. icon behaviour π
β¨ SYNOPSIS β¨
#include <netgraph.h>
#include <netgraph/ng_tcpmss.h>
yes babe you gotta include both headers, no skipping π«Ά
β¨ DESCRIPTION β¨
so the tcpmss node type is designed to alter the Maximum Segment Size option of TCP packets. that's the whole vibe.
this node accepts an arbitrary number of hooks β no cap, she'll take as many as you throw at her π
when a hook is brand new, it's considered unconfigured. it's just sitting there, no thoughts, head empty π. to actually make it do something you use the NG_TCPMSS_CONFIG control message, which configures a hook.
β¨ CONTROL MESSAGES β¨
this node type supports all the generic control messages, plus these iconic ones β¬οΈ
NGM_TCPMSS_CONFIG(config) β this one configures the node to do the given MSS adjusting on a particular hook. it needs astruct ng_tcpmss_confighanded over as its argument:
struct ng_tcpmss_config {
char inHook[NG_HOOKSIZ];
char outHook[NG_HOOKSIZ];
uint16_t maxMSS;
}
so what this means, fr fr: packets received on inHook get checked for the TCP MSS option, and that option gets reduced down to maxMSS if it exceeds maxMSS. after that lil glow-up, the packets get sent to the hook outHook. simple as π¦
NGM_TCPMSS_GET_STATS(getstats) β grabs the statistics for a given hook. the stats come back in astruct ng_tcpmss_hookstat:
struct ng_tcpmss_hookstat {
uint64_t Octets; /* total bytes */
uint64_t Packets; /* total packets */
uint16_t maxMSS; /* maximum MSS */
uint64_t SYNPkts; /* TCP SYN packets */
uint64_t FixedPkts; /* changed packets */
};
look at all those numbers bestie, she's tracking everything π
NGM_TCPMSS_CLR_STATS(clrstats) β clears the statistics for a given hook. bye bye data π§ΉNGM_TCPMSS_GETCLR_STATS(getclrstats) β obtains and clears the statistics for a given hook. multitasking queen, she ate π
β¨ EXAMPLES β¨
okay so in this next example, packets get injected into the tcpmss node using the ng_ipfw(4) node. watch and learn β¨
# Create tcpmss node and connect it to ng_ipfw node
ngctl mkpeer ipfw: tcpmss 100 qqq
# Adjust MSS to 1452
ngctl msg ipfw:100 config '{ inHook="qqq" outHook="qqq" maxMSS=1452 }'
# Divert traffic into tcpmss node
ipfw add 300 netgraph 100 tcp from any to any tcpflags syn out via fxp0
# Let packets continue with ipfw after being hacked
sysctl net.inet.ip.fw.one_pass=0
first line makes the node and hooks it up, second one sets maxMSS to 1452, third one diverts the traffic in, fourth one lets the packets keep flowing through ipfw after they've been hacked. periodt π
β¨ SHUTDOWN β¨
this node shuts down when it receives an NGM_SHUTDOWN control message, or when all hooks have been disconnected. she simply β¨leavesβ¨ when there's nothing left to do π
β¨ SEE ALSO β¨
go read those too, they're part of the family π
β¨ HISTORY β¨
the ng_tcpmss node type was implemented in FreeBSD 6.0. vintage, but make it slay π
β¨ AUTHORS β¨
- Alexey Popov
<lollypop@flexuser.ru> - Gleb Smirnoff
<glebius@FreeBSD.org>
thank you kings, we appreciate you π«Ά
β¨ BUGS β¨
when running on SMP, system statistics may be broken. π
yeah that's the whole bug note. no further details, no workaround, just vibes and broken stats. be aware bestie π
and that's the page!! shoutout to the Debian crew for shipping this one, dated June 9, 2005 β so old school and yet still out here adjusting MSS like a legend. mwah πβ¨π
π¦ 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) 2005 Gleb Smirnoff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms