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

The server sends the UDP packets via the wrong interface. #447

Open
TByte007 opened this issue Jul 26, 2024 · 1 comment
Open

The server sends the UDP packets via the wrong interface. #447

TByte007 opened this issue Jul 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@TByte007
Copy link

Describe the bug
When my brother (or whoever) connects on the outside interface this happens:
The packets are coming via home0 which has 10.0.0.1/24 network:
#:> tcpdump -ni home0 host 10.0.0.2 and port 21116
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on home0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
23:47:10.303677 IP 10.0.0.2.54467 > 10.0.0.1.21116: UDP, length 15
23:47:14.302891 IP 10.0.0.2.54467 > 10.0.0.1.21116: UDP, length 15

But are going out via aone0 which has the real IP to the ISP.

#:> tcpdump -ni aone0 host 10.0.0.2 and port 21116
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on aone0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
23:45:39.300826 IP 10.0.0.1.21116 > 10.0.0.2.50965: UDP, length 4
23:45:42.300950 IP 10.0.0.1.21116 > 10.0.0.2.50965: UDP, length 4

The only way to "fix" it is to restart the demons (hbbs/hbbr) and connect BEFORE my brother. Basically whoever is first only he can connect.
I'm guessing it somehow binds/connects the socket including the interface or i have no idea what is going on exactly.

Describe the environment
FreeBSD 14.0 router, no dockers or anything.
How to Reproduce the bug
explained in the description

Expected behavior
I should be able to connect from both the inside and the outside interfaces.

@TByte007 TByte007 added the bug Something isn't working label Jul 26, 2024
@sierja
Copy link

sierja commented Sep 2, 2024

I have confirmed this problem exists on the Docker based version of HBBS in host network mode as well.

@rustdesk
I think the problem is probably caused by the use of FramedSocket in handle_udp when it's listening on an unspecified address (0.0.0.0) then sending a reply as it's then left up to the OS to choose an interface. The workaround for those impacted by this bug is not to use Rustdesk HBBS with multiple interfaces/IPs.

When coding a fix, please consider those that need to have Rustdesk listening on multiple interfaces at the same time (as opposed to tying it to one interface/IP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants