Bug #48594 the function inet_aton delivers NULL if IP is IPv6
Submitted: 6 Nov 2009 8:43 Modified: 6 Nov 2009 18:58
Reporter: Horst Hunger Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:6.0-codebase OS:Any
Assigned to: CPU Architecture:Any

[6 Nov 2009 8:43] Horst Hunger
Description:
While the sequence

SET @nip= inet_aton('127.0.0.1');
SELECT @nip;

is working well,

SET @nip= inet_aton('127.0.0.1');
SELECT @nip;
@nip
2130706433

the same sequence with IPv6 delivers NULL. E.g. "::1"

SET @nip= inet_aton('::1');
SELECT @nip;

results in

SET @nip= inet_aton('::1');
SELECT @nip;
@nip
NULL

How to repeat:
set "--skip-name-resilve",
execute the statements above with mtr or mysql.
Try also IP = 0:0:0:0:0:0:0:1 which is only another format of IPv6.
[6 Nov 2009 8:53] Horst Hunger
see also bug#48595.
[6 Nov 2009 11:57] Valeriy Kravchuk
Verified just as described with recent mysql-6.0-codebase from bzr on Linux.
[6 Nov 2009 11:58] MySQL Verification Team
Thank you for the bug report.

mysql> SET @nip= inet_aton('::1');
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @nip;
+------+
| @nip |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
[6 Nov 2009 18:41] Davi Arnaut
::1 is not a dotted-quad representation of a network address. Please re-verify with the documentation of the function in mind.
[6 Nov 2009 18:57] Valeriy Kravchuk
What about implementation of inet_ntop and inet_pton then, that works both with IPV4 and IPV6 addresses?
[6 Nov 2009 19:00] Valeriy Kravchuk
OK, so this is a duplicate of Bug #34037.