code wiki / _hdl_build / nx_email_mx_gate.nx

nx_email_mx_gate.nx

buildroot/runtime/_hdl_build/nx_email_mx_gate.nx

10098 B236 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic email
docsdependenciesstructsconstsfunctions

about

nx_email_mx_gate.nx -- GATE for EMAIL R0 (MX resolution, nx_email_mx). Drives the REAL nx_email_mx parser over hand-crafted DNS response packets (no network, fully deterministic) and asserts: COMPLETENESS : a 2-record MX response (both exchanges using RFC 1035 compression pointers back to the question name) parses to count=2 with correct preferences and materialised exchange hostnames; sort orders them lowest-preference-first (the connect order). NEG-CONTROL : a clean response whose only answer is an A record (not MX) returns NO_MX -- the parser does not hallucinate a mail host. TAMPER txid : the SAME valid MX packet parsed against a wrong expected tx_id returns TXID_MISMATCH (off-path spoof gate: a forged response cannot redirect mail). TAMPER ptrloop: an exchange name that is a self-referential compression pointer returns PTR_LOOP and the gate COMPLETES (bounded chase, no hang / no OOM). Evidence -> knowledge/status/email_mx.log (EMAILMXGATE authored=organ ... verdict=GREEN) license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_email_mx.nx nx_syscalls.nx nx_gate_verdict.nx nx_email_mx_gate.nx

imports: nx_email_mx.nxnx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ build_mx_response pu16 build_question_example_com pu16 ↻ nx_email_mx_parse nx_dns_get_u16_be nx_dns_skip_name emx_decode_name streq nx_email_mx_sort build_a_only_response pu16 ↻ build_question_example_com ↻ build_ptrloop_response pu16 ↻ ew sys_write ↻ ewn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close gv_ctr sys_mmap ↻

structs

none

consts

28const EMX_LOG: *u8 = "knowledge/status/email_mx.log"

functions

30func ew(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
31func ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
41func pu16(p: *u8, off: i64, v: i64) -> i64
47func streq(a: *u8, b: *u8) -> i64
called by 1: main
59func build_question_example_com(p: *u8) -> i64
74func build_mx_response(p: *u8) -> i64
called by 1: main calls 2: pu16build_question_example_com
104func build_a_only_response(p: *u8) -> i64
called by 1: main calls 2: pu16build_question_example_com
122func build_ptrloop_response(p: *u8) -> i64
called by 1: main calls 1: pu16
145func main() -> i64