diff --git a/shadowsocks-libev.sh b/shadowsocks-libev.sh index f4f8f03..f152e40 100644 --- a/shadowsocks-libev.sh +++ b/shadowsocks-libev.sh @@ -169,9 +169,10 @@ function iptables_set(){ echo "iptables start setting..." /sbin/service iptables status 1>/dev/null 2>&1 if [ $? -eq 0 ]; then - /etc/init.d/iptables status | grep '${shadowsocksport}' | grep 'ACCEPT' >/dev/null 2>&1 + /sbin/iptables -L -n | grep '${shadowsocksport}' | grep 'ACCEPT' >/dev/null 2>&1 if [ $? -ne 0 ]; then /sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${shadowsocksport} -j ACCEPT + /sbin/iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${shadowsocksport} -j ACCEPT /etc/init.d/iptables save /etc/init.d/iptables restart else @@ -277,10 +278,10 @@ function install_shadowsocks_libev(){ pre_install download_files config_shadowsocks - if ! centosversion 7; then + install + if centosversion 6; then iptables_set fi - install } # Initialization step