Opened 2 years ago

Closed 2 years ago

#25586 closed defect (fixed)

gethostbyaddr_r doesn't populate h_addrtype field of output hostent struct

Reported by: exarkun Owned by: dgoulet
Priority: Medium Milestone:
Component: Core Tor/Torsocks Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


The glibc implementation of gethostbyaddr_r will set h_addrtype to the address family that was passed in as an argument. Some programs depend on this (CPython is the one I noticed) for correct operation.

The current behavior leaves the field unchanged and likely provides an undefined value to the caller. In the case of CPython, this results in socket.gethostbyaddr always raising EAFNOSUPPORT.

Child Tickets

Attachments (1)

torsocks-h_addrtype.patch (2.0 KB) - added by exarkun 2 years ago.
unit tests and bug fix

Download all attachments as: .zip

Change History (3)

Changed 2 years ago by exarkun

Attachment: torsocks-h_addrtype.patch added

unit tests and bug fix

comment:1 Changed 2 years ago by exarkun

Status: newneeds_review

comment:2 Changed 2 years ago by dgoulet

Resolution: fixed
Status: needs_reviewclosed


Commit in a44660bd6d32de6c

Note: See TracTickets for help on using tickets.