GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(dataplane): bridge policy-first forwarding to sealed locality banks · arencloud/unf@843d810

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .containerignore
  • bins/unf-agent/src
    • main.rs
  • docs
    • adr
      • 0432-policy-first-locality-forward-bridge.md
    • development
      • phase9-attested-encryption-fabric-plan.md
      • phase9-required-locality-plan.md
    • project-status.md
  • ebpf
    • unf-ebpf-common/src
      • lib.rs
    • unf-ebpf-tc/src
      • locality_runtime.rs
      • main.rs
  • hack
    • verify-locality-incarnation-gate.sh
    • verify-main-locality-bridge.sh
  • images
    • KernelMainLocalityTestContainerfile
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.containerignore‎

Copy file name to clipboardExpand all lines: .containerignore
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
!.artifacts/unf-device-observation
99
!.artifacts/unf-device-lease
1010
!.artifacts/unf-locality-bank
11+
!.artifacts/unf-main-locality-test
1112
!.artifacts/unf-locality-fixture
1213
target/
1314
ebpf/unf-ebpf-tc/target/
Collapse file

‎bins/unf-agent/src/main.rs‎

Copy file name to clipboardExpand all lines: bins/unf-agent/src/main.rs
+70-8Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7715,8 +7715,26 @@ fn attach_dataplane_programs<'ebpf>(
77157715
}
77167716

77177717
fn load_dataplane_tail_programs(ebpf: &mut Ebpf) -> Result<()> {
7718-
let mut program_fds = Vec::with_capacity(DATAPLANE_TAIL_PROGRAM_NAMES.len());
7719-
for program_name in DATAPLANE_TAIL_PROGRAM_NAMES {
7718+
load_tail_program_array(
7719+
ebpf,
7720+
DATAPLANE_TAIL_CALL_MAP_NAME,
7721+
&DATAPLANE_TAIL_PROGRAM_NAMES,
7722+
)?;
7723+
load_tail_program_array(
7724+
ebpf,
7725+
"UL_RESUME_V1",
7726+
&[
7727+
"unf_locality_resume_v4",
7728+
"unf_locality_resume_v6",
7729+
"unf_locality_nat_v4",
7730+
"unf_locality_nat_v6",
7731+
],
7732+
)
7733+
}
7734+
7735+
fn load_tail_program_array(ebpf: &mut Ebpf, map_name: &str, names: &[&str]) -> Result<()> {
7736+
let mut program_fds = Vec::with_capacity(names.len());
7737+
for program_name in names {
77207738
let program: &mut SchedClassifier = ebpf
77217739
.program_mut(program_name)
77227740
.with_context(|| format!("eBPF object does not contain program {program_name}"))?
@@ -7733,11 +7751,11 @@ fn load_dataplane_tail_programs(ebpf: &mut Ebpf) -> Result<()> {
77337751
.with_context(|| format!("clone {program_name} program descriptor"))?,
77347752
);
77357753
}
7736-
let mut tail_calls =
7737-
AyaProgramArray::try_from(ebpf.map_mut(DATAPLANE_TAIL_CALL_MAP_NAME).with_context(
7738-
|| format!("eBPF object does not contain {DATAPLANE_TAIL_CALL_MAP_NAME}"),
7739-
)?)
7740-
.with_context(|| format!("open {DATAPLANE_TAIL_CALL_MAP_NAME} program array"))?;
7754+
let mut tail_calls = AyaProgramArray::try_from(
7755+
ebpf.map_mut(map_name)
7756+
.with_context(|| format!("eBPF object does not contain {map_name}"))?,
7757+
)
7758+
.with_context(|| format!("open {map_name} program array"))?;
77417759
for (index, program_fd) in program_fds.iter().enumerate() {
77427760
let index = u32::try_from(index).context("dataplane tail program index exceeds u32")?;
77437761
tail_calls
@@ -23721,8 +23739,18 @@ mod tests {
2372123739

2372223740
#[test]
2372323741
#[ignore = "requires root BPF program execution and UNF_EBPF_OBJECT"]
23724-
#[allow(clippy::too_many_lines)]
2372523742
fn privileged_encryption_finalizer_is_dual_stack_late_bound_and_fail_closed() {
23743+
verify_encryption_finalizer(false);
23744+
}
23745+
23746+
#[test]
23747+
#[ignore = "requires root BPF program execution and UNF_EBPF_OBJECT"]
23748+
fn privileged_locality_bridge_missing_bank_keeps_exact_encryption_and_marks() {
23749+
verify_encryption_finalizer(true);
23750+
}
23751+
23752+
#[allow(clippy::too_many_lines)]
23753+
fn verify_encryption_finalizer(locality_bridge: bool) {
2372623754
const POLICY_REVISION: u64 = 12;
2372723755
const SERVICE_REVISION: u64 = 13;
2372823756
const EGRESS_REVISION: u64 = 14;
@@ -23969,6 +23997,26 @@ mod tests {
2396923997
.set(0, encryption_maps::encode_map_config(&config), 0)
2397023998
.unwrap();
2397123999

24000+
let locality_input = if locality_bridge {
24001+
// Actual main runtime maps, not status flags. No bank is selected:
24002+
// the new bridge must populate its ABI and continue the ordinary
24003+
// Required/Native path without repeating the policy preamble.
24004+
let mut fence =
24005+
AyaArray::<_, [u8; 32]>::try_from(ebpf.take_map("UL_FENCE_V1").unwrap()).unwrap();
24006+
let mut value = [0; 32];
24007+
value[..8].copy_from_slice(&7_u64.to_ne_bytes());
24008+
value[8..16].copy_from_slice(&3_u64.to_ne_bytes());
24009+
value[16..24].copy_from_slice(&9_u64.to_ne_bytes());
24010+
value[24..26].copy_from_slice(&unf_ebpf_common::locality::ABI_VERSION.to_ne_bytes());
24011+
fence.set(0, value, 0).unwrap();
24012+
Some(
24013+
AyaPerCpuArray::<_, [u8; 80]>::try_from(ebpf.take_map("UL_INPUT_V1").unwrap())
24014+
.unwrap(),
24015+
)
24016+
} else {
24017+
None
24018+
};
24019+
2397224020
let packet_v4 = ipv4_packet(6, source_v4, destination_v4, 40_000, 443);
2397324021
let packet_v6 = ipv6_packet(6, source_v6, destination_v6, 40_001, 443);
2397424022
let host_mark = 0x00aa_b100;
@@ -23995,10 +24043,24 @@ mod tests {
2399524043
run_tc(&mut ebpf, "unf_observe_ingress", &packet_v4).0,
2399624044
TC_ACT_PIPE
2399724045
);
24046+
if let Some(input) = &locality_input {
24047+
assert!(input.get(&0, 0).unwrap().iter().any(|row| row[70] == 4
24048+
&& row[24..28] == source_v4.octets()
24049+
&& row[40..44] == destination_v4.octets()
24050+
&& row[72..74] == 40_000_u16.to_be_bytes()
24051+
&& row[74..76] == 443_u16.to_be_bytes()));
24052+
}
2399824053
assert_eq!(
2399924054
run_tc(&mut ebpf, "unf_observe_ingress", &packet_v6).0,
2400024055
TC_ACT_PIPE
2400124056
);
24057+
if let Some(input) = &locality_input {
24058+
assert!(input.get(&0, 0).unwrap().iter().any(|row| row[70] == 6
24059+
&& row[24..40] == source_v6.octets()
24060+
&& row[40..56] == destination_v6.octets()
24061+
&& row[72..74] == 40_001_u16.to_be_bytes()
24062+
&& row[74..76] == 443_u16.to_be_bytes()));
24063+
}
2400224064
let native_syn = ipv4_packet(6, native_source_v4, native_destination_v4, 40_003, 8081);
2400324065
assert_eq!(
2400424066
run_tc(&mut ebpf, "unf_observe_ingress", &native_syn).0,
Collapse file

‎docs/adr/0432-policy-first-locality-forward-bridge.md‎

Copy file name to clipboard
+47Lines changed: 47 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ADR 0432: Policy-first locality forward bridge
2+
3+
Date: 2026-09-21
4+
5+
Status: implemented and locally checked; kernel/runtime qualification pending
6+
7+
The actual main TC finalizer now prepares the fixed-width locality input only
8+
after packet policy, Service frontend handling and explicit egress ownership.
9+
It requires a structurally valid admitted encryption cut, current policy and
10+
Service revisions, matching active identity configuration and the applied
11+
locality fence. A wholly empty/quiescent admitted cut is structurally valid,
12+
but remains **inactive for ordinary transport**; it cannot create an implicit
13+
Native decision. Local delivery still requires the complete sealed bank.
14+
15+
Original pre-Service-SNAT source ownership and the final selected backend come
16+
from the policy observation. Ports come from the actual post-translation wire
17+
tuple. The bank independently verifies placement, incarnation leases, devices
18+
and actual route/MAC ownership before redirect. A missing bank or bank miss
19+
resumes the existing ordinary encryption selection; it never grants Native.
20+
21+
Four versioned resume entries are installed in the already owned locality map,
22+
without changing the existing twelve-slot core tail array. Normal resumes start
23+
after the policy/Service/egress preamble. Local DSR uses a separate reversible
24+
NAT continuation, rebuilds input and re-enters the bank for every check again.
25+
Missing NAT continuation or withdrawn selection cannot return a blind PIPE.
26+
Top-level dispatch avoids retaining an extra BPF subprogram stack frame across
27+
tail calls or ordinary transport selection.
28+
29+
The next isolated `kernel-main-bridge` gate loads the actual main ELF and all
30+
continuations with four exact existing/expanded agent test cases: ordinary
31+
encryption, armed locality fence with missing bank, source egress precedence,
32+
and dual-stack DSR. It checks that exactly one test actually ran per invocation.
33+
It uses anonymous maps and BPF_PROG_TEST_RUN, not live TC attachment or packet
34+
delivery. The diagnostic limit is two CPUs/2 GiB for repeated full-map test
35+
allocation, not a production resource requirement or stabilization result.
36+
37+
Local verification: 909 workspace tests pass, 27 explicitly ignored (including
38+
the new privileged bridge case); strict all-target Clippy and main BPF release
39+
compilation pass. Shell syntax/formatting checks pass. The new immutable image
40+
must pass cl02 before identical-image Kind. Successful compilation does not
41+
establish verifier acceptance or packet correctness.
42+
43+
Reverse-Service early-return policy/transport composition remains an explicit
44+
gap, as do actual selected-bank delivery through the main hook, complete
45+
publisher/writer integration, crash-stage cleanup, restart continuity and
46+
L3/L4/L5/Q. Do not roll this partial bridge onto the live fleet or promote the
47+
phase based on this isolated gate. Both production fleets remain `45d85d5`.
Collapse file

‎docs/development/phase9-attested-encryption-fabric-plan.md‎

Copy file name to clipboardExpand all lines: docs/development/phase9-attested-encryption-fabric-plan.md
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ and measured stabilization remain pending.
7171
ADR 0431 qualifies mixed-MTU observation and actual selection readback with
7272
the complete startup/bank/socket diagnostic on cl02 then identical-image Kind.
7373
Production state is unchanged; full runtime and L3/L4/L5/Q remain open.
74+
ADR 0432 implements the policy-first forward bridge and dedicated continuation
75+
loading. Actual-main kernel qualification, reverse-Service composition, full
76+
publisher/writer delivery and restart continuity remain pending; no live rollout.
7477
ADRs 0381–0382
7578
qualify the isolated joint attachment/route observation on cl02 then Kind;
7679
ADR 0383 verifies stale-safe journal cuts locally. ADR 0384 implements the
Collapse file

‎docs/development/phase9-required-locality-plan.md‎

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 numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ qualification remains open, and this is not an S1 resource measurement.
162162
ADR 0431 passes the expanded mixed-MTU/selected-program diagnostic on cl02 then
163163
identical `5f03031` Kind, preserving journals and reviewing all retained logs.
164164
Actual publisher/writer/packet composition and L3/L4/L5/Q remain open.
165+
ADR 0432 adds the actual policy-first forward bridge and four dedicated
166+
continuations, including local DSR NAT revalidation and ordinary missing-bank
167+
fallback. Its real-main verifier/TestRun gate must pass cl02 before Kind.
168+
Reverse-Service composition and complete live delivery remain open; no rollout.
165169

166170
## Safety and efficiency boundary
167171

Collapse file

‎docs/project-status.md‎

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 numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ ADR 0431 passes the complete mixed-MTU/selection-readback diagnostic on cl02
966966
then identical-image Kind. Existing journals are unchanged; all current/init
967967
and retained logs are reviewed, with warnings retained. Real publisher/writer/
968968
packet composition and L3/L4/L5/Q remain open.
969+
ADR 0432 adds policy-first forward dispatch to the sealed bank, ordinary
970+
encryption fallback and separate DSR NAT/revalidation continuations. Local
971+
checks pass; actual-main cl02-before-Kind kernel checks, reverse-Service
972+
composition and full runtime delivery/recovery remain open. No rollout occurs.
969973
ADR 0338 closes the staging guard's init-container failure/restart gap before
970974
the matching Kind rollout; no live image changes occur in that metadata slice.
971975
Required locality/replica coverage, full lifecycle requalification and S1–S5
Collapse file

‎ebpf/unf-ebpf-common/src/lib.rs‎

Copy file name to clipboardExpand all lines: ebpf/unf-ebpf-common/src/lib.rs
+68-1Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,18 +1136,29 @@ pub const fn encryption_transport_is_usable(
11361136
/// identity-pair decisions; missing authority remains fail closed.
11371137
#[must_use]
11381138
pub const fn encryption_config_is_active(config: &EncryptionMapConfig) -> bool {
1139+
encryption_config_has_admitted_cut(config) && config.decision_count > 0
1140+
}
1141+
1142+
/// Structural bounds for an admitted cut, including a wholly empty/quiescent
1143+
/// generation. This is NOT transport authority: ordinary encryption still
1144+
/// requires `encryption_config_is_active` and an exact usable decision. The
1145+
/// local device consumer additionally requires current policy/Service revisions
1146+
/// and independent per-address, per-incarnation kernel proofs.
1147+
#[must_use]
1148+
pub const fn encryption_config_has_admitted_cut(config: &EncryptionMapConfig) -> bool {
11391149
config.schema_version == ENCRYPTION_MAP_ABI_VERSION
11401150
&& config.active_bank < ENCRYPTION_BANK_COUNT
11411151
&& config.generation != 0
11421152
&& config.policy_revision != 0
11431153
&& config.service_revision != 0
11441154
&& config.egress_revision != 0
11451155
&& config.epoch_count <= 2
1146-
&& config.decision_count > 0
11471156
&& config.decision_count <= ENCRYPTION_DECISION_MAP_CAPACITY
11481157
&& config.transport_count <= ENCRYPTION_TRANSPORT_MAP_CAPACITY
11491158
&& (config.epoch_count > 0) == (config.transport_count > 0)
11501159
&& config.path_count <= ENCRYPTION_PATH_MAP_CAPACITY
1160+
&& (config.decision_count > 0
1161+
|| (config.transport_count == 0 && config.epoch_count == 0 && config.path_count == 0))
11511162
}
11521163

11531164
/// Replays the fixed-width identity decision invariants in the TC consumer.
@@ -1988,6 +1999,62 @@ mod tests {
19881999
assert!(!encryption_disposition_is_valid(0));
19892000
}
19902001

2002+
#[test]
2003+
fn empty_admitted_cut_is_not_transport_authority() {
2004+
let config = EncryptionMapConfig {
2005+
generation: 11,
2006+
policy_revision: 12,
2007+
service_revision: 13,
2008+
egress_revision: 14,
2009+
decision_count: 0,
2010+
transport_count: 0,
2011+
schema_version: ENCRYPTION_MAP_ABI_VERSION,
2012+
active_bank: 1,
2013+
epoch_count: 0,
2014+
path_count: 0,
2015+
};
2016+
assert!(encryption_config_has_admitted_cut(&config));
2017+
assert!(!encryption_config_is_active(&config));
2018+
for changed in [
2019+
EncryptionMapConfig {
2020+
generation: 0,
2021+
..config
2022+
},
2023+
EncryptionMapConfig {
2024+
policy_revision: 0,
2025+
..config
2026+
},
2027+
EncryptionMapConfig {
2028+
service_revision: 0,
2029+
..config
2030+
},
2031+
EncryptionMapConfig {
2032+
egress_revision: 0,
2033+
..config
2034+
},
2035+
EncryptionMapConfig {
2036+
schema_version: 0,
2037+
..config
2038+
},
2039+
EncryptionMapConfig {
2040+
active_bank: ENCRYPTION_BANK_COUNT,
2041+
..config
2042+
},
2043+
EncryptionMapConfig {
2044+
epoch_count: 1,
2045+
transport_count: 1,
2046+
..config
2047+
},
2048+
EncryptionMapConfig {
2049+
path_count: 1,
2050+
..config
2051+
},
2052+
] {
2053+
assert!(!encryption_config_has_admitted_cut(&changed));
2054+
assert!(!encryption_config_is_active(&changed));
2055+
}
2056+
}
2057+
19912058
#[test]
19922059
fn encryption_packet_authority_is_exact_revision_bound_and_temporal() {
19932060
let config = EncryptionMapConfig {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.