GeezerVison is showing github.com — test(dataplane): preserve established replies and explicitly deny exp… · arencloud/unf@b87d050
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bins/unf-agent/src/tests/service_reply.rs +28-3Lines changed: 28 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,7 +68,7 @@ fn deny(source: u32, destination: u32, protocol: u8, port: u16) -> PolicyMapEntr | 68 | 68 |
| 69 | 69 | #[test] | 70 | 70 | #[ignore = "requires actual main BPF execution and UNF_EBPF_OBJECT"] | 71 | | -fn privileged_reverse_service_requires_current_forward_policy_witness() { | | 71 | +fn privileged_reverse_service_requires_live_forward_policy_witness() { | 72 | 72 | for ipv6 in [false, true] { | 73 | 73 | for protocol in [6, 17] { | 74 | 74 | verify(ipv6, protocol); | @@ -212,10 +212,25 @@ fn verify(ipv6: bool, protocol: u8) { | 212 | 212 | .set(0, encode_policy_config(7, 2, 1, 0).unwrap(), 0) | 213 | 213 | .unwrap(); | 214 | 214 | native_transport(&mut encryption, 2); | | 215 | + assert_eq!( | | 216 | + run_tc(&mut ebpf, "unf_observe_ingress", &reply).0, | | 217 | + 3, | | 218 | + "ADR 0070 established reply was lost across policy revision churn" | | 219 | + ); | | 220 | + let idle = unf_ebpf_common::connection_timeout_ns(protocol).unwrap(); | | 221 | + let expired_at = monotonic_time_ns() | | 222 | + .unwrap() | | 223 | + .checked_sub(idle + 1_000_000_000) | | 224 | + .expect("fixture requires kernel uptime longer than the protocol timeout"); | | 225 | + for key in connections.keys().collect::<Result<Vec<_>, _>>().unwrap() { | | 226 | + let mut value = connections.get(&key, 0).unwrap(); | | 227 | + value[..8].copy_from_slice(&expired_at.to_ne_bytes()); | | 228 | + connections.insert(key, value, 0).unwrap(); | | 229 | + } | 215 | 230 | assert_eq!( | 216 | 231 | run_tc(&mut ebpf, "unf_observe_ingress", &reply).0, | 217 | 232 | 2, | 218 | | - "stale policy witness survived current revision" | | 233 | + "expired policy witness retained Service reply authority" | 219 | 234 | ); | 220 | 235 | assert_eq!(run_tc(&mut ebpf, "unf_observe_ingress", &request).0, 3); | 221 | 236 | assert_eq!( | @@ -243,6 +258,16 @@ fn verify(ipv6: bool, protocol: u8) { | 243 | 258 | ); | 244 | 259 | native_transport(&mut encryption, 2); | 245 | 260 | assert_eq!(run_tc(&mut ebpf, "unf_observe_ingress", &reply).0, 3); | | 261 | + policy_config.set(0, [0; 24], 0).unwrap(); | | 262 | + assert_eq!( | | 263 | + run_tc(&mut ebpf, "unf_observe_ingress", &reply).0, | | 264 | + 2, | | 265 | + "Service reply bypassed absent active policy configuration" | | 266 | + ); | | 267 | + policy_config | | 268 | + .set(0, encode_policy_config(7, 2, 1, 0).unwrap(), 0) | | 269 | + .unwrap(); | | 270 | + assert_eq!(run_tc(&mut ebpf, "unf_observe_ingress", &request).0, 3); | 246 | 271 | let forward_deny = deny(11, 22, protocol, backend_port); | 247 | 272 | policies | 248 | 273 | .insert( | @@ -264,7 +289,7 @@ fn verify(ipv6: bool, protocol: u8) { | 264 | 289 | "denied forward created unsolicited reply authority" | 265 | 290 | ); | 266 | 291 | println!( | 267 | | - "service-reply-policy: family={} protocol={protocol} current-reply=true missing-witness-denied=true stale-witness-denied=true missing-transport-denied=true denied-forward-reply-denied=true backend-preserved=true", | | 292 | + "service-reply-policy: family={} protocol={protocol} current-reply=true revision-churn-preserved=true missing-witness-denied=true expired-witness-denied=true absent-policy-denied=true missing-transport-denied=true denied-forward-reply-denied=true backend-preserved=true", | 268 | 293 | if ipv6 { 6 } else { 4 } | 269 | 294 | ); | 270 | 295 | } |
Collapse file Copy file name to clipboard +47Lines changed: 47 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# ADR 0436: Reverse-Service gate preserves the established-flow contract | | 2 | + | | 3 | +Date: 2026-09-21 | | 4 | + | | 5 | +Status: failed cl02 attempt retained; test contract corrected, rerun pending | | 6 | + | | 7 | +The `8dc7f3d` seven-test image passes its first six tests on cl02, then fails | | 8 | +the new reverse-Service assertion expecting a policy-revision increment alone | | 9 | +to invalidate an established reply. The actual return was PIPE, expected SHOT. | | 10 | +This attempt is failed, never a qualification, and was not advanced to Kind. | | 11 | + | | 12 | +Inspection identifies a fixture/design-description error, not a demonstrated | | 13 | +failure of the documented connection timeout: ADR 0070 deliberately preserves | | 14 | +established TCP/UDP/SCTP witnesses across global policy-revision churn. The | | 15 | +existing shared regression `connection_state_is_protocol_bounded_and_survives_policy_churn` | | 16 | +asserts that exact behavior. Forcing revision equality would regress bootstrap | | 17 | +and ordinary connection continuity on unrelated Pod/policy changes. | | 18 | + | | 19 | +ADR 0435's phrases "at the current policy revision" and "stale witnesses" are | | 20 | +therefore corrected: a reply requires an exact **live, protocol-time-bounded** | | 21 | +forward witness and an active nonzero policy configuration, not equality with | | 22 | +the witness's creation revision. The actual common policy and transport stages | | 23 | +still execute. No production authorization or timeout is weakened to pass a | | 24 | +test, and the connection implementation is unchanged. | | 25 | + | | 26 | +The corrected exact test positively preserves revision-churn replies and | | 27 | +explicitly ages actual map timestamps beyond the protocol timeout. It requires | | 28 | +expired-witness denial, missing-witness denial, absent-policy denial, missing | | 29 | +transport denial, denied-forward/unsolicited-reply denial, and backend/wire | | 30 | +tuple preservation for IPv4/IPv6 TCP/UDP. Fixture uptime must exceed the timeout; | | 31 | +the test cannot silently skip that negative. The old failing evidence stays. | | 32 | + | | 33 | +Failed image: | | 34 | +`quay.io/arencloud/unf-test-tools-dev@sha256:599e6d1cce11e19318a765e163f380997432c5f964895415ad81de9742719427` | | 35 | + | | 36 | +Evidence: `.artifacts/p9-kernel-main-bridge-8dc7f3d-cl02`. | | 37 | +Result SHA-256 `c42d6d0b264c4fba10ad1465d498169921c4b6acba7d283a3a339948ca52b449`; | | 38 | +test log SHA-256 `6374ee1cbba8fa3dc6d937ae1706591728a06a9033271156670d3e1e3ea84921`. | | 39 | +Exact-UID cleanup passes. Production remains `45d85d5`, Ready/zero restarts, | | 40 | +with byte-identical journals. Current/retained regular/init logs contain no | | 41 | +ERROR or malformed/partial observations: 488 current WARNs and 7,045 retained | | 42 | +WARNs. Previously observed retention, peer/key retries and vanished-interface | | 43 | +attach observations remain recorded, not cleared or reclassified as healthy. | | 44 | + | | 45 | +Strict agent Clippy and test compilation pass locally. Rebuild the corrected | | 46 | +source, repeat cl02 first, then identical-image Kind only after success. Actual | | 47 | +publisher/main-hook socket composition and L3/L4/L5/Q remain open. |
Collapse file Copy file name to clipboardExpand all lines: docs/development/phase9-attested-encryption-fabric-plan.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -83,6 +83,10 @@ log review. Reverse-Service, selected-bank delivery and recovery remain open. | 83 | 83 | ADR 0435 implements the policy-tracked reverse-Service bridge and expands the | 84 | 84 | actual-main diagnostic to seven tests. Local checks pass; immutable cl02-first | 85 | 85 | qualification and live selected-bank delivery/recovery remain pending. | | 86 | +ADR 0436 retains the first expanded cl02 gate failure: its revision-equality | | 87 | +assertion contradicted ADR 0070. Explicit expiry/absent-policy negatives replace | | 88 | +that mistaken expectation, while preserving established-flow continuity. | | 89 | +Corrected cl02-first qualification remains required; Kind has not advanced. | 86 | 90 | ADRs 0381–0382 | 87 | 91 | qualify the isolated joint attachment/route observation on cl02 then Kind; | 88 | 92 | ADR 0383 verifies stale-safe journal cuts locally. ADR 0384 implements the | |
Collapse file Copy file name to clipboardExpand all lines: docs/development/phase9-required-locality-plan.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -178,6 +178,10 @@ ADR 0435 routes enforcing reverse-Service replies through current forward-policy | 178 | 178 | witness checks and normal policy/locality/transport finalization, preserving | 179 | 179 | backend ownership separately from rewritten VIP bytes. The expanded seven-test | 180 | 180 | main-program diagnostic must pass cl02 before Kind; live composition is pending. | | 181 | +ADR 0436 retains that cl02 gate's failure and corrects its revision-equality | | 182 | +expectation to ADR 0070's existing live established-flow contract. Explicit | | 183 | +expiry/absent-policy negatives are added. Corrected cl02 rerun is required; | | 184 | +the failed image is not advanced to Kind and no live permission is weakened. | 181 | 185 |
| 182 | 186 | ## Safety and efficiency boundary | 183 | 187 |
| |
Collapse file Copy file name to clipboardExpand all lines: docs/project-status.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -981,6 +981,10 @@ ADR 0435 adds current forward-policy witnesses to enforcing reverse-Service | 981 | 981 | replies before normal policy/locality/transport handling. Backend ownership is | 982 | 982 | preserved across VIP rewriting. Local checks pass; the expanded seven-test | 983 | 983 | immutable gate must pass cl02 then Kind. Full runtime delivery remains open. | | 984 | +ADR 0436 retains the failed cl02 reverse-Service assertion and corrects the | | 985 | +fixture to the existing revision-churn-safe, protocol-bounded reply contract | | 986 | +(ADR 0070), with explicit expiry and absent-policy negatives. No production | | 987 | +permission changes or Kind advancement; corrected cl02 qualification is next. | 984 | 988 | ADR 0338 closes the staging guard's init-container failure/restart gap before | 985 | 989 | the matching Kind rollout; no live image changes occur in that metadata slice. | 986 | 990 | Required locality/replica coverage, full lifecycle requalification and S1–S5 | |
Collapse file Copy file name to clipboardExpand all lines: ebpf/unf-ebpf-tc/src/locality_runtime.rs +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -73,6 +73,9 @@ pub(super) fn prepare_service_reply<const IPV6: bool>(direction: Direction, tcp_ | 73 | 73 | populate_connection_keys(observation, key, reverse); | 74 | 74 | #[allow(unsafe_code)] | 75 | 75 | let now = unsafe { bpf_ktime_get_ns() }; | | 76 | + // ADR 0070: a live established witness survives unrelated global | | 77 | + // revision churn; protocol expiry and nonzero current policy still | | 78 | + // apply. The common policy/transport stages remain authoritative. | 76 | 79 | if !refresh_connection(reverse, active_policy_revision(), now) { | 77 | 80 | return TC_ACT_SHOT; | 78 | 81 | } | |
Collapse file Copy file name to clipboardExpand all lines: hack/verify-main-locality-bridge.sh +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ for name in \ | 13 | 13 | privileged_egress_source_steering_is_policy_first_destination_exact_and_dual_stack \ | 14 | 14 | privileged_load_balancer_dsr_preserves_dual_stack_vips_and_direct_return \ | 15 | 15 | privileged_service_packets_translate_dual_stack_and_survive_churn \ | 16 | | - service_reply::privileged_reverse_service_requires_current_forward_policy_witness; do | | 16 | + service_reply::privileged_reverse_service_requires_live_forward_policy_witness; do | 17 | 17 | /usr/local/bin/unf-main-tests --ignored --exact "tests::$name" --nocapture --test-threads=1 | tee "$output" | 18 | 18 | grep -Eq '^test result: ok\. 1 passed; 0 failed; 0 ignored;' "$output" | 19 | 19 | printf 'main-locality-check: name=%s passed=true\n' "$name" | |
|