classification
Title: Incorrect use of flowinfo and scope_id in IPv6 sockaddr tuple
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: exarkun, giampaolo.rodola, loewis, neologix, python-dev, vnebehaj
Priority: normal Keywords: patch

Created on 2010-09-28 18:35 by vnebehaj, last changed 2012-01-03 16:51 by neologix. This issue is now closed.

Files
File name Uploaded Description Edit
python_flowinfo.patch vnebehaj, 2010-09-28 18:35 review
Messages (3)
msg117540 - (view) Author: Vilmos Nebehaj (vnebehaj) Date: 2010-09-28 18:35
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.
msg150457 - (view) Author: Roundup Robot (python-dev) Date: 2012-01-02 14:58
New changeset 0c10061df711 by Charles-François Natali in branch '2.7':
Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by
http://hg.python.org/cpython/rev/0c10061df711

New changeset cc346a672091 by Charles-François Natali in branch '3.2':
Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by
http://hg.python.org/cpython/rev/cc346a672091

New changeset 9222b8e7a7bc by Charles-François Natali in branch 'default':
Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by
http://hg.python.org/cpython/rev/9222b8e7a7bc
msg150515 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012-01-03 16:51
Should be fixed now.
Vilmos, thanks for the patch!
History
Date User Action Args
2012-01-03 16:51:56neologixsetstatus: open -> closed
resolution: fixed
messages: + msg150515

stage: patch review -> resolved
2012-01-02 14:58:02python-devsetnosy: + python-dev
messages: + msg150457
2011-12-16 11:33:47pitrousetnosy: + neologix
2011-01-04 01:04:31pitrousetnosy: + exarkun
2010-09-29 10:01:12pitrousetnosy: + loewis
stage: patch review

versions: + Python 3.1, Python 3.2
2010-09-29 02:08:31r.david.murraysetnosy: + giampaolo.rodola
2010-09-28 18:35:44vnebehajcreate