[roads] QA F-02: going direct never takes what the tunnel carries out of it

A goes-direct subnet was only checked to be canonical, and the kill switch
dropped it only when it reached the internet, so 100.96.0.0/16 (every mesh
address) or the home LAN that the plan routes into the tunnel compiled cleanly.

Now, decided here because the plan has to say which route wins:
- a goes-direct subnet other than /0 that holds a mesh address is refused
  (direct.mesh);
- per device, a direct subnet inside a net the plan tunnels is dropped and
  reported (direct.tunnelled);
- a direct subnet that holds tunnelled nets keeps them in the tunnel, listed
  in the new plan field direct[].except. A platform that cannot honour except
  (an app-level bypass) must not apply the entry.

The F-02 test now checks that every overlap is covered by except, and that
only the mesh subnet is refused. Golden plans and the pinned jana-phone digest
are regenerated: the only change is the except lists. Plan format 1 has not
been released, so it changes in place.
This commit is contained in:
2026-11-25 08:54:51 +01:00
parent ecafe194a5
commit 80f73a0154
17 changed files with 132 additions and 5 deletions
@@ -42,6 +42,9 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.7/32"
],
"roads": [
"e5yj1s"
]
@@ -177,6 +177,12 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.1/32",
"100.96.0.3/32",
"100.96.0.4/32",
"100.96.0.5/32"
],
"roads": [
"e5yj1s"
]
@@ -40,6 +40,9 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
],
"roads": [
"e5yj1s"
]
@@ -40,6 +40,9 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
],
"roads": [
"e5yj1s"
]
@@ -37,6 +37,7 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [],
"roads": [
"e5yj1s"
]
+3
View File
@@ -31,6 +31,9 @@
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
],
"roads": [
"e5yj1s"
]
+2
View File
@@ -46,6 +46,8 @@ road a00044-tab.md yaml.refused -
road a00045-empty-until.md key.empty until
road a00046-until-comment.md key.empty until
road a00047-empty-ports.md key.empty ports
road a00048-direct-mesh.md direct.mesh object
road a00049-direct-tunnelled.md direct.tunnelled object
directory unknown-field.directory.json snapshot.json -
directory format-two.directory.json snapshot.format format
directory bad-person-id.directory.json directory.id people[3].id
@@ -0,0 +1,7 @@
---
id: a00048
subject: person:jana
verb: goes-direct
object: subnet:100.96.0.0/24
created: 2026-11-25T10:00:00+01:00
---
@@ -0,0 +1,7 @@
---
id: a00049
subject: person:mark
verb: goes-direct
object: subnet:192.168.100.0/25
created: 2026-11-25T10:00:00+01:00
---
+14 -2
View File
@@ -52,7 +52,6 @@ fn f01_a_service_road_grants_only_that_service() {
/// plan also routes into the tunnel is told to bypass it, on whatever network the device is on, and the
/// kill switch does not stop it because the subnet is "private".
#[test]
#[ignore = "QA F-02 (major): goes-direct can take mesh addresses and tunnelled subnets out of the tunnel"]
fn f02_going_direct_never_overlaps_what_the_tunnel_carries() {
let mark_pc = key(1);
for subnet in ["100.96.0.0/16", "192.168.100.0/24", "192.168.0.0/16"] {
@@ -77,15 +76,28 @@ fn f02_going_direct_never_overlaps_what_the_tunnel_carries() {
.flat_map(|p| p.allowed_ips.iter())
.filter(|n| n.prefix_len() > 0)
.collect();
// Decision (owner session): a direct subnet that holds tunnelled nets keeps them in the tunnel, listed
// in `except`; one inside a tunnelled net is dropped; one holding a mesh address is refused. So every
// overlap must be covered by `except`.
for d in &plan.direct {
for n in &tunnelled {
assert!(
!d.subnet.overlaps(n),
!d.subnet.overlaps(n) || d.except.iter().any(|e| e.contains(n)),
"goes-direct {} overlaps {n}, which the plan sends through the tunnel",
d.subnet
);
}
}
let refused = c
.problems
.iter()
.any(|p| p.path.contains("f02aaa") && p.code == roads::rules::DIRECT_MESH);
assert_eq!(
refused,
subnet == "100.96.0.0/16",
"{subnet}: {:?}",
c.problems
);
}
}
+1
View File
@@ -43,6 +43,7 @@ fn inactive_code(code: &str) -> bool {
rules::EXIT_CONFLICT,
rules::DIRECT_KILL_SWITCH,
rules::ROAD_FAMILY,
rules::DIRECT_TUNNELLED,
]
.contains(&code)
}