One push leaves the mesh consistent; the foundation's ports are forwarded (057, 063) #31

Merged
jschoubben merged 3 commits from fix/one-push-is-enough into main 2026-09-20 10:53:15 +00:00
2 changed files with 25 additions and 0 deletions
Showing only changes of commit 25e42b3ad6 - Show all commits
+15
View File
@@ -409,6 +409,21 @@ func AsNftables(rules []Rule, mesh []string, outward bool, foundation []int) str
b.WriteString(fmt.Sprintf("\t\tct original proto-dst %d accept\n", rule.Port))
}
}
// The foundation ports, forwarded — for the same reason they are in the input chain, and the
// same reason the module rules above are here too: the broker is a published container port,
// so a cross-node dial to it is redirected and *forwarded*, never reaching the input chain
// (novox/hq issue 047's lesson, applied to the foundation this time). Without this a joined
// node reaches the broker only while its first connection's conntrack entry survives — and a
// broker restart, which adopting the foundation's own broker causes, drops the entry and the
// node can never receive another declaration (novox/hq issue 063). From anywhere, matching
// the input rule: a node enrolling has no overlay address yet.
if len(foundation) > 0 {
b.WriteString("\n\t\t# the mesh's own — never derived, never closed\n")
for _, port := range foundation {
b.WriteString(fmt.Sprintf("\t\tct original proto-dst %d accept\n", port))
}
}
b.WriteString("\t}\n")
b.WriteString("}\n")
return b.String()
@@ -33,6 +33,16 @@ func TestTheBrokersPortIsOpenedThoughNoModuleDeclaresIt(t *testing.T) {
"has not yet enrolled is not on:\n%s", line)
}
}
// And forwarded, not only accepted on input: the broker is a published container port, so a
// cross-node dial is redirected and forwarded and never reaches the input chain. Without this
// a joined node reaches the broker only until its first connection's conntrack entry drops —
// which a broker restart (adopting the foundation's broker) causes — and then never receives
// another declaration (novox/hq issue 063).
if !strings.Contains(out, "ct original proto-dst 5671 accept") {
t.Fatalf("the broker's port is not forwarded, so a DNAT'd broker is unreachable "+
"cross-node after it restarts:\n%s", out)
}
}
// And a mesh that was never told about a broker still gets a ruleset, rather than an empty one or