[Python-bugs-list] [ python-Bugs-618594 ] Connecting to IPv4 addrs from IPv6 socke

noreply@sourceforge.net noreply@sourceforge.net
Sun, 06 Oct 2002 23:39:46 -0700


Bugs item #618594, was opened at 2002-10-04 17:08
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=618594&group_id=5470

Category: Extension Modules
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jesús Cea Avión (jcea)
Assigned to: Nobody/Anonymous (nobody)
Summary: Connecting to IPv4 addrs from IPv6 socke

Initial Comment:
You can connect to a IPv4 addr "a.b.c.d" from a IPv6
socket simply connecting to "::FFFF:a.b.c.d" IPv6 address.

When you issue a "connect" call on a IPv6 socket using
a pure IPv4 addr "a.b.c.d", this format SHOULD be
converted "automagically" to "::FFFF:a.b.c.d",
intenally. Currently, this operation gives an error.

The real problem is "connect" call using a hostname
(not resolved to a IPv4 or IPv6 addr). Since I don't
know to which IP address type the host will resolve, I
think the correct course should be to promote IPv4 to
IPv6 address space (if the socket is IPv6) and to
connect normally.

Obviously, trying to connect to a IPv6 addr using a
IPv4 socket should fail, like just now.

When a hostname used in "connect" call resolves to both
IPv4 and IPv6 addresses, it would use IPv4 if the
socket is IPv4, and IPv6 if the socket is IPv6.

----------------------------------------------------------------------

Comment By: Jesús Cea Avión (jcea)
Date: 2002-10-07 08:39

Message:
Logged In: YES 
user_id=97460

The problem, as I said, is when you use a hostname in the
"connect" call. Since the program has no control over the
address type the DNS lookup will resolve, I, in my soft,
can't search for colons in order to create IF_INET or
IF_INET6 sockets, since that info is processed inside the
"connect" call.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-10-05 12:11

Message:
Logged In: YES 
user_id=21627

I fail to see a Python bug here. All calls are delegated to
the C library, which delegates most of it to the kernel. So
complain to your operating system vendor.

I don't think your complaint is valid, though: the sockaddr
is computed by looking at its format. If it does not
contains a colon, it is not an AF_INET6.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=618594&group_id=5470