From 8556fd3c1825fc41f9cf08ef9d4b816921d40530 Mon Sep 17 00:00:00 2001 From: BreakWa11 Date: Thu, 16 Jun 2016 01:35:18 +0800 Subject: [PATCH] fix UDPRelay _forbidden_portset --- shadowsocks/udprelay.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index 5af77b0..fff62c1 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -926,6 +926,10 @@ class UDPRelay(object): self._forbidden_iplist = config['forbidden_ip'] else: self._forbidden_iplist = None + if 'forbidden_port' in config: + self._forbidden_portset = config['forbidden_port'] + else: + self._forbidden_portset = None addrs = socket.getaddrinfo(self._listen_addr, self._listen_port, 0, socket.SOCK_DGRAM, socket.SOL_UDP) @@ -1083,8 +1087,10 @@ class UDPRelay(object): return if self._forbidden_portset: if sa[1] in self._forbidden_portset: - raise Exception('Port %d is in forbidden list, reject' % + logging.debug('Port %d is in forbidden list, reject' % sa[1]) + # drop + return client = socket.socket(af, socktype, proto) client.setblocking(False) is_dns = False