wangyu- / udp2raw

A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
MIT License
7.36k stars 1.17k forks source link

stuck in client_handshake1 #544

Closed iopq closed 6 days ago

iopq commented 1 week ago

local log:

[2024-11-21 16:59:24][INFO]argc=13 /run/current-system/sw/bin/udp2raw -c -l 127.0.0.1:50001 -r ...:443 -k  ... --raw-mode faketcp --auth-mode hmac_sha1 -a 
[2024-11-21 16:59:24][INFO]parsing address: 127.0.0.1:50001
[2024-11-21 16:59:24][INFO]its an ipv4 adress
[2024-11-21 16:59:24][INFO]ip_address is {127.0.0.1}, port is {50001}
[2024-11-21 16:59:24][INFO]parsing address: ...:443
[2024-11-21 16:59:24][INFO]its an ipv4 adress
[2024-11-21 16:59:24][INFO]ip_address is {...}, port is {443}
[2024-11-21 16:59:24][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=hmac_sha1 key=56w43lhyu local_addr=127.0.0.1:50001 remote_addr=...:443 socket_buf_size=1048576 
[2024-11-21 16:59:24][WARN]you can run udp2raw with non-root account for better security. check README.md in repo for more info.
[2024-11-21 16:59:24][INFO]remote_ip=[...], make sure this is a vaild IP address
[2024-11-21 16:59:24][INFO]const_id:50cd81bc
[2024-11-21 16:59:24][INFO]run_command iptables -N udp2rawDwrW_50cd81bc_C0
[2024-11-21 16:59:24][INFO]run_command iptables -F udp2rawDwrW_50cd81bc_C0
[2024-11-21 16:59:24][INFO]run_command iptables -I udp2rawDwrW_50cd81bc_C0 -j DROP
[2024-11-21 16:59:24][INFO]run_command iptables -I INPUT -s ... -p tcp -m tcp --sport 443 -j udp2rawDwrW_50cd81bc_C0
[2024-11-21 16:59:24][WARN]auto added iptables rules
[2024-11-21 16:59:24][INFO]source_addr is now 192.168.2.211
[2024-11-21 16:59:24][INFO]using port 57953
[2024-11-21 16:59:24][INFO]state changed from client_idle to client_tcp_handshake
/build/source/network.cpp:1717:11: runtime error: null pointer passed as argument 2, which is declared to never be null
[2024-11-21 16:59:24][INFO](re)sent tcp syn
[2024-11-21 16:59:24][INFO]new packet from 127.0.0.1:51820,conv_id=b9882ab5
[2024-11-21 16:59:24][INFO]state changed from client_tcp_handshake to client_handshake1
[2024-11-21 16:59:24][INFO](re)sent handshake1
[2024-11-21 16:59:25][INFO](re)sent handshake1
[2024-11-21 16:59:27][INFO](re)sent handshake1
[2024-11-21 16:59:28][INFO](re)sent handshake1
[2024-11-21 16:59:29][INFO](re)sent handshake1
[2024-11-21 16:59:29][INFO]state back to client_idle from client_handshake1
[2024-11-21 16:59:30][INFO]source_addr is now 192.168.2.211
[2024-11-21 16:59:30][INFO]using port 10858
[2024-11-21 16:59:30][INFO]state changed from client_idle to client_tcp_handshake
[2024-11-21 16:59:30][INFO](re)sent tcp syn
[2024-11-21 16:59:30][INFO]state changed from client_tcp_handshake to client_handshake1
[2024-11-21 16:59:30][INFO](re)sent handshake1
[2024-11-21 16:59:31][INFO](re)sent handshake1
[2024-11-21 16:59:32][INFO](re)sent handshake1
[2024-11-21 16:59:33][INFO](re)sent handshake1
[2024-11-21 16:59:35][INFO](re)sent handshake1
[2024-11-21 16:59:35][INFO]state back to client_idle from client_handshake1
[2024-11-21 16:59:35][INFO]source_addr is now 192.168.2.211
[2024-11-21 16:59:35][INFO]using port 14802
[2024-11-21 16:59:35][INFO]state changed from client_idle to client_tcp_handshake
[2024-11-21 16:59:35][INFO](re)sent tcp syn
[2024-11-21 16:59:36][INFO]state changed from client_tcp_handshake to client_handshake1
[2024-11-21 16:59:36][INFO](re)sent handshake1
[2024-11-21 16:59:37][INFO](re)sent handshake1

server log

[2024-11-21 08:58:21][INFO]argc=13 udp2raw -s -l 10.2.186.236:443 -r 127.0.0.1:51822 -k ... --raw-mode faketcp --auth-mode hmac_sha1 -a 
[2024-11-21 08:58:21][INFO]parsing address: 10.2.186.236:443
[2024-11-21 08:58:21][INFO]its an ipv4 adress
[2024-11-21 08:58:21][INFO]ip_address is {10.2.186.236}, port is {443}
[2024-11-21 08:58:21][INFO]parsing address: 127.0.0.1:51822
[2024-11-21 08:58:21][INFO]its an ipv4 adress
[2024-11-21 08:58:21][INFO]ip_address is {127.0.0.1}, port is {51822}
[2024-11-21 08:58:21][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=hmac_sha1 key=56w43lhyu local_addr=10.2.186.236:443 remote_addr=127.0.0.1:51822 socket_buf_size=1048576 
[2024-11-21 08:58:21][WARN]you can run udp2raw with non-root account for better security. check README.md in repo for more info.
[2024-11-21 08:58:21][INFO]remote_ip=[127.0.0.1], make sure this is a vaild IP address
[2024-11-21 08:58:21][INFO]const_id:a9531e41
[2024-11-21 08:58:22][INFO]run_command iptables -N udp2rawDwrW_a9531e41_C0
[2024-11-21 08:58:22][INFO]run_command iptables -F udp2rawDwrW_a9531e41_C0

remote config

# local settings for Endpoint B
[Interface]
PrivateKey = ...
Address = 10.0.0.2/32
ListenPort = 51822

# receive wg through udp2raw
MTU = 1342
PreUp = udp2raw -s -l 10.2.186.236:443 -r 127.0.0.1:51822 -k "..." --raw-mode faketcp --auth-mode hmac_sha1 -a >/var/log/udp2raw.log 2>&1 &
PostDown = killall udp2raw || true

# remote settings for Endpoint A
[Peer]
PublicKey = ...
AllowedIPs = 10.0.0.1/32

remote log

[2024-11-21 08:58:22][INFO]run_command iptables -I udp2rawDwrW_a9531e41_C0 -j DROP
[2024-11-21 08:58:22][INFO]run_command iptables -I INPUT -d 10.2.186.236 -p tcp -m tcp --dport 443 -j udp2rawDwrW_a9531e41_C0
[2024-11-21 08:58:22][WARN]auto added iptables rules
[2024-11-21 08:58:22][INFO]now listening at 10.2.186.236:443
[2024-11-21 08:59:24][INFO][...:5416]received syn,sent syn ack back
[2024-11-21 08:59:30][INFO][...:5588]received syn,sent syn ack back
[2024-11-21 08:59:35][INFO][...:5809]received syn,sent syn ack back
[2024-11-21 08:59:41][INFO][...:5929]received syn,sent syn ack back
[2024-11-21 08:59:47][INFO][...:6090]received syn,sent syn ack back
iopq commented 1 week ago

I tested:

  1. Just running the udp2raw command directly and it still got stuck in handshake
  2. Running it from a VPS and trying to connect and I got the same issue
iopq commented 6 days ago

https://www.reddit.com/r/WireGuard/comments/lxddyt/til_udp2raw_tunneling_pitfall/

rp_filter needs to be set to 0 on the server

now I can connect from my other VPS, but not from my machine, so I'm running into a separate issue

iopq commented 6 days ago

/build/source/network.cpp:1717:11: runtime error: null pointer passed as argument 2, which is declared to never be null

this was the issue, something with the packaging of the binary