Test that a global IPv6 subnet is public and never counts as the local network (issue 154, ADR 0340)
mesh/merge-gate head 4cc8588afb87 merged into trunk 0a1dc5f93fcb — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 4cc8588afb87 merged into trunk 0a1dc5f93fcb — pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group fix/154-local-network delivered: every member is delivered
mesh/merge-gate head 4cc8588afb87 merged into trunk 0a1dc5f93fcb — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 4cc8588afb87 merged into trunk 0a1dc5f93fcb — pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group fix/154-local-network delivered: every member is delivered
The review asked for the IPv6 side of the rule that local-network cannot open a port to the internet.
This commit is contained in:
@@ -175,3 +175,21 @@ func TestAnAdoptedNodeOpensTheLocalNetworkPortToTheMeshOnly(t *testing.T) {
|
|||||||
t.Fatalf("openings %v", out)
|
t.Fatalf("openings %v", out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A global unicast IPv6 subnet on a link facing outside is public, and never counts: the IPv6 side of the
|
||||||
|
// rule that `local-network` cannot open a port to the internet (ADR 0340 §2).
|
||||||
|
func TestAGlobalIPv6SubnetIsPublicAndNeverCounts(t *testing.T) {
|
||||||
|
got := JudgeLocalNetworks([]AttachedNetwork{{Link: "eth0", Network: "2001:db8:1234::7/48"}}, []string{"eth0"}, "wg-mesh")
|
||||||
|
if len(got) != 1 {
|
||||||
|
t.Fatalf("judged %+v", got)
|
||||||
|
}
|
||||||
|
if got[0].Counts {
|
||||||
|
t.Fatalf("the global IPv6 subnet %s counts as a local network", got[0].Network)
|
||||||
|
}
|
||||||
|
if got[0].Network != "2001:db8:1234::/48" || !strings.Contains(got[0].Why, "public, never counted") {
|
||||||
|
t.Fatalf("judged %s with why %q, want it named public and never counted", got[0].Network, got[0].Why)
|
||||||
|
}
|
||||||
|
if n := CountedLocalNetworks(got); len(n) != 0 {
|
||||||
|
t.Fatalf("counted %v", n)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user