From 13b5d6e5ecebef7ee88a48e4f4314dc17dcb7b2d Mon Sep 17 00:00:00 2001 From: Zou Yong Date: Fri, 12 May 2017 03:06:38 -0500 Subject: [PATCH] Fix udp dns issue under python3 (#849) str is not bytes under python3, if dns config is a list, will cause asyncdns.py failed: asyncdns.py: .......... def handle_event(self, sock, fd, event): if sock != self._sock: return if event & eventloop.POLL_ERR: ........... else: data, addr = sock.recvfrom(1024) if addr[0] not in self._servers: logging.warn('received a packet other than our dns') return self._handle_data(data) --- shadowsocks/shell.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shadowsocks/shell.py b/shadowsocks/shell.py index df04cee..d508049 100644 --- a/shadowsocks/shell.py +++ b/shadowsocks/shell.py @@ -199,6 +199,8 @@ def check_config(config, is_local): if config.get('dns_server', None) is not None: if type(config['dns_server']) != list: config['dns_server'] = to_str(config['dns_server']) + else: + config['dns_server'] = [to_str(ds) for ds in config['dns_server']] logging.info('Specified DNS server: %s' % config['dns_server']) config['crypto_path'] = {'openssl': config['libopenssl'],