hmgle / graftcp

A flexible tool for redirecting a given program's TCP traffic to SOCKS5 or HTTP proxy.
GNU General Public License v3.0
2.07k stars 174 forks source link

wget 可以正常使用,但 curl 不行 #48

Closed everplus closed 9 months ago

everplus commented 2 years ago

centos 7 x64,使用 graftcp 运行 wget 都可以正常使用,curl ip 地址可以,curl 带域名不行,会卡住 会无线循环进入 trace_syscall_entering 约 1 秒 1 次,pinfp->csn 值为 7,SYS_poll

可能是什么原因?

hmgle commented 2 years ago

执行 graftcp 时可以用 sudo journalctl -f -u graftcp-local.service 观察下日志,看看是否有目标地址的IP输出。 有可能是 DNS 解析出问题了。

everplus commented 2 years ago

graftcp-local 我看过没有任何日志

everplus commented 2 years ago

我用nodejs写了一个简单的脚本,只是用了dns.resolve,就会卡住,不进回调

hmgle commented 2 years ago

用 graftcp 启动 curl 时可以加下 -v--trace - 选项看下执行到哪一步失败了。从上面的 graftcp-local 没有日志输出来看,应该发生在建立 TCP 连接之前。

everplus commented 2 years ago

--verbose 和 --trace - 都没有任何输出 我用 strace 记录了日志,见附件

strace.txt

hmgle commented 2 years ago

--verbose 和 --trace - 都没有任何输出 我用 strace 记录了日志,见附件

strace.txt

想确定一下上面的确切执行命令,是 graftcp curl -v https://github.comgraftcp curl --trace - https://github.com 都没有任何输出吗?

everplus commented 2 years ago

对的

everplus commented 2 years ago

graftcp_test 有 privileged 权限

everplus commented 2 years ago

image image

hmgle commented 2 years ago

@everplus 请问下 curl 的版本是多少,我看下我这边能不能复现。

everplus commented 2 years ago

curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.19.1 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.4.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz

我感觉不是 curl 版本的问题,相同的版本在其他机器上是好的,我出故障的是一台 kvm 虚拟机,猜测和虚拟化有一些关系