From 7afd93ddc281378ee457e7f4775577622a56b9e5 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 21:15:35 +0100 Subject: [PATCH] The node-engine seat's converged answers the node's links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The holder of node-packet-filter must tell an outward link from the tunnel without reading the loaded table's shape, so converged answers the links as the engine classifies them for its filter render: tunnel, the private network's interface, and outward, the outward links. Packages generated again by seatgen (seatgen -check clean). Builds: design 33 control-verbs §10; design 08 control-verbs §2; design 47 H H-A-325 --- go/seats/nodeengine/contract.go | 4 ++++ go/seats/nodeengine/contract_test.go | 4 ++-- seats/node-engine/fixtures/verbs.json | 13 +++++++++++-- seats/node-engine/seat.json | 17 +++++++++++++++-- ts/seats/nodeengine/index.d.ts | 4 ++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index 0f2dd96..17f22ec 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -1587,10 +1587,14 @@ type ConvergedInput struct { type ConvergedAnswer struct { // the kind of the firewall found, for an adopted node Found string `json:"found,omitempty"` + // the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one + Outward []string `json:"outward"` // when the node became so, RFC 3339; absent where the engine recorded no time for it Since string `json:"since,omitempty"` // the node's mode: adopted (the found firewall's terms) or converged (the mesh's own filter) State string `json:"state"` + // the private network's tunnel interface on this node, as the engine's filter render names it + Tunnel string `json:"tunnel"` } // The values of ConvergedAnswer's state. diff --git a/go/seats/nodeengine/contract_test.go b/go/seats/nodeengine/contract_test.go index bfa7e5f..d8150dd 100644 --- a/go/seats/nodeengine/contract_test.go +++ b/go/seats/nodeengine/contract_test.go @@ -129,9 +129,9 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "apply-order answers the changed wants in the order they are applied, with why and what each waits on", subject: "", given: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}", wire: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}", decode: func(b []byte) (any, error) { var v ApplyOrderAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "converged answers an adopted node with its found firewall", subject: "", given: "{\"found\":\"ufw\",\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\"}", wire: "{\"found\":\"ufw\",\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\"}", + {name: "converged answers an adopted node with its found firewall", subject: "", given: "{\"found\":\"ufw\",\"outward\":[\"eth0\",\"wlan0\"],\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\",\"tunnel\":\"mesh0\"}", wire: "{\"found\":\"ufw\",\"outward\":[\"eth0\",\"wlan0\"],\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\",\"tunnel\":\"mesh0\"}", decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "converged answers a converged node since it converged", subject: "", given: "{\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\"}", wire: "{\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\"}", + {name: "converged answers a converged node since it converged", subject: "", given: "{\"outward\":[\"eth0\"],\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\",\"tunnel\":\"mesh0\"}", wire: "{\"outward\":[\"eth0\"],\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\",\"tunnel\":\"mesh0\"}", decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "composition names the filter part kept because allowed did not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, diff --git a/seats/node-engine/fixtures/verbs.json b/seats/node-engine/fixtures/verbs.json index 153a276..a495cb6 100644 --- a/seats/node-engine/fixtures/verbs.json +++ b/seats/node-engine/fixtures/verbs.json @@ -290,7 +290,12 @@ "given": { "state": "adopted", "since": "2026-10-02T09:00:00Z", - "found": "ufw" + "found": "ufw", + "tunnel": "mesh0", + "outward": [ + "eth0", + "wlan0" + ] } }, { @@ -298,7 +303,11 @@ "of": "verb:converged.answer", "given": { "state": "converged", - "since": "2026-11-21T19:00:00Z" + "since": "2026-11-21T19:00:00Z", + "tunnel": "mesh0", + "outward": [ + "eth0" + ] } }, { diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index 38f1197..46220d9 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -1081,7 +1081,7 @@ }, { "name": "converged", - "description": "The node's convergence state, which the node-engine keeps (ADR 0168, ADR 0683; design 33 control-verbs \u00a710): adopted or converged, since when it became so, and for an adopted node the kind of the firewall found. Read-only: the holder of node-packet-filter asks it at its start and at every allow and disallow, and refuses when it does not answer.", + "description": "The node's convergence state, which the node-engine keeps (ADR 0168, ADR 0683; design 33 control-verbs \u00a710): adopted or converged, since when it became so, for an adopted node the kind of the firewall found, and the node's links as the engine classifies them: the tunnel's interface and the outward links (design 47 H-A-325). Read-only: the holder of node-packet-filter asks it at its start and at every allow and disallow, and refuses when it does not answer.", "class": "read", "input": { "type": "object", @@ -1090,7 +1090,9 @@ "answer": { "type": "object", "required": [ - "state" + "state", + "tunnel", + "outward" ], "properties": { "state": { @@ -1108,6 +1110,17 @@ "found": { "type": "string", "description": "the kind of the firewall found, for an adopted node" + }, + "tunnel": { + "type": "string", + "description": "the private network's tunnel interface on this node, as the engine's filter render names it" + }, + "outward": { + "type": "array", + "items": { + "type": "string" + }, + "description": "the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one" } } } diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index 77b3f07..eb6830a 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -1194,10 +1194,14 @@ export interface ConvergedInput { export interface ConvergedAnswer { /** the kind of the firewall found, for an adopted node */ "found"?: string; + /** the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one */ + "outward": string[]; /** when the node became so, RFC 3339; absent where the engine recorded no time for it */ "since"?: string; /** the node's mode: adopted (the found firewall's terms) or converged (the mesh's own filter) */ "state": "adopted" | "converged"; + /** the private network's tunnel interface on this node, as the engine's filter render names it */ + "tunnel": string; } /** is the body of the event asked. */