--- Gerald Combs [email protected] wrote:
What happens when you run
ping 0x7f.1
and why?
Same thing that happens if you ping 127.1 or 127.0.0.1 or 12.1 or 0xc.1 or 0x7c.0xf1 or ...
ping translates it as x.0.0.y and runs the query.
I would say that this is a bug in ping, that it would allow x.y to be evaluated as a complete ip address. But what is going on is that ping is calculating the address based on the first and last dot numbers and fills in the blanks with zeros. if you want the RFC explanation for it, I'd have to look it up. I don'ty keep that kind of trivia in my head, hell I have a hard enough time keeping in the important stuff. ;')
Brian D.
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Jack wrote:
--- Gerald Combs [email protected] wrote:
What happens when you run
ping 0x7f.1
and why?
Same thing that happens if you ping 127.1 or 127.0.0.1 or 12.1 or 0xc.1 or 0x7c.0xf1 or ...
ping translates it as x.0.0.y and runs the query.
I would say that this is a bug in ping, that it would allow x.y to be evaluated as a complete ip address. But what is going on is that ping is calculating the address based on the first and last dot numbers and fills in the blanks with zeros. if you want the RFC explanation for it, I'd have to look it up. I don'ty keep that kind of trivia in my head, hell I have a hard enough time keeping in the important stuff. ;')
The behavior is on purpose, and happens when ping passes the address to the inet_aton() function. inet_aton() tries its best to convert anything you hand it to an IP address -- if the bytes are decimal, hexadecimal, or octal it will convert them accordingly. If there are bytes missing, e.g. 127.1, it will fill the middle bytes with zeroes. If there is just one value (no dots), it will convert it to an unsigned 32-bit integer. As far as inet_aton() is concerned, these are all equivalent:
127.0.0.1 0x7f000001 0177.1
The man page has more information (under "Internet Addresses"):
http://www.freebsd.org/cgi/man.cgi?query=inet_aton&sektion=3
Have you all read this funny "hacking" story dealing with the loopback address?
http://www.totalillusions.net/forum/index.php?showtopic=328
It's translated from German, so it's a little choppy in places.
Too funny!
----------------------------------------- This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorized use under applicable law. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination, or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender. If you have received this transmission in error, please return the material received to the sender and delete all copies from your system.