mash@myfuckingnet.com on Thu, Apr 19, 2001 at 10:41 +0200 had found the martians in his log files:
Apr 18 12:04:38 server kernel: martian source c799fea9 for c799fea9, dev eth0
Steffen Dettmer <steffen@dett.de> had some perl code to decode this:
to convert hex to IP you may use the following one-liner:
perl -e '$a=shift;{printf "%d.%d.%d.%d\n", ("0x" . substr($a,6,2)), ("0x" . substr($a,4,2)), ("0x" . substr($a,2,2)), ("0x" . substr($a,0,2));}' <string>
[this works at least on intel archs] [snip] fffffea9 = 169.254.255.255
Err, and here starts my problem: ff ff fe a9 is in my universe (if read from left to right) = 255.255.254.169 (but a9feffff *is* 169.254.255.255) The script does it backwards ... I know that e.g. AIX is using sometimes hex IP addresses, and all IP addresses I've seen were read from left to right. [THESIS 1] So are there two possibilities to write hex IP addresses and the found "martians" in the log files are written backwards (right to left) OR [THESIS 2] is the script in all cases wrong and should be corrected to: perl -e '$a=shift;{printf "%d.%d.%d.%d\n", ("0x" . substr($a,0,2)), ("0x" . substr($a,2,2)), ("0x" . substr($a,4,2)), ("0x" . substr($a,6,2));}' <string> I haven't found any prove for one of these thesises - but would be very interested in resources proving one of the two. Since this has at least connections with log files one could argue this on topic with security ;-) (otherwise flame me). regards, Hella Breitkopf -- -- -- -- -- hella.breitkopf@varetis.de unix administrator technical infrastructure varetis COMMUNICATIONS GmbH