Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

[Bug] 默认情况下,tproxy如果路由导向direct的话,会造成无限循环 #144

Closed
e1732a364fed opened this issue Sep 13, 2022 · 3 comments
Labels
bug Something isn't working 易错点

Comments

@e1732a364fed
Copy link
Owner

e1732a364fed commented Sep 13, 2022

Describe the bug【描述 bug】
tproxy如果路由导向direct的话,会造成无限循环

To Reproduce【如何复现该bug】

tproxy实例文件中,添加下面路由:

[[route]]
network = ["tcp"]
toTag = "direct"

然后随便用 wget 访问一个ip

Expected behavior【预期的行为】
不循环

Envs (please complete the following information):【系统环境】
ubuntu arm64,最新代码

Config file 【配置文件,客户端服务端配置都提供】
如上述,无服务端,因为直接客户端就会出错。

Debug Log 【Debug日志, 客户端 和 服务端 的 日志 都提供】
客户端不断循环访问相同的ip

Other 【其他】

似乎是导向direct时,没有再次打上标记,导致又进入了tproxy的处理逻辑,导致了无限递归

【注意,配置文件和客户端服务端配置 太长的话,前后加上三个 `, 如 ```】

@e1732a364fed e1732a364fed added the bug Something isn't working label Sep 13, 2022
@e1732a364fed
Copy link
Owner Author

原来是不能使用默认的 direct,而是必须自己设一个 direct,并且打上255标记,配置如下:

[[dial]]
tag = "mydirect"
protocol = "direct"
sockopt.mark = 255


[[route]]
ip = ["163.177.151.110"]
toTag = "mydirect"

必须给direct打上一个保险的 255标记,才能避免递归问题。

@e1732a364fed e1732a364fed added invalid This doesn't seem right 易错点 and removed bug Something isn't working labels Sep 13, 2022
@e1732a364fed e1732a364fed changed the title [Bug] tproxy如果路由导向direct的话,会造成无限循环 默认情况下,tproxy如果路由导向direct的话,会造成无限循环 Sep 13, 2022
@e1732a364fed
Copy link
Owner Author

e1732a364fed commented Sep 13, 2022

不行,加了sockopt 还是不好使。

DialWithOpt根本没被调用过。而之所以不导向direct时没问题,是因为我们恰好都是在局域网内配置的服务端,被iptables规则滤掉了。

@e1732a364fed e1732a364fed reopened this Sep 13, 2022
@e1732a364fed e1732a364fed added bug Something isn't working and removed invalid This doesn't seem right labels Sep 13, 2022
@e1732a364fed
Copy link
Owner Author

e1732a364fed commented Sep 13, 2022

9dacc9e 中,虽然修复了这个问题,但是该修复仅限于对direct的修复。如果 「其他protocol的 dial」并不是向局域网拨号的话,在该例子中,还是会发生循环问题,需要进一步修改代码解决。

不过好在上述假设的现象不常见。

@e1732a364fed e1732a364fed changed the title 默认情况下,tproxy如果路由导向direct的话,会造成无限循环 [Bug] 默认情况下,tproxy如果路由导向direct的话,会造成无限循环 Sep 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working 易错点
Projects
None yet
Development

No branches or pull requests

1 participant