PR_NetAddrToString() renders IPv4-mapped IPv6 addresses incorrectly

NEW
Assigned to

Status

NSPR
NSPR
10 years ago
10 years ago

People

(Reporter: Alex Fritze, Assigned: Wan-Teh Chang)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
The getnameinfo()-backed PR_NetAddrToString() implementation renders IPv4-mapped IPv6 addresses and IPv4-compatible addresses incorrectly as IPv4 addresses.

E.g. "::ffff:192.168.1.1" or "::192.168.1.1" are both rendered as "192.168.1.1".

The V6AddrToString()-backed version of PR_NetAddrToString(), on the other hand, renders the addresses as expected in IPv6 presentation format.

The problem here seems to be the behavior of getnameinfo: 
"If the socket address structure contains an IPv4-mapped IPv6 address or an IPv4-compatible IPv6 address, the implementation shall extract the embedded IPv4 address and lookup the node name for that IPv4 address."
You need to log in before you can comment on or make changes to this bug.