Tor Sigurdsson wrote:
Það var föstudagur 23 febrúar 2001 13:21 þegar þú skrifaðir:
Feb 23 13:43:20 upnlr3 kernel: martian destination 00000000 from 1f011f0a, dev eth1
1f011f0a 1f -> 31 01 -> 1 1f -> 31 0a -> 10 -> IP 10.31.1.31
I think you got it backwards :-)
No. This is because the x86 architecture host byte order differs from network byte order. The IP address is internally stored in network byte order, i.e., with the highest byte first: 0a 1f 01 1f. The kernel uses a simple printf("... %08x ...", ...) to produce the log message, so the bytes of the address are interpreted as a 32 bit integer according to _host_ byte order, i.e., lowest byte first (on x86). This results in the reversed output, because the last byte of the IP address is printed as the highest part of the number, and so on. Eilert -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Eilert Brinkmann -- Universitaet Bremen -- FB 3, Informatik eilert@informatik.uni-bremen.de - eilert@tzi.org - eilert@linuxfreak.com http://www.informatik.uni-bremen.de/~eilert/
Tor Sigurdsson wrote:
Það var föstudagur 23 febrúar 2001 13:21 þegar þú skrifaðir:
Feb 23 13:43:20 upnlr3 kernel: martian destination 00000000 from 1f011f0a, dev eth1
1f011f0a 1f -> 31 01 -> 1 1f -> 31 0a -> 10 -> IP 10.31.1.31
I think you got it backwards :-)
No. This is because the x86 architecture host byte order differs from network byte order. The IP address is internally stored in network byte order, i.e., with the highest byte first: 0a 1f 01 1f. The kernel uses a simple printf("... %08x ...", ...) to produce the log message, so the bytes of the address are interpreted as a 32 bit integer according to _host_ byte order, i.e., lowest byte first (on x86). This results in the reversed output, because the last byte of the IP address is printed as the highest part of the number, and so on.
Eilert
Hmm... If the host byteorder would matter, wouldn't the intel word of 16 bits be the package to reverse ? So 0x0a1f011f would become 0x1f0a1f01 ? -tosi
participants (2)
-
Eilert Brinkmann
-
Tor Sigurdsson