mirror of
https://git.musl-libc.org/git/musl
synced 2026-01-27 09:54:49 +00:00
v4-compatible addresses in ipv6 are a deprecated feature where the high 96 bits are all zero and an ipv4 address is stored in the low 32 bits. however, since :: and ::1 are the unspecified and loopback addresses, these two particular values are excluded from the definition of the v4-compat class. our version of the macro incorrectly assessed this condition by checking only the high 96 and low 8 bits. this incorrectly excluded the v4compat version of any ipv4 address ending in .1, not just ::1. rather than writing out non-obvious or error-prone conditions on the individual address bytes, just express the "not :: or ::1" condition naturally using the existing IN6_IS_ADDR_UNSPECIFIED and IN6_IS_ADDR_LOOPBACK macros, after checking that the high 96 bits are all zero. any vaguely reasonable compiler will collapse out the redundant tests of the upper bits as part of CSE.