Skip to content
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

socketmodule.c: fix for platforms w/o IPV6 (i.e.Solaris 5.7) #39568

Closed
matt979 mannequin opened this issue Nov 19, 2003 · 4 comments
Closed

socketmodule.c: fix for platforms w/o IPV6 (i.e.Solaris 5.7) #39568

matt979 mannequin opened this issue Nov 19, 2003 · 4 comments
Labels
extension-modules C modules in the Modules dir

Comments

@matt979
Copy link
Mannequin

matt979 mannequin commented Nov 19, 2003

BPO 845306
Nosy @loewis
Files
  • socketmodule.patch: patch for socketmodule.c (r232 cvs tag)
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2004-08-18.12:54:43.000>
    created_at = <Date 2003-11-19.18:36:59.000>
    labels = ['extension-modules']
    title = 'socketmodule.c: fix for platforms w/o IPV6 (i.e.Solaris 5.7)'
    updated_at = <Date 2004-08-18.12:54:43.000>
    user = 'https://bugs.python.org/matt979'

    bugs.python.org fields:

    activity = <Date 2004-08-18.12:54:43.000>
    actor = 'loewis'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2003-11-19.18:36:59.000>
    creator = 'matt979'
    dependencies = []
    files = ['5694']
    hgrepos = []
    issue_num = 845306
    keywords = ['patch']
    message_count = 4.0
    messages = ['44906', '44907', '44908', '44909']
    nosy_count = 2.0
    nosy_names = ['loewis', 'matt979']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue845306'
    versions = ['Python 2.3']

    @matt979
    Copy link
    Mannequin Author

    matt979 mannequin commented Nov 19, 2003

    Fixes Bug bpo-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.

    @matt979 matt979 mannequin closed this as completed Nov 19, 2003
    @matt979 matt979 mannequin added the extension-modules C modules in the Modules dir label Nov 19, 2003
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Dec 5, 2003

    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.

    @matt979
    Copy link
    Mannequin Author

    matt979 mannequin commented Dec 5, 2003

    Logged In: YES
    user_id=912994

    Sounds good. I guarded that code with:

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

    Uploaded attached new patch.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Aug 18, 2004

    Logged In: YES
    user_id=21627

    Somethink like this has been committed as socketmodule.c 1.290.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants