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

bpo-45883: Re-add reuse_address parameter to create_server #29733

Merged
merged 2 commits into from Dec 12, 2021

Conversation

jcrist
Copy link
Contributor

@jcrist jcrist commented Nov 23, 2021

This parameter was accidentally removed as part of #28207 when fixing https://bugs.python.org/issue45129, this reverts the unnecessary changes there.

https://bugs.python.org/issue45883

This parameter was accidentally removed when fixing
https://bugs.python.org/issue45129, this reverts the unnecessary changes
there.
@arhadthedev
Copy link
Member

The purpose of #28207 was not to make the parameter undocumented but to remove it altogether; so nothing looks accidental there. In that pull request, asyncio-eventloop.rst had the following explanation why reuse_address was first documented as deprecated, then turned into a stub that just throws exception, and finally was removed:

When multiple processes with differing UIDs assign sockets to an identical UDP socket address with SO_REUSEADDR, incoming packets can become randomly distributed among the sockets.

In other words, the whole feature allowed to tap into a socket of another server and intercept random packets sent to it from its clients.

@jcrist
Copy link
Contributor Author

jcrist commented Nov 23, 2021

Right, I understand that. But it was only deprecated/documented as deprecated for create_datagram_endpoint, that PR mistakenly also removed it for create_server where it was never deprecated.

@arhadthedev
Copy link
Member

arhadthedev commented Nov 23, 2021

Ah, right, my bad. I don't know why it came to be that "reuse_address" =="the whole idea of shared binding". The PR really directly says that:

Due to significant security concerns, the reuse_address parameter of →→asyncio.loop.create_datagram_endpoint←← [...]

Edit: your bugs.python.org entry that I, of course, did not read already explains a nature of the mistake. Twice my bad.

@asvetlov asvetlov merged commit f3c16a5 into python:main Dec 12, 2021
3 checks passed
@asvetlov
Copy link
Contributor

Thanks @jcrist !

asvetlov referenced this pull request Dec 12, 2021
Due to significant security concerns, the reuse_address parameter of
asyncio.loop.create_datagram_endpoint, deprecated in Python 3.9, is
now removed. This is because of the behavior of the socket option
SO_REUSEADDR in UDP.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@jcrist jcrist deleted the readd-reuse-address branch December 12, 2021 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants