This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: socket.getaddrinfo() bug for IPv6 enabled platforms
Type: behavior Stage: test needed
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: biot, giampaolo.rodola, rganesan
Priority: normal Keywords:

Created on 2005-09-06 04:46 by rganesan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
gai.c biot, 2009-10-06 10:55 getaddrinfo() test
Messages (3)
msg60807 - (view) Author: Ganesan Rajagopal (rganesan) Date: 2005-09-06 04:46
======
getaddrinfo(host, port[, family[, socktype[, proto[,
flags]]]])
    Resolves the host/port argument, into a sequence of
5-tuples that contain all the necessary argument for
the sockets manipulation. host is a domain name, a
string representation of IPv4/v6 address or None. port
is a string service name (like 'http'), a numeric port
number or None.
======

On Linux (and FreeBSD and probably other IPv6 enabled
hosts), port as a number raises a socket exception

======
 $ python2.4
Python 2.4.1 (#2, May  5 2005, 11:32:06)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import socket
>>> socket.getaddrinfo('6bone.net', 'http')
[(10, 1, 6, '', ('2001:5c0:0:2::24', 80, 0, 0)), (2, 1,
6, '', ('209.71.226.24', 80))]
>>> socket.getaddrinfo('6bone.net', 80)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
socket.gaierror: (-8, 'Servname not supported for
ai_socktype')
======

Since, on Windows 2003 Server (no IPv6) and Solaris 2.8
(no IPv6), the call works correctly, I am filing this
bug as platform specific.
msg93639 - (view) Author: Bert Vermeulen (biot) Date: 2009-10-06 10:55
This is not a python bug, but a bug in the underlying libc. A simple
getaddrinfo() call in C exhibits the exact same behavior. It has been
fixed at some point; I see this bug on Centos 3.3 but not on Centos 4.4,
for example.

I've attached a small C demo that will fail on Centos 3.3, but work on
more recent platforms.
msg113907 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-08-14 15:18
I agree with Bert that this is not a Python issue hence I'm closing this out as invalid.
Btw, the libc version in which this has been fixed should be 2.1.2:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=52195
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42345
2010-08-14 15:18:54giampaolo.rodolasetstatus: open -> closed

nosy: + giampaolo.rodola
messages: + msg113907

resolution: not a bug
2009-10-06 10:55:45biotsetfiles: + gai.c
nosy: + biot
messages: + msg93639

2009-02-16 00:27:52ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6
2005-09-06 04:46:23rganesancreate