savetheinternet / Tinyboard

The better imageboard software

Home Page:http://tinyboard.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error banning IPv6 address.

seisatsu opened this issue · comments

When attempting to ban an IPv6 address at http://mysite.net/mod.php/ban?/ban, an error is received.

inet_ntop(): Invalid in_addr value when banning ffff:ffff:fff:ffff:ffff:ffff:ffff

(address masked in above message to protect user)

This actually isn't a valid IPv6 address, since it doesn't have 8x 16 bytes.

If you meant a real IPv6 address, it may also mean, that your php wasn't
build with IPv6 support, as per http://pl1.php.net/inet_ntop:

This function converts a 32bit IPv4, or 128bit IPv6 address (if PHP was

built with IPv6 support enabled) into an address family appropriate string
representation.

Try to run the following code on your server to check that:

<?php
$packed = chr(127) . chr(0) . chr(0) . chr(1);
$expanded = inet_ntop($packed);

/* Outputs: 127.0.0.1 */
echo $expanded;

$packed = str_repeat(chr(0), 15) . chr(1);
$expanded = inet_ntop($packed);

/* Outputs: ::1 */
echo $expanded;
?>

On Tue, Jan 28, 2014 at 3:57 AM, Michael D. Reiley <notifications@github.com

wrote:

When attempting to ban an IPv6 address at
http://mysite.net/mod.php/ban?/ban, an error is received.

inet_ntop(): Invalid in_addr value when banning
ffff:ffff:fff:ffff:ffff:ffff:ffff

(address masked in above message to protect user)


Reply to this email directly or view it on GitHubhttps://github.com//issues/160
.

My mod missed a segment when typing it in. Now I feel silly.