OSDN Git Service

v2rayA: fix path in patches
[v2raya/v2raya-openwrt.git] / v2raya / patches / 001-fix-failed-to-clean-iptables-rules-in-some-cases.patch
1 From e7839b5e9de01f8dca66449eb2e720963a56f403 Mon Sep 17 00:00:00 2001
2 From: mzz2017 <mzz@tuta.io>
3 Date: Sat, 5 Feb 2022 20:23:32 +0800
4 Subject: [PATCH] fix: failed to clean iptables rules in some cases
5
6 ---
7  service/core/v2ray/transparent.go | 13 ++++++-------
8  1 file changed, 6 insertions(+), 7 deletions(-)
9
10 diff --git a/core/v2ray/transparent.go b/core/v2ray/transparent.go
11 index 5480660..07b01a0 100644
12 --- a/core/v2ray/transparent.go
13 +++ b/core/v2ray/transparent.go
14 @@ -12,12 +12,14 @@ import (
15  )
16  
17  func DeleteTransparentProxyRules() {
18 -       removeResolvHijacker()
19         iptables.CloseWatcher()
20 -       iptables.Tproxy.GetCleanCommands().Run(false)
21 -       iptables.Redirect.GetCleanCommands().Run(false)
22 +       if !conf.GetEnvironmentConfig().Lite {
23 +               removeResolvHijacker()
24 +               iptables.Tproxy.GetCleanCommands().Run(false)
25 +               iptables.Redirect.GetCleanCommands().Run(false)
26 +               iptables.DropSpoofing.GetCleanCommands().Run(false)
27 +       }
28         iptables.SystemProxy.GetCleanCommands().Run(false)
29 -       iptables.DropSpoofing.GetCleanCommands().Run(false)
30         time.Sleep(100 * time.Millisecond)
31  }
32  
33 @@ -89,9 +91,6 @@ func CheckAndSetupTransparentProxy(checkRunning bool, setting *configure.Setting
34  }
35  
36  func CheckAndStopTransparentProxy() {
37 -       if !IsTransparentOn() {
38 -               return
39 -       }
40         DeleteTransparentProxyRules()
41  }
42  
43 -- 
44 2.20.1
45