The gateway already refused to ban addresses from proxy_protocol.trusted_cidrs,
but the traffic-intelligence auto-ban and the subnet monitor still did, so a
trusted load balancer living inside a banned /24 (or below the reputation
threshold) could be knocked out together with its clients.
- TrustedProxyCidr moved to src/config/trusted.rs (the edge section file hit
the 250-line gate) and gained `overlaps_prefix`: a ban is suppressed when the
banned prefix intersects a trusted network.
- TrafficHook::with_trusted suppresses reputation and offender bans; its ban()
now reports whether the ban was installed so `ban_offenders` counts real
bans.
- The subnet monitor takes a MonitorSetup bundle (spawn had 8 arguments) and
suppresses both userspace CIDR bans and XDP prefix bans that overlap a
trusted network, logging a warning instead.
- IPv4-mapped addresses are normalised in `contains` too.
- Tests: overlap maths (v4/v6, /0 rejected), tracker suppression vs unrelated
networks, and auto-ban skipping a trusted range while still banning public
offenders.
- bind.address is parsed as IpAddr (no ":::port"), the socket domain follows
the family, and "::" binds dual-stack. IPv6 was impossible before.
- limits.relay_idle_timeout_secs (default 300, 1..=86400) replaces the
hardcoded relay constant; the deploy examples document it.
- The connection budget is an Arc<Semaphore> owned by Gateway instead of a
process-wide OnceLock, so tests and multiple gateways stay independent.
- PROXY header identity is validated: unspecified, loopback, link-local,
multicast, broadcast and addresses inside trusted_cidrs are rejected, and
IPv4-mapped IPv6 is normalised first. An invalid header falls back to the
transport peer. Bans targeting trusted_cidrs are suppressed, closing the
ban-amplification path through a trusted load balancer.
- TrustedProxyCidr::contains no longer overflows its mask for IPv6 prefixes
shorter than /96.
XDP behaviour:
- udp_rate_limit6 (LRU, full 128-bit source key) plus throttle_hit6, so
udp_policy = "rate-limit" applies to native IPv6 as well.
- scripts/xdp_ipv6_smoke.sh: phase 4 patches .rodata before load and
verifies policy=2 on a real kernel (3 pass / 3 rate-limited).
Loader (XDP could never load before this):
- .rodata is one struct rampart_config with frozen offsets enforced by
_Static_assert; XdpGlobals is #[repr(C)] and the image is built with
offset_of!. Before, a 96-byte image was written into a 76-byte map at
offsets clang had reordered, so load() failed with EINVAL.
- patch_rodata fails loudly when the map size and image size diverge.
- build.rs tracks xdp/core and xdp/hooks, not just universal_filter.c.
- build_ringbuf looked for "events_map"; the map is "events_ringbuf".
- tests/xdp_object_maps.rs checks map names and .rodata size without root.
Docs and style:
- Code comments are English, JavaDoc/Rustdoc style, without emoji or
banners (new project rule, TODO §0.8).
- README rewritten bilingual: Russian first, English below, nav buttons,
compact TOC and copy-paste quick start.
- docs/README.md: documentation index and maintenance rules;
configuration.md documents the whole [xdp] section and IPv4/IPv6
coverage; testing.md covers the real-kernel smoke; stale links removed.
- xdp: real 24-byte xdp_event parsing (fixes LE byte-swap of src IP),
opt-in [xdp] auto_ban (RATE_LIMIT always, CONN_DROP at fails>=threshold;
EVENT_BAN/POLICY_DROP excluded by design), rampart_xdp_autobans_total;
wired in app before load(); 10 tests in tests/xdp_events.rs
- build: --no-default-features compiles — redis paths cfg-gated behind
store-redis, manager fail-fasts without it; CI gates the config now
- app: RunExit enum replaces process::exit in lib; single exit site in main
- tests: seed PoW roundtrip token (was ~1/16 flaky; 50 pre-fix fails -> 0)
- docs: TODO statuses refreshed (round 2)