[New-bugs-announce] [issue9975] Incorrect use of flowinfo and scope_id in IPv6 sockaddr tuple

Vilmos Nebehaj report at bugs.python.org
Tue Sep 28 20:35:46 CEST 2010

New submission from Vilmos Nebehaj <v.nebehaj at gmail.com>:

Module/socketmodule.c incorrectly treats both sockaddr_in6->sin6_flowinfo and sockaddr_in6->sin6_scope_id as signed integers.  They are 32-bit unsigned integers (even though sin6_flowinfo is just 20 bits).

sin6_flowinfo also lacks the necessary endian conversions when an IPv6 sockaddr tuple is parsed or returned.  This makes it difficult to deal with sockets using sin6_flowinfo and deviates from RFCs.  With the use of a signed int it also makes impossible to use flowinfo values that are larger than 2^31 if converted to little endian byte order (socketmodule.c raising an overflow exception).

sin6_scope_id has meaning only on the local machine (as an interface index), thus no endian conversion is needed for it.

components: Library (Lib)
files: python_flowinfo.patch
keywords: patch
messages: 117540
nosy: vnebehaj
priority: normal
severity: normal
status: open
title: Incorrect use of flowinfo and scope_id in IPv6 sockaddr tuple
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file19049/python_flowinfo.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list