@@ -70,7 +70,7 @@ def ipt_ttl(*args):
70
70
# multiple copies shouldn't have overlapping subnets, or only the most-
71
71
# recently-started one will win (because we use "-I OUTPUT 1" instead of
72
72
# "-A OUTPUT").
73
- def do_iptables (port , dnsport , subnets ):
73
+ def do_iptables (port , dnsport , nslist , subnets ):
74
74
chain = 'sshuttle-%s' % port
75
75
76
76
# basic cleanup/setup of chains
@@ -104,7 +104,6 @@ def do_iptables(port, dnsport, subnets):
104
104
'--to-ports' , str (port ))
105
105
106
106
if dnsport :
107
- nslist = resolvconf_nameservers ()
108
107
for ip in nslist :
109
108
ipt_ttl ('-A' , chain , '-j' , 'REDIRECT' ,
110
109
'--dest' , '%s/32' % ip ,
@@ -255,7 +254,7 @@ def ipfw(*args):
255
254
_call (argv )
256
255
257
256
258
- def do_ipfw (port , dnsport , subnets ):
257
+ def do_ipfw (port , dnsport , nslist , subnets ):
259
258
sport = str (port )
260
259
xsport = str (port + 1 )
261
260
@@ -354,7 +353,6 @@ def do_ipfw(port, dnsport, subnets):
354
353
IPPROTO_DIVERT )
355
354
divertsock .bind (('0.0.0.0' , port )) # IP field is ignored
356
355
357
- nslist = resolvconf_nameservers ()
358
356
for ip in nslist :
359
357
# relabel and then catch outgoing DNS requests
360
358
ipfw ('add' , sport , 'divert' , sport ,
@@ -451,7 +449,7 @@ def ip_in_subnets(ip, subnets):
451
449
# exit. In case that fails, it's not the end of the world; future runs will
452
450
# supercede it in the transproxy list, at least, so the leftover rules
453
451
# are hopefully harmless.
454
- def main (port , dnsport , syslog ):
452
+ def main (port , dnsport , nslist , syslog ):
455
453
assert (port > 0 )
456
454
assert (port <= 65535 )
457
455
assert (dnsport >= 0 )
@@ -516,7 +514,7 @@ def main(port, dnsport, syslog):
516
514
try :
517
515
if line :
518
516
debug1 ('firewall manager: starting transproxy.\n ' )
519
- do_wait = do_it (port , dnsport , subnets )
517
+ do_wait = do_it (port , dnsport , nslist , subnets )
520
518
sys .stdout .write ('STARTED\n ' )
521
519
522
520
try :
@@ -546,5 +544,5 @@ def main(port, dnsport, syslog):
546
544
debug1 ('firewall manager: undoing changes.\n ' )
547
545
except :
548
546
pass
549
- do_it (port , 0 , [])
547
+ do_it (port , 0 , [], [] )
550
548
restore_etc_hosts (port )
0 commit comments