Permalink
Browse files

firewall.py: make it super clear when we apply the MacOS fix.

Print a message to stderr, then abort.  But only the first time.
  • Loading branch information...
apenwarr committed Feb 27, 2011
1 parent c339959 commit 90a55a33a255941081623b6efe03789f6fc5c86a
Showing with 14 additions and 2 deletions.
  1. +14 −2 firewall.py
View
@@ -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')

0 comments on commit 90a55a3

Please sign in to comment.