code wiki / _hdl_build / nx_email_mx_gate.nx
nx_email_mx_gate.nx
buildroot/runtime/_hdl_build/nx_email_mx_gate.nx
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 2 imports · 0 importers
imports: nx_email_mx.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 27 | const EMX_LOG: *u8 = "knowledge/status/email_mx.log" |
functions
| 29 | func 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 } |
| 30 | func ewn(fd: i64, v: i64) -> i64 |
| 40 | func pu16(p: *u8, off: i64, v: i64) -> i64 |
| 46 | func streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 58 | func build_question_example_com(p: *u8) -> i64 |
| 73 | func build_mx_response(p: *u8) -> i64 |
| 103 | func build_a_only_response(p: *u8) -> i64 |
| 121 | func build_ptrloop_response(p: *u8) -> i64 |
| 144 | func main() -> i64 |