RFC 4193 the site-local allocated range is fc00::/7.
Squid has been using IN6_IS_ADDR_SITELOCAL() but it turns out Linux and
OpenBSD at least still define that to test for the long obsolete fec0::/10.
bool
Ip::Address::IsSiteLocal6() const
{
- return IN6_IS_ADDR_SITELOCAL( &m_SocketAddr.sin6_addr );
+ // RFC 4193 the site-local allocated range is fc00::/7
+ // with fd00::/8 as the only currently allocated range (so we test it first).
+ // BUG: as of 2010-02 Linux and BSD define IN6_IS_ADDR_SITELOCAL() to check for fec::/10
+ return m_SocketAddr.sin6_addr.s6_addr[0] == static_cast<uint8_t>(0xfd) ||
+ m_SocketAddr.sin6_addr.s6_addr[0] == static_cast<uint8_t>(0xfc);
}
bool
bool IsLocalhost() const;
/** Test whether content is an IPv6 Site-Local address.
- \retval true if address begins with fe80::/10.
+ \retval true if address begins with fd00::/8.
\retval false if --disable-ipv6 has been compiled.
- \retval false if address does not match fe80::/10
+ \retval false if address does not match fd00::/8
*/
bool IsSiteLocal6() const;