[roads] QA F-08: a mesh address is never an internet address
devices.address refused only special and IPv4-embedding ranges, so a public address was accepted, and an exit's forward-to-internet rule then covered that device's mesh address. Mesh addresses now stay inside the not-internet ranges (100.64.0.0/10, RFC 1918, ULA). Two fixtures, IPv4 and IPv6.
This commit is contained in:
@@ -395,10 +395,13 @@ impl Devices {
|
||||
},
|
||||
};
|
||||
let address = match d.address.parse::<std::net::IpAddr>() {
|
||||
// A mesh address is never an internet address, so an exit's `internet` rule can never
|
||||
// cover another device of the mesh (QA F-08).
|
||||
Ok(a)
|
||||
if a.to_string() == d.address
|
||||
&& !Net::host(a).is_special()
|
||||
&& !Net::host(a).embeds_ipv4() =>
|
||||
&& !Net::host(a).embeds_ipv4()
|
||||
&& !Net::host(a).reaches_internet() =>
|
||||
{
|
||||
if !addresses.insert(a) {
|
||||
e(
|
||||
@@ -413,7 +416,10 @@ impl Devices {
|
||||
e(
|
||||
f("address"),
|
||||
r::DEVICES_ADDRESS,
|
||||
format!("`{}` is not one IP address", clip(&d.address)),
|
||||
format!(
|
||||
"`{}` is not one private IP address (a mesh address is never loopback, link-local, multicast, embedded IPv4 or on the internet; 100.64.0.0/10 or a ULA)",
|
||||
clip(&d.address)
|
||||
),
|
||||
);
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user