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

Fix UDP source ip #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix UDP source ip #178

wants to merge 1 commit into from

Conversation

WGH-
Copy link

@WGH- WGH- commented Jan 1, 2025

Extract the destination IP address from incoming UDP packets, and use bind the local sockets to it to ensure we always reply from the same source as remote UDP peer used as destination to contact us. See #177 for concrete example of the problem.

I've tested this in following scenarios:

  • Ordinary global IPv6 addresses with privacy extensions enabled to ensure the problem described in Wrong source IP for UDP replies #177 is actually fixed.
  • Link-local IPv6 addresses to ensure that the scope id is properly handled.
  • IPv4-mapped IPv6 address (i.e. the server listens on [::]:51820, but the UDP peer "connects" over IPv4)
  • Native IPv4

Closes #177

@WGH- WGH- force-pushed the fix-udp-source-ip branch from dafce86 to 217de07 Compare January 1, 2025 21:43
@WGH- WGH- marked this pull request as ready for review January 1, 2025 21:44
This fixes an issue when phantun may choose a source IP different from
the destination IP in the incoming packet.

Closes dndx#177
@WGH- WGH- force-pushed the fix-udp-source-ip branch from 217de07 to 5b82789 Compare January 2, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong source IP for UDP replies
1 participant