Skip to content

Commit 5e41c5a

Browse files
authored
Merge pull request #44 from unredacted/v0.2.4-mss-clamp
v0.2.4: mss-clamp directive + reconfigure CLI + ExecReload
2 parents fde6195 + 2b2ec60 commit 5e41c5a

16 files changed

Lines changed: 1719 additions & 41 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exclude = [
2323
# detach pacing for bridge members, integrity-check Total-line parse
2424
# fix). See SPEC.md §11.14 for the rollout history and
2525
# `docs/runbooks/custom-fib.md` for operations.
26-
version = "0.2.3"
26+
version = "0.2.4"
2727
edition = "2021"
2828
# MSRV. Deliberately behind the rust-toolchain.toml pin (which is the
2929
# latest stable) so a contributor with a slightly older toolchain still

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,13 @@ PacketFrame complements existing routing daemons rather than replacing them. The
7171
| Connected-destination fast-path (`local-prefix`) | Production (v0.2.1+) |
7272
| `fallback-default` synthesis | Production (v0.2.1+) |
7373
| `block-prefix` XDP-time drop | Production (v0.2.1+) |
74+
| `mss-clamp` directive (fast-path) | Production (v0.2.4+) |
75+
| `packetframe reconfigure` / `systemctl reload packetframe` | Production (v0.2.4+) |
7476
| `probe` module — diagnostic XDP | Production |
75-
| `randomizer` / `ddos` / `sampler` modules | Future — sketched in SPEC, not implemented |
77+
| `ddos` module — XDP-time SYN-flood + amplification filter | Future — sketched in SPEC §5.2 (priority 0–999, security/admission) |
78+
| `sampler` module — per-flow ringbuf observability | Future — sketched in SPEC §5.3 (priority 2000–2999, observation) |
79+
| `randomizer` module — TC egress jitter for NoiseNet anti-correlation | Future — sketched in SPEC §5.1 (priority ~3000, egress) |
80+
| Multi-module dispatcher (prerequisite for any second module on the same hook) | Future — module trait already shaped for it (SPEC §3.2 / §3.4) |
7681

7782
## Install
7883

@@ -81,7 +86,7 @@ Releases are published on the [GitHub releases page](https://github.com/unredact
8186
### Debian / Ubuntu (.deb)
8287

8388
```sh
84-
VERSION=v0.2.3
89+
VERSION=v0.2.4
8590
ARCH=$(dpkg --print-architecture) # amd64 or arm64
8691

8792
curl -LO "https://github.com/unredacted/packetframe/releases/download/${VERSION}/packetframe_${VERSION#v}_${ARCH}.deb"
@@ -98,7 +103,7 @@ Installs `/usr/bin/packetframe`, the systemd unit at `/lib/systemd/system/packet
98103
For musl-static deployments, non-Debian distros, or anything else:
99104

100105
```sh
101-
VERSION=v0.2.3
106+
VERSION=v0.2.4
102107
TARGET=aarch64-unknown-linux-gnu # or: x86_64-unknown-linux-{gnu,musl}, aarch64-unknown-linux-musl
103108

104109
curl -LO "https://github.com/unredacted/packetframe/releases/download/${VERSION}/packetframe-${VERSION}-${TARGET}.tar.gz"
@@ -140,6 +145,9 @@ module fast-path
140145
allow-prefix6 2001:db8::/48
141146
dry-run on # observe-only — no redirects yet
142147
circuit-breaker drop-ratio 0.01 of matched window 5s threshold 5
148+
# mss-clamp via eth0 1360 # optional — clamp TCP MSS for fast-pathed
149+
# traffic egressing eth0 (closes the
150+
# iptables-bypass MSS gap; v0.2.4+)
143151
```
144152

145153
`dry-run on` makes the program count matched packets but always return `XDP_PASS` — the kernel handles forwarding as if PacketFrame weren't there. Counters tell you whether your allowlist matches the right traffic before you flip the switch.
@@ -161,7 +169,14 @@ sudo packetframe status # in another shell — live counters
161169

162170
### 5. Flip dry-run off when match ratios look right
163171

164-
Edit the config, change `dry-run on` to `dry-run off`, then `sudo systemctl reload packetframe` (if running under systemd) or `kill -HUP <pid>` (foreground). The change is delta-only; no detach.
172+
Edit the config, change `dry-run on` to `dry-run off`, then trigger a reload (v0.2.4+):
173+
174+
```sh
175+
sudo packetframe reconfigure # synchronous; exits non-zero on parse error
176+
sudo systemctl reload packetframe # equivalent under systemd — both end up sending SIGHUP
177+
```
178+
179+
What's hot-reloadable: `allow-prefix*`, `block-prefix`, `dry-run`, `forwarding-mode`, `mss-clamp`, VLAN-subif resolution, and the redirect devmap. Attach-set changes (interfaces added/removed), `route-source` config, `circuit-breaker` thresholds, and `local-prefix` still require a full restart. See [docs/runbooks/reconfigure.md](docs/runbooks/reconfigure.md).
165180

166181
### 6. Tear down
167182

@@ -249,10 +264,16 @@ Quick directive index:
249264
- `block-prefix <cidr>` — XDP-time drop for unrouteable destinations
250265
- `ecmp-default-hash-mode {3|4|5}` — tuple width for ECMP hashing
251266

267+
**Module fast-path — TCP transforms (v0.2.4+)**
268+
- `mss-clamp <mtu>` — global clamp ceiling for matched TCP SYN/SYN-ACK
269+
- `mss-clamp via <iface> <mtu>` — per-egress-iface
270+
- `mss-clamp <cidr> <mtu>` — per-src-or-dst-prefix (any egress)
271+
- `mss-clamp <cidr> via <iface> <mtu>` — most specific (precedence: prefix+iface > prefix > iface > global)
272+
252273
**Module fast-path — driver opt-ins**
253274
- `driver-workaround rvu-nicpf-head-shift {auto|on|off}`
254275

255-
`SIGHUP` reloads the config and applies delta-only changes to allowlists, VLAN-resolve, and devmap. Adding or removing an `attach` directive requires a restart.
276+
`SIGHUP` (or `packetframe reconfigure` / `systemctl reload packetframe`) applies delta-only changes to allowlists, block-prefix, VLAN-resolve, devmap, mss-clamp, dry-run, and forwarding-mode bits. Adding or removing an `attach`, changing `route-source`, mutating `circuit-breaker` thresholds, or editing `local-prefix` requires a restart.
256277

257278
## Operator tools
258279

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.3
1+
0.2.4

conf/example.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ module fast-path
4545
# 1% of matched over 5 consecutive 5-second samples.
4646
circuit-breaker drop-ratio 0.01 of matched window 5s threshold 5
4747

48+
# MSS clamping for fast-pathed TCP SYN/SYN-ACK packets (v0.2.4+,
49+
# SPEC.md §4.x — closes the §11.4 iptables-bypass gap). Standard
50+
# iptables `-A FORWARD ... TCPMSS --set-mss N` rules don't fire on
51+
# XDP-redirected traffic because bpf_redirect_map skips netfilter;
52+
# this directive runs the equivalent mutation inline before the
53+
# redirect.
54+
#
55+
# Lookup precedence (most specific wins, lower-if-higher policy):
56+
# 1. mss-clamp <cidr> via <iface> <mtu> (prefix + egress iface)
57+
# 2. mss-clamp <cidr> <mtu> (prefix, any egress)
58+
# 3. mss-clamp via <iface> <mtu> (egress iface, any prefix)
59+
# 4. mss-clamp <mtu> (global default)
60+
#
61+
# Prefix matches src OR dst (mirrors allow-prefix semantics) so a
62+
# single rule covers both directions of a flow. Clamped on both SYN
63+
# and SYN-ACK so each end's announced MSS is constrained per-direction.
64+
# See docs/runbooks/mss-clamp.md for MSS vs MTU math + troubleshooting.
65+
#
66+
# mss-clamp via eth2 1360 # outbound: leaving WAN
67+
# mss-clamp 23.191.201.0/24 via eth2 1360 # outbound, scoped to one customer
68+
# mss-clamp 1360 # global fallback for all matched
69+
4870
# Driver workaround for the pre-Linux-v6.8 rvu-nicpf native XDP bug
4971
# (SPEC.md §11.1(c); upstream fix is commit 04f647c8e456). Values:
5072
# auto — detect rvu-nicpf via /sys and apply only on native attaches

crates/cli/debian/packetframe.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Wants=network-online.target
77
[Service]
88
Type=simple
99
ExecStart=/usr/bin/packetframe run
10+
ExecReload=/bin/kill -HUP $MAINPID
11+
PIDFile=/var/lib/packetframe/state/packetframe.pid
1012
Restart=on-failure
1113
RestartSec=5
1214
User=root

0 commit comments

Comments
 (0)