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: provide a way to figure out a port that is not yet listened on #496

Open
hannesm opened this issue Oct 21, 2022 · 0 comments
Open

UDP: provide a way to figure out a port that is not yet listened on #496

hannesm opened this issue Oct 21, 2022 · 0 comments

Comments

@hannesm
Copy link
Member

hannesm commented Oct 21, 2022

@reynir mentioned in mirage/ocaml-dns#322 (review):

I am a little concerned that generate_udp_port doesn't check that nothing is listening on the generated port. The interface of UDP.listen always replaces an existing listener. An application that uses DNS and listens on UDP may eventually break because a dns lookup triggered generate_udp_port to generate the application port. However, with the current interface I can't see how we can do better.

I suggested: maybe as simple as providing a free_port in the interface. But indeed it may be a bit more tricky to avoid TOCTOU. Maybe there should instead be a listen that outputs a port (and allows a range being specified).

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

No branches or pull requests

1 participant