In /includes/functions.php we have function short_ipv6(). It will expand a compressed IPv6 (i.e. from "FADE:BAD::" to "FADE:BAD:0000:0000:0000:0000:0000:0000" in order to be able to return as many words (hexadecatets) as requested.
However, the expansion will invalidate the address if it's one with an embedded IPv4, i.e. "FADE:BAD::192.168.0.1" will become "FADE:BAD:0000:0000:0000:0000:0000:0000:192.168.0.1".
The solution is to first check for an IPv4 and replace that with two appropriate words:
Find
function short_ipv6($ip, $length)
|
{
|
if ($length < 1)
|
{
|
return '';
|
}
|
// IPv6 with embedded IPv4
|
$sOctet= '([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])';
|
if( preg_match( "#$sOctet\\.$sOctet\\.$sOctet\\.$sOctet#", $ip, $aMatch ) ) {
|
$sReplace= sprintf( '%02x%02x:%02x%02x', $aMatch[1], $aMatch[2], $aMatch[3], $aMatch[4] );
|
$ip= str_replace( $aMatch[0], $sReplace, $ip );
|
}
|