Skip to content

Commit 4684aad

Browse files
author
Paul C
committed
v0.5.18: drop dangerous INPUT DROP rule that broke WolfRouter subnet routing
klasSponsor (2026-04-27) confirmed an `iptables -A INPUT -i <ext> -d <wolfnet-subnet> -j DROP` rule installed by enable_gateway() was breaking WolfRouter subnet routing on multiple nodes. The rule's intent ("block all other inbound traffic to wolfnet — truly private") turned out to be cargo-cult: a packet on ext_iface destined for a CGNAT address can only reach INPUT if that IP is local (i.e. the host's own wolfnet0), and the public internet can't legitimately route RFC1918/CGNAT addresses anyway. WolfNet privacy comes from the encrypted overlay, not from this filter. - Stop adding the rule in enable_gateway(). - Proactively delete up to 4 stale copies on every gateway start so existing nodes get cleaned up at the next WolfNet restart after upgrade. - disable_gateway()'s -D was already there; left untouched.
1 parent 991a2e1 commit 4684aad

3 files changed

Lines changed: 31 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wolfnet"
3-
version = "0.5.17"
3+
version = "0.5.18"
44
edition = "2021"
55
authors = ["Wolf Software Systems Ltd"]
66
description = "Secure private mesh networking over the internet"

src/gateway.rs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,37 @@ pub fn enable_gateway(wolfnet_interface: &str, subnet: &str) -> Result<(), Box<d
6666
warn!("iptables FORWARD rule (in) may have failed");
6767
}
6868

69-
// Block all other inbound traffic to wolfnet (truly private)
70-
let status = std::process::Command::new("iptables")
71-
.args(["-A", "INPUT", "-i", &ext_iface, "-d", subnet, "-j", "DROP"])
72-
.status()?;
73-
if !status.success() {
74-
warn!("iptables INPUT DROP rule may have failed");
69+
// Removed in 0.5.18: an `-A INPUT -i <ext> -d <subnet> -j DROP` rule
70+
// used to live here under the banner "Block all other inbound traffic
71+
// to wolfnet (truly private)". klasSponsor (2026-04-27) confirmed it
72+
// was breaking WolfRouter subnet routing on multiple nodes — peers'
73+
// packets and replies that legitimately transited via the WolfNet
74+
// CGNAT range were getting dropped depending on the path.
75+
//
76+
// The rule also wasn't actually defending anything: a packet on the
77+
// WAN destined for an RFC1918/CGNAT IP can only reach INPUT if that
78+
// IP is local to this host (i.e. its wolfnet0 address) — and packets
79+
// from the public internet to a host's wolfnet0 IP can't actually
80+
// arrive without spoofing or a misrouted upstream, neither of which
81+
// the rule meaningfully mitigates. WolfNet privacy comes from the
82+
// encrypted overlay itself, not from filtering at the gateway's
83+
// INPUT chain.
84+
//
85+
// Belt-and-braces: proactively delete any copy of the old rule that's
86+
// still installed on existing nodes from previous releases, so an
87+
// upgrade-and-restart of WolfNet quietly cleans them up. Repeated
88+
// -D runs handle the case where multiple copies got appended on
89+
// earlier daemon reloads.
90+
for _ in 0..4 {
91+
let status = std::process::Command::new("iptables")
92+
.args(["-D", "INPUT", "-i", &ext_iface, "-d", subnet, "-j", "DROP"])
93+
.status();
94+
match status {
95+
Ok(s) if s.success() => continue, // deleted one, try again
96+
_ => break, // none left (or iptables missing)
97+
}
7598
}
7699

77-
78100
Ok(())
79101
}
80102

0 commit comments

Comments
 (0)