From 17c53b92b917273100e6802db72b5f080169a639 Mon Sep 17 00:00:00 2001
From: yaling888 <73897884+yaling888@users.noreply.github.com>
Date: Thu, 3 Mar 2022 05:02:17 +0800
Subject: [PATCH] Fix: iptables routing mark init

---
 hub/executor/executor.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hub/executor/executor.go b/hub/executor/executor.go
index f2fab98b..3252602a 100644
--- a/hub/executor/executor.go
+++ b/hub/executor/executor.go
@@ -192,7 +192,10 @@ func updateGeneral(general *config.General, force bool) {
 	log.Infoln("Use interface name: %s", general.Interface)
 
 	dialer.DefaultInterface.Store(general.Interface)
-	dialer.DefaultRoutingMark.Store(int32(general.RoutingMark))
+
+	if general.RoutingMark > 0 {
+		dialer.DefaultRoutingMark.Store(int32(general.RoutingMark))
+	}
 
 	iface.FlushCache()
 
@@ -280,10 +283,7 @@ func updateIPTables(dns *config.DNS, general *config.General) {
 
 	tproxy.CleanUpTProxyLinuxIPTables()
 
-	if dialer.DefaultRoutingMark.Load() == 0 {
-		dialer.DefaultRoutingMark.Store(2158)
-	}
-
+	dialer.DefaultRoutingMark.Store(2158)
 	err = tproxy.SetTProxyLinuxIPTables(general.Interface, general.TProxyPort, dnsPort)
 
 	if err != nil {