@@ -70,7 +70,7 @@ def ipt_ttl(*args):
7070# multiple copies shouldn't have overlapping subnets, or only the most-
7171# recently-started one will win (because we use "-I OUTPUT 1" instead of
7272# "-A OUTPUT").
73- def do_iptables (port , dnsport , subnets ):
73+ def do_iptables (port , dnsport , nslist , subnets ):
7474 chain = 'sshuttle-%s' % port
7575
7676 # basic cleanup/setup of chains
@@ -104,7 +104,6 @@ def do_iptables(port, dnsport, subnets):
104104 '--to-ports' , str (port ))
105105
106106 if dnsport :
107- nslist = resolvconf_nameservers ()
108107 for ip in nslist :
109108 ipt_ttl ('-A' , chain , '-j' , 'REDIRECT' ,
110109 '--dest' , '%s/32' % ip ,
@@ -255,7 +254,7 @@ def ipfw(*args):
255254 _call (argv )
256255
257256
258- def do_ipfw (port , dnsport , subnets ):
257+ def do_ipfw (port , dnsport , nslist , subnets ):
259258 sport = str (port )
260259 xsport = str (port + 1 )
261260
@@ -354,7 +353,6 @@ def do_ipfw(port, dnsport, subnets):
354353 IPPROTO_DIVERT )
355354 divertsock .bind (('0.0.0.0' , port )) # IP field is ignored
356355
357- nslist = resolvconf_nameservers ()
358356 for ip in nslist :
359357 # relabel and then catch outgoing DNS requests
360358 ipfw ('add' , sport , 'divert' , sport ,
@@ -451,7 +449,7 @@ def ip_in_subnets(ip, subnets):
451449# exit. In case that fails, it's not the end of the world; future runs will
452450# supercede it in the transproxy list, at least, so the leftover rules
453451# are hopefully harmless.
454- def main (port , dnsport , syslog ):
452+ def main (port , dnsport , nslist , syslog ):
455453 assert (port > 0 )
456454 assert (port <= 65535 )
457455 assert (dnsport >= 0 )
@@ -516,7 +514,7 @@ def main(port, dnsport, syslog):
516514 try :
517515 if line :
518516 debug1 ('firewall manager: starting transproxy.\n ' )
519- do_wait = do_it (port , dnsport , subnets )
517+ do_wait = do_it (port , dnsport , nslist , subnets )
520518 sys .stdout .write ('STARTED\n ' )
521519
522520 try :
@@ -546,5 +544,5 @@ def main(port, dnsport, syslog):
546544 debug1 ('firewall manager: undoing changes.\n ' )
547545 except :
548546 pass
549- do_it (port , 0 , [])
547+ do_it (port , 0 , [], [] )
550548 restore_etc_hosts (port )
0 commit comments