8000 bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR by aeros · Pull Request #17311 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR #17311

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

Merged
Prev Previous commit
Next Next commit
Deprecate reuse_address=False
Co-authored-by: Yury Selivanov <yury@edgedb.com>
  • Loading branch information
aeros and 1st1 committed Dec 3, 2019
commit b83052e58d56e3e11c567b184992762b96ed97d4
24 changes: 17 additions & 7 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
# Maximum timeout passed to select to avoid OS limitations
MAXIMUM_SELECT_TIMEOUT = 24 * 3600

# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s
# *reuse_address* parameter
_unset = object()


def _format_handle(handle):
cb = handle._callback
Expand Down Expand Up @@ -1230,7 +1234,7 @@ async def start_tls(self, transport, protocol, sslcontext, *,
async def create_datagram_endpoint(self, protocol_factory,
local_addr=None, remote_addr=None, *,
family=0, proto=0, flags=0,
reuse_address=None, reuse_port=None,
reuse_address=_unset, reuse_port=None,
allow_broadcast=None, sock=None):
"""Create datagram connection."""
if sock is not None:
Expand Down Expand Up @@ -1306,12 +1310,18 @@ async def create_datagram_endpoint(self, protocol_factory,

exceptions = []

if reuse_address:
# bpo-37228
raise ValueError("Passing `reuse_address=True` is no "
"longer support 6871 ed, as the usage of "
"SO_REUSEPORT in UDP poses a significant "
"security concern.")
# bpo-37228
if reuse_address is not _unset:
if reuse_address:
raise ValueError("Passing `reuse_address=True` is no "
"longer supported, as the usage of "
"SO_REUSEPORT in UDP poses a significant "
"security concern.")
else:
warnings.warn("The *reuse_address* parameter has been "
"deprecated as of 3.5.10 and is scheduled "
"for removal in 3.11.", DeprecationWarning,
stacklevel=2)

for ((family, proto),
(local_address, remote_address)) in addr_pairs_info:
Expand Down
0