ソースを参照

fix(init): fix pub_access rule for fw3

Signed-off-by: Tianling Shen <[email protected]>
(cherry picked from commit bc654b7bae612283d80072146f2cc729ff0b900a)
Tianling Shen 2 年 前
コミット
6764d569d5
1 ファイル変更8 行追加8 行削除
  1. 8 8
      root/etc/init.d/unblockneteasemusic

+ 8 - 8
root/etc/init.d/unblockneteasemusic

@@ -13,7 +13,7 @@ UNM_DIR="/usr/share/$NAME"
 RUN_DIR="/var/run/$NAME"
 
 IPT_N="iptables -t nat"
-IPT_INPUT_RULE="unblockneteasemusic_input_rule"
+IPT_INPUT_RULE="unm_input_rule"
 
 is_enabled() {
 	local enabled
@@ -95,10 +95,10 @@ start_service() {
 	append_param "-p" "${http_port}":"${https_port}"
 
 	if is_enabled "config" "pub_access"; then
-		iptables -N "$IPT_RULE_NAME"
-		iptables -t filter -I INPUT -j "$IPT_RULE_NAME"
-		iptables -t filter -A "$IPT_RULE_NAME" -p tcp --dport "${http_port}" -j ACCEPT
-		iptables -t filter -A "$IPT_RULE_NAME" -p tcp --dport "${https_port}" -j ACCEPT
+		iptables -N "$IPT_INPUT_RULE"
+		iptables -t filter -I INPUT -j "$IPT_INPUT_RULE"
+		iptables -t filter -A "$IPT_INPUT_RULE" -p tcp --dport "${http_port}" -j ACCEPT
+		iptables -t filter -A "$IPT_INPUT_RULE" -p tcp --dport "${https_port}" -j ACCEPT
 
 		echo "/etc/init.d/$NAME restart" > "$RUN_DIR/fw3.include"
 	fi
@@ -212,9 +212,9 @@ stop_service() {
 	/etc/init.d/cron restart
 
 	local settable
-	iptables -t filter -D INPUT -j "$IPT_RULE_NAME" 2>"/dev/null"
-	iptables -F "$IPT_RULE_NAME" 2>"/dev/null"
-	iptables -X "$IPT_RULE_NAME" 2>"/dev/null"
+	iptables -t filter -D INPUT -j "$IPT_INPUT_RULE" 2>"/dev/null"
+	iptables -F "$IPT_INPUT_RULE" 2>"/dev/null"
+	iptables -X "$IPT_INPUT_RULE" 2>"/dev/null"
 
 	$IPT_N -D "PREROUTING" -p "tcp" -m set --match-set "neteasemusic" "dst" -j "netease_cloud_music" 2>"/dev/null"
 	$IPT_N -F "netease_cloud_music" 2>"/dev/null"