You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
there must be a bug. I get a lot of RSTs when browsing in a netns with a TUN driven by it #6
If you see large captures it's me using it as some kind of daily driver. therefore just ask if you want any data, or testing. and I use geph.io 's proxy as upstream, which is a tor-bridge like proxy service (better than tor bridge in fact)
It looks quite terrifying to have that much unverified logic. perhaps you can try https://github.com/verus-lang/verus but idk how long it will take to become usable. some nice formal verification (unlikely)
If you see large captures it's me using it as some kind of daily driver. therefore just ask if you want any data, or testing. and I use geph.io 's proxy as upstream, which is a tor-bridge like proxy service (better than tor bridge in fact)
It looks quite terrifying to have that much unverified logic. perhaps you can try https://github.com/verus-lang/verus but idk how long it will take to become usable. some nice formal verification (unlikely)
Fortunately, the logic is almost correct. There is only one minor issue that should not affect the communications, but it is indeed a bug! The IP stack deallocates the TCP stream after receiving the last FIN/ACK, so the final ACK goes unrecognized, which results in a RST being returned. In the correct implementation, it should handle the last ACK as well. However, in both cases—whether it returns an RST (the faulty behavior) or accepts the ACK without returning an RST — the connection will be closed.
Thanks for the report, I'll fix it soon. Did you see any other unexpected rst except the last ack for the first one?
You can test ipstack with tun2socks5 under Linux. steps like this
sudo apt install iperf3 dante-server
sudo systemctl stop danted
git clone https://github.com/ssrlive/tun2socks5.git
cd tun2socks5
cargo b -r
# start testing
sudo scripts/iperf3.sh
# clear up
sudo sh -c "pkill tun2socks5; pkill iperf3; pkill danted; ip link del tun0; ip netns del test"
The timeout issue is manageable because I have hard-coded a 5-second timeout (which I intend to make configurable #4). Firefox keeps the connections open for reuse, and in some cases, this can result in them remaining open for more than 30 seconds.
You can test ipstack with tun2socks5 under Linux. steps like this
sudo apt install iperf3 dante-server
sudo systemctl stop danted
git clone https://github.com/ssrlive/tun2socks5.git
cd tun2socks5
cargo b -r
# start testing
sudo scripts/iperf3.sh
# clear up
sudo sh -c "pkill tun2socks5; pkill iperf3; pkill danted; ip link del tun0; ip netns del test"
I'll set up a Linux machine over the weekend to test tun2socks5. In the meantime, if you could attach a .pcap file, I would be able to check it manually beforehand.
This time the apps actively tried to RST the connection (quite frequently). I was running rustup update, and it failed 2 times before a success. fa94dac
This time the apps actively tried to RST the connection (quite frequently). I was running rustup update, and it failed 2 times before a success. fa94dac
Perhaps there is some issue with protocol compliance ?
I can't guarantee that the Ipstack is fully compliant, but I am doing my best to implement it at least based on RFC 793. However, RFC 793 is missing some features (for example, it lacks TCP keep-alive functionality) and has some weaknesses. Therefore, the newer version of TCP is based on RFC 9293, which is more comprehensive and addresses the shortcomings of RFC 793.
TCP keep-alive has not been implemented yet #8 (it is also not defined in RFC 793). The screenshot you mentioned shows an attempt to send a TCP keep-alive packet, and since it does not receive an ACK after several attempts, it resets the connection.
Are you sure that the tool you're using to forward connections from the Ipstack is functioning properly?
Activity
ple1n commentedon Dec 12, 2023
check_pkt_type seems buggy. The last packet should be ACKing the FIN but it's invalidated
ple1n commentedon Dec 12, 2023
I did a workaround. ple1n/ipstack@2dc5516
SajjadPourali commentedon Dec 12, 2023
I hope the problem is limited only to check_pkt_type because it would be easy to fix.
Could you please provide a pcap file and mention the OS that you use?
ple1n commentedon Dec 13, 2023
heres the cap of
curl example.comon linux 6.6.5-arch1-1 #1 SMP PREEMPT_DYNAMIC. https://github.com/planetoryd/misc/blob/master/cap_ipstack_rst.pcapng with https://github.com/ssrlive/ipstack/commit/df0765ab7636f7e9d2846b779bf412e15a205faawith dbg!s https://github.com/planetoryd/misc/blob/master/ipstack_logs.md
the workarounded version https://github.com/planetoryd/misc/blob/master/ipstack_workaround.pcapng has RST+ACKs, which should be RSTing the connection and immediate restablishment (i guess) . on ple1n/ipstack@2dc5516
If you see large captures it's me using it as some kind of daily driver. therefore just ask if you want any data, or testing. and I use geph.io 's proxy as upstream, which is a tor-bridge like proxy service (better than tor bridge in fact)
It looks quite terrifying to have that much unverified logic. perhaps you can try https://github.com/verus-lang/verus but idk how long it will take to become usable. some nice formal verification (unlikely)
SajjadPourali commentedon Dec 13, 2023
Fortunately, the logic is almost correct. There is only one minor issue that should not affect the communications, but it is indeed a bug! The IP stack deallocates the TCP stream after receiving the last FIN/ACK, so the final ACK goes unrecognized, which results in a RST being returned. In the correct implementation, it should handle the last ACK as well. However, in both cases—whether it returns an RST (the faulty behavior) or accepts the ACK without returning an RST — the connection will be closed.
Thanks for the report, I'll fix it soon. Did you see any other unexpected rst except the last ack for the first one?
I still did not checked your modifications on ple1n/ipstack@2dc5516 .
SajjadPourali commentedon Dec 13, 2023
@planetoryd: Could you please verify that if #7 fixes the issue?
ssrlive commentedon Dec 13, 2023
It's not fixed. @SajjadPourali
You can test
ipstackwith tun2socks5 under Linux. steps like thisple1n commentedon Dec 13, 2023
Yeah, the following RST got removed, when I did the curl again.
I open my browser, mozilla connects something. It constantly times out, RSTs the connections and reconnect immediately.
https://github.com/planetoryd/misc/blob/master/timeout.pcapng
ple1n commentedon Dec 13, 2023
SajjadPourali commentedon Dec 13, 2023
The timeout issue is manageable because I have hard-coded a 5-second timeout (which I intend to make configurable #4). Firefox keeps the connections open for reuse, and in some cases, this can result in them remaining open for more than 30 seconds.
SajjadPourali commentedon Dec 13, 2023
I'll set up a Linux machine over the weekend to test tun2socks5. In the meantime, if you could attach a .pcap file, I would be able to check it manually beforehand.
SajjadPourali commentedon Dec 13, 2023
I just changed the API to use a custom timeout and increased the TCP and UDP timeouts to 60 and 30, respectively, in the main branch.
SajjadPourali commentedon Dec 13, 2023
I used iperf3 on my personal machine through narrowlink's tunnel, which utilizes ipstack.
ple1n commentedon Dec 14, 2023
This time the apps actively tried to RST the connection (quite frequently). I was running
rustup update, and it failed 2 times before a success. fa94dacactive_rst.zip
Perhaps there is some issue with protocol compliance ?
SajjadPourali commentedon Dec 14, 2023
I can't guarantee that the Ipstack is fully compliant, but I am doing my best to implement it at least based on RFC 793. However, RFC 793 is missing some features (for example, it lacks TCP keep-alive functionality) and has some weaknesses. Therefore, the newer version of TCP is based on RFC 9293, which is more comprehensive and addresses the shortcomings of RFC 793.
TCP keep-alive has not been implemented yet #8 (it is also not defined in RFC 793). The screenshot you mentioned shows an attempt to send a TCP keep-alive packet, and since it does not receive an ACK after several attempts, it resets the connection.
Are you sure that the tool you're using to forward connections from the Ipstack is functioning properly?
ple1n commentedon Dec 14, 2023
(image shows direct connection to socks5 proxy)
It should be the keep-alive problem