Bug #5448 INET_ATON : Short-Form IP Handling
Submitted: 7 Sep 2004 12:32 Modified: 7 Sep 2004 14:23
Reporter: Mohamed Sayeh Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:3.23.58 OS:Linux (Fedora C2)
Assigned to: CPU Architecture:Any
Triage: D4 (Minor)

[7 Sep 2004 12:32] Mohamed Sayeh
Description:
Salam All,
For the function INET_ATON(expr) dcoumentation, you are giving this example:

mysql> SELECT INET_ATON('127.0.0.1'), INET_ATON('127.1');
-> 2130706433, 2130706433

while the actual result I always get is:

mysql> SELECT INET_ATON('127.0.0.1'), INET_ATON('127.1');

+------------------------+--------------------+
| INET_ATON('127.0.0.1') | INET_ATON('127.1') |
+------------------------+--------------------+
|             2130706433 |              32513 |
+------------------------+--------------------+

This means that INET_ATON('127.0.0.1') and INET_ATON('127.1') are not equal !!!

INET_ATON('1.1') gives 257 .
This means that the short-form IP string is parsed from right to left.
I have MySQL 3.23.58 .
Please, correct the example in the page.
Thanks,

Add your own comment.

How to repeat:
just run the query and see the result

Suggested fix:
Please update the documentation pages. 

Thanks,
[7 Sep 2004 14:22] Alexander Keremidarski
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

The manual describes the behaviour of the most recent MySQL major release namely 5.0.x

The proper handling of short IP form was introduced in 4.1

mysql> SELECT VERSION(), INET_ATON('127.0.0.1'), INET_ATON('127.1');
+----------------------+------------------------+--------------------+
| VERSION()            | INET_ATON('127.0.0.1') | INET_ATON('127.1') |
+----------------------+------------------------+--------------------+
| 4.1.4-beta-debug-log |             2130706433 |         2130706433 |
+----------------------+------------------------+--------------------+

mysql> SELECT VERSION(), INET_ATON('127.0.0.1'), INET_ATON('127.1');
+------------------+------------------------+--------------------+
| VERSION()        | INET_ATON('127.0.0.1') | INET_ATON('127.1') |
+------------------+------------------------+--------------------+
| 4.0.21-debug-log |             2130706433 |              32513 |
+------------------+------------------------+--------------------+
[7 Sep 2004 14:23] Alexander Keremidarski
Quoting the manual. chapter Miscellaneous Functions at http://dev.mysql.com/doc/mysql/en/Miscellaneous_functions.html

As of MySQL 4.1.2, INET_ATON() also understands short-form IP addresses:
mysql> SELECT INET_ATON('127.0.0.1'), INET_ATON('127.1');
        -> 2130706433, 2130706433