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

test: udp_listen NULL #1100

Closed
wants to merge 2 commits into from
Closed

test: udp_listen NULL #1100

wants to merge 2 commits into from

Conversation

alfredh
Copy link
Contributor

@alfredh alfredh commented Apr 9, 2024

DRAFT

How should we handle if local address to udp_listen is NULL?
Example:

udp_listen(us, NULL, handler, arg);

For example Windows fails with:

Process completed with exit code 10014.

@alfredh alfredh marked this pull request as draft April 9, 2024 11:56
@sreimers
Copy link
Member

sreimers commented Apr 9, 2024

Process completed with exit code 10014.

Means: WSAEFAULT

The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a [sockaddr](https://learn.microsoft.com/en-us/windows/desktop/winsock/sockaddr-2) structure, is smaller than the sizeof(sockaddr).

Does this error belongs to socket or bind call?

@alfredh
Copy link
Contributor Author

alfredh commented Apr 10, 2024

The error comes from calling udp_send.

The problem is that when calling udp_listen with local=NULL, it will not bind to a specific address or AF.
Most of the time it binds to IPv6 socket.

Some platforms have the IPV6ONLY option enabled (e.g. MacOS, Windows, FreeBSD)
so it will not work to send a packet to IPv4 host here.

@alfredh alfredh closed this Apr 11, 2024
@alfredh
Copy link
Contributor Author

alfredh commented Apr 11, 2024

I am not sure its worth fixing this.

One option is to read the IPV6ONLY flag in case local=NULL.

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.

2 participants