summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2011-02-26 17:45:27 -0800
committerAvery Pennarun <apenwarr@gmail.com>2011-02-26 17:45:27 -0800
commit90a55a33a255941081623b6efe03789f6fc5c86a (patch)
tree24c227837f776c3854041c21af2118b1db27ca76
parentc3399595d2919934e58b5a5db1d7f3d5eeae5803 (diff)
firewall.py: make it super clear when we apply the MacOS fix.
Print a message to stderr, then abort. But only the first time.
-rw-r--r--firewall.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/firewall.py b/firewall.py
index 4307bb0..4fd8c79 100644
--- a/firewall.py
+++ b/firewall.py
@@ -150,7 +150,7 @@ def sysctl_set(name, val, permanent=False):
_fill_oldctls(PREFIX)
if not (name in _oldctls):
debug1('>> No such sysctl: %r\n' % name)
- return
+ return False
oldval = _oldctls[name]
if val != oldval:
rv = _sysctl_set(name, val)
@@ -163,6 +163,7 @@ def sysctl_set(name, val, permanent=False):
f.close()
else:
_changedctls.append(name)
+ return True
def _udp_unpack(p):
@@ -221,7 +222,18 @@ def do_ipfw(port, dnsport, subnets):
if subnets or dnsport:
sysctl_set('net.inet.ip.fw.enable', 1)
- sysctl_set('net.inet.ip.scopedroute', 0, permanent=True)
+ changed = sysctl_set('net.inet.ip.scopedroute', 0, permanent=True)
+ if changed:
+ log("\n"
+ " WARNING: ONE-TIME NETWORK DISRUPTION:\n"
+ " =====================================\n"
+ "sshuttle has changed a MacOS kernel setting to work around\n"
+ "a bug in MacOS 10.6. This will cause your network to drop\n"
+ "within 5-10 minutes unless you restart your network\n"
+ "interface (change wireless networks or unplug/plug the\n"
+ "ethernet port) NOW, then restart sshuttle. The fix is\n"
+ "permanent; you only have to do this once.\n\n")
+ sys.exit(1)
ipfw('add', sport, 'check-state', 'ip',
'from', 'any', 'to', 'any')