[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-22 Thread Leonardo Mörlein

Change by Leonardo Mörlein :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue36069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-22 Thread Leonardo Mörlein

Leonardo Mörlein  added the comment:

Oh, you are correct. So this can be closed.

--

___
Python tracker 
<https://bugs.python.org/issue36069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-21 Thread Leonardo Mörlein

Leonardo Mörlein  added the comment:

It seems to be a regression, as my python 3.6 version is not affected:

lemoer@orange ~> python3.6 --version
Python 3.6.8

My python 3.7 version is affected:

lemoer@orange ~> python3.7 --version
Python 3.7.2

--

___
Python tracker 
<https://bugs.python.org/issue36069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-21 Thread Leonardo Mörlein

Leonardo Mörlein  added the comment:

The generated error is:

OSError: [Errno 22] Invalid argument

--

___
Python tracker 
<https://bugs.python.org/issue36069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-21 Thread Leonardo Mörlein

New submission from Leonardo Mörlein :

The tuple (host, port) is ("fe80::5054:01ff:fe04:3402%node4_client", 22) in 
https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L918. 
The substring "node4_client" identifies the interface, which is needed for link 
local connections.

The function self._ensure_resolved() is called and resolves to
infos[0][4] = ("fe80::5054:01ff:fe04:3402", 22, something, 93), where 93 is the 
resolved scope id (see sin6_scope_id from struct sockaddr_in6 from man ipv6).

Afterwards the self.sock_connect() is called with address = infos[0][4].   In 
self.sock_connect() the function self._ensure_resolved() is called again. In 
https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L1282 
the scope id is stripped from the tuple. The tuple (host, port) is now only 
("fe80::5054:01ff:fe04:3402", 22) and therefore the scope id is lost.

I wrote this quick fix, which is not really suitable as a real solution for the 
problem:

lemoer@orange ~> diff /usr/lib/python3.7/asyncio/base_events.py{.bak,}
--- /usr/lib/python3.7/asyncio/base_events.py.bak   2019-02-21 
18:42:17.060122277 +0100
+++ /usr/lib/python3.7/asyncio/base_events.py   2019-02-21 18:49:36.886866750 
+0100
@@ -942,8 +942,8 @@
 sock = None
 continue
 if self._debug:
-logger.debug("connect %r to %r", sock, address)
-await self.sock_connect(sock, address)
+logger.debug("connect %r to %r", sock, (host, port))
+await self.sock_connect(sock, (host, port))
 except OSError as exc:
 if sock is not None:
 sock.close()

------
components: asyncio
messages: 336253
nosy: Leonardo Mörlein, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: create_connection cannot handle IPv6 link-local addresses 
anymore (linux)
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue36069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com