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: socketmodule.c: fix for platforms w/o IPV6 (i.e.Solaris 5.7)
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: loewis, matt979
Priority: normal Keywords: patch

Created on 2003-11-19 18:36 by matt979, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
socketmodule.patch matt979, 2003-12-05 19:40 patch for socketmodule.c (r232 cvs tag)
Messages (4)
msg44906 - (view) Author: Matthew Bachmann (matt979) Date: 2003-11-19 18:36
Fixes Bug #818490

socketmodule.c will not compile on platforms without 
IPV6 support such as Solaris 5.7 because the AF_INET6 
and INET_ADDRSTRLEN are used outside the 
ENABLE_IPV6 guarded sections. 

For example (lines 2971-2977):

#ifndef ENABLE_IPV6
    if(af == AF_INET6) {
        PyErr_SetString(socket_error,
                "can't use AF_INET6, IPv6 is disabled");
        return NULL;
    }
#endif

The code is putting error checking in when IPV6 is not 
supported, but it is using the AF_INET6 define which 
does not exist on platforms w/o IPV6.  

I simply removed the block and let the check fall to the 
inet_pton call.

I'm not so clear as what to do w/ INET_ADDRSTRLEN
define because I'm not knowledgable about its history.
At least under Solaris, INET_ADDRSTRLEN along with 
INET6_ADDRSTRLEN only appear w/ IPV6 support.

In the patch, I simply substituted it with 16 which is the 
value.  Since its just the number of characters in a 
dotted IP address, it seems like it would be pretty 
constant accross platforms.

The diff given is against the r232 cvs tag.

msg44907 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-12-05 19:13
Logged In: YES 
user_id=21627

The patch is incorrect: The block checking for AF_INET6
should not be removed. On some systems, AF_INET6 might be
available, and using it with disabled IPv6 should cause an
exception.

Instead, you should check whether AF_INET6 is defined also.
msg44908 - (view) Author: Matthew Bachmann (matt979) Date: 2003-12-05 19:40
Logged In: YES 
user_id=912994

Sounds good.  I guarded that code with:

#if ! defined(ENABLE_IPV6) && defined(AF_INET6)

Uploaded attached new patch.
msg44909 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-18 12:54
Logged In: YES 
user_id=21627

Somethink like this has been committed as socketmodule.c 1.290.
History
Date User Action Args
2022-04-11 14:56:01adminsetgithub: 39568
2003-11-19 18:36:59matt979create