Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP tunnel fails to deliver message #420

Open
niowniow opened this issue Mar 26, 2025 · 0 comments
Open

UDP tunnel fails to deliver message #420

niowniow opened this issue Mar 26, 2025 · 0 comments
Labels

Comments

@niowniow
Copy link

Describe the bug

I'm trying to tunnel UDP traffic between two servers. The logs show that wstunnel establishes a connection, however the UDP message does not reach it's destination. If I replace the UDP tunnel with a TCP tunnel (and a http server) it works.

To Reproduce

On Server A

./wstunnel server --restrict-to localhost:8000 wss://[::]:8045

In a new terminal

nc -u -l -k -p 8000 -v

In a new terminal

echo "Test message" | nc -u 127.0.0.1 8000
# Sanity check. Works as expected, also multiple times

On Server B

echo "Test message from server B (directly)" | nc -u IP.OF.SERVER.A 8000
# Another check. works as expected

In a new terminal

./wstunnel client -L "udp://8000:localhost:8000" wss://IP.OF.SERVER.A:8045

In a new terminal

echo "Test message from server B" | nc -u 127.0.0.1 8000
# No message can be seen on the receiving end

Expected behavior

The UDP message is received on Server A

Your wstunnel setup

client

 ./wstunnel client -L "udp://8000:localhost:8000" wss://IP.OF.SERVER.A:8045 
2025-03-26T06:24:58.136967Z  INFO wstunnel: Starting wstunnel client v10.1.10
2025-03-26T06:24:58.137020Z  INFO wstunnel::protocols::udp::server: Starting UDP server listening cnx on 127.0.0.1:8000 with cnx timeout of 30s
2025-03-26T06:25:06.115385Z  INFO wstunnel::protocols::udp::server: New UDP connection from 127.0.0.1:51690
2025-03-26T06:25:06.115685Z  INFO wstunnel::protocols::tcp::server: Opening TCP connection to IP.OF.SERVER.A:8045    
2025-03-26T06:25:06.153938Z  INFO wstunnel::protocols::tls::server: Doing TLS handshake using SNI IpAddress(V4(Ipv4Addr([XX, XX, XX, XX]))) with the server IP.OF.SERVER.A:8045

server

./wstunnel server --restrict-to localhost:8000 wss://[::]:8045
2025-03-26T06:24:53.658417Z  INFO wstunnel::embedded_certificate: Generating self-signed tls certificate    
2025-03-26T06:24:53.659882Z  INFO wstunnel: Starting wstunnel server v10.1.10 with config WsServerConfig { socket_so_mark: SoMark { inner: None }, bind: [::]:8045, websocket_ping_frequency: Some(30s), timeout_connect: 10s, websocket_mask_frame: false, restriction_config: None, tls: true, remote_server_idle_timeout: 180s, mTLS: false }
2025-03-26T06:24:53.659992Z  INFO wstunnel::tunnel::server::server: Starting wstunnel server listening on [::]:8045
2025-03-26T06:25:06.178276Z  INFO cnx{peer="[::ffff:IP.OF.SERVER.B]:53026"}: wstunnel::tunnel::server::server: Accepting connection
2025-03-26T06:25:06.178545Z  INFO cnx{peer="[::ffff:IP.OF.SERVER.B]:53026"}: wstunnel::tunnel::server::server: Doing TLS handshake
2025-03-26T06:25:06.219107Z  INFO cnx{peer="[::ffff:IP.OF.SERVER.B]:53026"}:tunnel{id="0195d120-3e43-7ee1-9012-d9d11e568e84" remote="localhost:8000"}: wstunnel::tunnel::server::server: Tunnel accepted due to matched restriction: Allow All
2025-03-26T06:25:06.219194Z  INFO cnx{peer="[::ffff:IP.OF.SERVER.B]:53026"}:tunnel{id="0195d120-3e43-7ee1-9012-d9d11e568e84" remote="localhost:8000"}: wstunnel::protocols::udp::server: Opening UDP connection to localhost:8000
2025-03-26T06:25:06.219690Z  INFO cnx{peer="[::ffff:IP.OF.SERVER.B]:53026"}:tunnel{id="0195d120-3e43-7ee1-9012-d9d11e568e84" remote="localhost:8000"}: wstunnel::tunnel::server::server: connected to Udp { timeout: Some(30s) } localhost:8000

Desktop (please complete the following information):

Linux serverA 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC x86_64 x86_64 x86_64 GNU/Linux
Linux serverB 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC x86_64 x86_64 x86_64 GNU/Linux

Additional context
I saw issue #380, however using version 9.7.4. also fails in this situation.

@niowniow niowniow added the bug label Mar 26, 2025
@niowniow niowniow changed the title Short description of the issue UDP tunnel fails to deliver message Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant