feat(xdp): IPv6 parity — blacklist6_map, v6 bans, v6 prefix stats

- C: lpm_key6 + blacklist6_map (LPM_TRIE, 20-byte key); native IPv6 no
  longer returns XDP_PASS before filtering: same L4/port gates, then
  blacklist6, UDP drop-policy, TCP flag checks and /64 prefix stats.
- Rust: blacklist6_key/blacklist6_update; ban_cidr handles V4 and V6;
  gateway xdp_ban uses ban_cidr (/32 or /128); dead ban_ip removed.
- tests/xdp_ban_v6.rs (key layout) and scripts/xdp_ipv6_smoke.sh
  (real kernel: pass -> ban drops -> unban passes).
- TODO: record done items and two findings (userspace ban expiry clock
  mismatch; short-L4 bypass of blacklist).
This commit is contained in:
Loki 2026-11-15 23:02:12 +01:00
parent cacd01c657
commit 59d5a088b2
Signed by: boba
GPG key ID: 6CDE87BC9A778D97
11 changed files with 309 additions and 36 deletions

View file

@ -11,6 +11,16 @@ struct {
__uint(map_flags, BPF_F_NO_PREALLOC);
} blacklist_map SEC(".maps");
// 🔗 IPv6 blacklist (LPM_TRIE, 128-bit prefix keys)
// Same value/expiry contract as blacklist_map
struct {
__uint(type, BPF_MAP_TYPE_LPM_TRIE);
__uint(max_entries, 100000);
__type(key, struct lpm_key6);
__type(value, __u64); // ban expiry (ktime_ns)
__uint(map_flags, BPF_F_NO_PREALLOC);
} blacklist6_map SEC(".maps");
// 🔗 Whitelist (LPM_TRIE for CIDR) — checked before any filter
struct {
__uint(type, BPF_MAP_TYPE_LPM_TRIE);