From bd763fb4fbdf3db870ca3b003008f15f94379898 Mon Sep 17 00:00:00 2001 From: lean Date: Tue, 17 Mar 2020 10:54:17 +0800 Subject: [PATCH] luci-app-ssr-plus: fix Netflix unblock in GFWlist mode --- package/lean/luci-app-ssr-plus/Makefile | 2 +- .../luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 14 +++++++++----- .../lean/luci-app-ssr-plus/root/usr/bin/ssr-rules | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index fbba6e150..380b50575 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=168 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 171380a4f..0bc76d0ea 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -108,11 +108,15 @@ gen_config_file() { } EOF local plugin=$(uci_get_by_name $1 plugin) - if [ -n "$plugin" ] && [ "$plugin" == "simple-obfs" ]; then - plugin="obfs-local" - fi - if [ -n "$plugin" -a -x "/usr/bin/$plugin" ]; then - sed -i "s@$hostip\",@$hostip\",\n\"plugin\": \"$plugin\",\n\"plugin_opts\": \"$(uci_get_by_name $1 plugin_opts)\",@" $config_file + if [ -n "$plugin" ]; then + if [ "$plugin" == "simple-obfs" ]; then + plugin="obfs-local" + fi + if [ -x "/usr/bin/$plugin" ]; then + sed -i "s@$hostip\",@$hostip\",\n\"plugin\": \"$plugin\",\n\"plugin_opts\": \"$(uci_get_by_name $1 plugin_opts)\",@" $config_file + else + echo "$(date "+%Y-%m-%d %H:%M:%S") Warning!!! SIP003 plugin $plugin not found!!!" >>/tmp/ssrplus.log + fi fi elif [ "$stype" == "ssr" ]; then cat <<-EOF >$config_file diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules index 121fc3474..216416047 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules @@ -71,7 +71,6 @@ flush_r() { ipset -X oversea 2>/dev/null ipset -X whitelist 2>/dev/null ipset -X blacklist 2>/dev/null - ipset -X netflix 2>/dev/null [ -n "$FWI" ] && echo '#!/bin/sh' >$FWI return 0 } @@ -120,6 +119,8 @@ ipset_r() { $IPT -I SS_SPEC_WAN_AC -m set --match-set whitelist dst -j RETURN for ip in $WAN_BP_IP; do ipset -! add whitelist $ip; done for ip in $WAN_FW_IP; do ipset -! add blacklist $ip; done + + $IPT -I SS_SPEC_WAN_AC -p tcp -m set --match-set netflix dst -j REDIRECT --to-ports 4321 return $? } @@ -134,7 +135,6 @@ fw_rule() { $IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN $IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN $IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN - $IPT -A SS_SPEC_WAN_FW -p tcp -m set --match-set netflix dst -j REDIRECT --to-ports 4321 $IPT -A SS_SPEC_WAN_FW -p tcp $PROXY_PORTS \ -j REDIRECT --to-ports $local_port 2>/dev/null || { loger 3 "Can't redirect, please check the iptables."