alex-sector / dns2tcp

GNU General Public License v2.0
178 stars 56 forks source link

dns2tcpc might be terminated by signal SIGPIPE. #3

Open 185264646 opened 3 years ago

185264646 commented 3 years ago

The client always exited after working a few seconds or few minutes. I used strace to find out the reason and found that it was terminated by SIGPIPE. environment: Win10 1909 WSLv1 Ubuntu20.04LTS

alex-sector commented 3 years ago

A SIGPIPE means that a socket has been closed while someone was reading / writing.

This could be something not related to dns2tcp, but linked to the process launched by dns2tcpc.

185264646 commented 3 years ago

A SIGPIPE means that a socket has been closed while someone was reading / writing.

This could be something not related to dns2tcp, but linked to the process launched by dns2tcpc.

I'm not sure. The network quality is not very good, ISP likes dropping UDP packets. Is this application resistant to the loss of packets? I tried mKCP integrated in v2ray and it worked very well.

The route is like this: browser -> dns2tcpc -> dns2tcpd -> danted. I have set the browser to use socks5 proxy. Sadly I can't do more tests now.

alex-sector commented 3 years ago

dns2tcp is resistant to some packet loss. However it appears that close() is not very well handled and may lost the last packet.

That could explain that your use case would spot the bug rapidly.

Unfortunately I'll be hard to fix in a near future. A workaround would be to tunnel something that use a persistent TCP connection (like a VPN or a SSH) and tunnel or socksify dante inside it.

185264646 commented 3 years ago

dns2tcp is resistant to some packet loss. However it appears that close() is not very well handled and may lost the last packet.

That could explain that your use case would spot the bug rapidly.

Unfortunately I'll be hard to fix in a near future. A workaround would be to tunnel something that use a persistent TCP connection (like a VPN or a SSH) and tunnel or socksify dante inside it.

I also tried to tunnel ssh in dns2tcp. Because of the speed requirement is very low, it didn't happen very frequently, but still unstable, making the session disconnected without any warning. I tried a rough solution: add signal(SIGPIPE, SIG_IGN) at the head of main() to avoid dns2tcp being terminated, but it's not a very good solution. Anyway, v2ray with mKCP is a good solution because it is a complete proxy tool and don't require me to find another socks5 or http proxy tool over TCP. The route is like this: ssh -> dns2tcpc -> dns2tcpd -> sshd. I'm sorry that I can't remember it clearly as two months have past. I don't have a server to reproduce it right now and I have removed this program and its conf file from my computer to making $HOME looks cleaner.

OmriBaso commented 2 years ago

could you guys help me and tell me how to compile the agent for Windows? I cant seem to get this to work