Skip to content

Commit a82224c

Browse files
committed
Import resolvconf_nameservers, fix wrong types
Add resolvconf_nameservers to the list of functions imported from helpers. Fixed an instance where the method client.main was being called with ns_hosts (string obtained from optional argument --ns-hosts) instead of nslist (list of tuples that was already being passed to other methods). Should fix issue apenwarr#24.
1 parent 28be71e commit a82224c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/client.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
import ssyslog
1212
import sys
1313
from ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
14-
from helpers import log, debug1, debug2, debug3, Fatal, islocal
14+
from helpers import log, debug1, debug2, debug3, Fatal, islocal, \
15+
resolvconf_nameservers
1516

1617
recvmsg = None
1718
try:
@@ -277,18 +278,17 @@ def print_listening(self, what):
277278
class FirewallClient:
278279

279280
def __init__(self, port_v6, port_v4, subnets_include, subnets_exclude,
280-
dnsport_v6, dnsport_v4, ns_hosts, method, udp):
281+
dnsport_v6, dnsport_v4, nslist, method, udp):
281282
self.auto_nets = []
282283
self.subnets_include = subnets_include
283284
self.subnets_exclude = subnets_exclude
284-
self.ns_hosts = ns_hosts
285285
argvbase = ([sys.argv[1], sys.argv[0], sys.argv[1]] +
286286
['-v'] * (helpers.verbose or 0) +
287287
['--firewall', str(port_v6), str(port_v4),
288288
str(dnsport_v6), str(dnsport_v4),
289289
method, str(int(udp))])
290290
if dnsport_v4 or dnsport_v6:
291-
argvbase += ['--ns-hosts', ns_hosts]
291+
argvbase += ['--ns-hosts', ' '.join([ip for _, ip in nslist])]
292292
if ssyslog._p:
293293
argvbase += ['--syslog']
294294
argv_tries = [
@@ -602,7 +602,7 @@ def onhostlist(hostlist):
602602

603603

604604
def main(listenip_v6, listenip_v4,
605-
ssh_cmd, remotename, python, latency_control, dns, ns_hosts,
605+
ssh_cmd, remotename, python, latency_control, dns, nslist,
606606
method, seed_hosts, auto_nets,
607607
subnets_include, subnets_exclude, syslog, daemon, pidfile):
608608

@@ -698,9 +698,9 @@ def main(listenip_v6, listenip_v4,
698698
udp_listener.print_listening("UDP redirector")
699699

700700
bound = False
701-
if dns or ns_hosts:
701+
if dns or nslist:
702702
if dns:
703-
ns_hosts += resolvconf_nameservers()
703+
nslist += resolvconf_nameservers()
704704
# search for spare port for DNS
705705
debug2('Binding DNS:')
706706
ports = xrange(12300, 9000, -1)
@@ -740,10 +740,9 @@ def main(listenip_v6, listenip_v4,
740740
dnsport_v6 = 0
741741
dnsport_v4 = 0
742742
dns_listener = None
743-
ns_hosts = []
744743

745744
fw = FirewallClient(redirectport_v6, redirectport_v4, subnets_include,
746-
subnets_exclude, dnsport_v6, dnsport_v4, ns_hosts,
745+
subnets_exclude, dnsport_v6, dnsport_v4, nslist,
747746
method, udp)
748747

749748
if fw.method == "tproxy":

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def parse_list(list):
215215
opt.python,
216216
opt.latency_control,
217217
opt.dns,
218-
opt.ns_hosts,
218+
nslist,
219219
method,
220220
sh,
221221
opt.auto_nets,

0 commit comments

Comments
 (0)