feat(xdp): ABI layout tests, canonical CIDR (mapped v4 folding), per-CPU sum helper
- tests/xdp_abi_layout.rs: size/align/offset of every Rust mirror of a BPF struct - xdp::canonical_cidr folds ::ffff:a.b.c.d/(96+n) into the IPv4 trie as a.b.c.d/n for ban_cidr and whitelist_add_cidr; whitelist_remove folds mapped addresses - Blacklist prefix table folds mapped prefixes the same way; checked_shl masks - sum_percpu_u64 factored out of get_stats (no expect, wrapping sum) - tests for /0, >width, v6 key byte order, per-CPU sums, manager CIDR rejection
This commit is contained in:
parent
e2adf8601c
commit
8693551499
12 changed files with 410 additions and 79 deletions
|
|
@ -102,7 +102,16 @@ async fn protected_routes_require_a_token() {
|
|||
#[tokio::test]
|
||||
async fn blacklist_rejects_invalid_targets() {
|
||||
let router = app();
|
||||
for target in ["not-an-ip", "10.0.0.0/8", "999.1.1.1", ""] {
|
||||
for target in [
|
||||
"not-an-ip",
|
||||
"10.0.0.0/8",
|
||||
"0.0.0.0/0",
|
||||
"::/0",
|
||||
"1.2.3.4/32",
|
||||
"1.2.3.4/33",
|
||||
"999.1.1.1",
|
||||
"",
|
||||
] {
|
||||
let body = format!(r#"{{"target":"{target}","type":"ip","reason":"manual_ban"}}"#);
|
||||
let response = status(
|
||||
&router,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue