Re: IP address spec ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prob useless, but just to back things up even more..

RedHat, on Kernel 2.4.4:
[root@alcazar /root]# ping 001.001.001.002
PING 001.001.001.002 (1.1.1.2) from 196.7.202.111 : 56(84) bytes of data.
>From 207.45.199.201: Destination Host Unreachable
>From 207.45.199.201: Destination Host Unreachable

--- 001.001.001.002 ping statistics ---
6 packets transmitted, 0 packets received, +2 errors, 100% packet loss


My FreeBSD boxes seems to work fine however - the program below also
reports the correct IP on my FreeBSD machines, wrong on the Linux ones.

We might have a problem here...  This can be used in some sort of spoofing
manner can't it?

Programs or networks on Linux kernels can be "cheated" so send data to
other IP addresses as they seem to the human eye??



On Tue, 17 Jul 2001, Robert Vojta wrote:

> > Seems linux interprets 010 in octal.
>
>   Yes, simple example ...
>
> #include <stdio.h>
> #include <netdb.h>
>
> int
> main(int argc, char *argv[])
> {
>     struct hostent *host = gethostbyname("212.071.138.006");
>     unsigned long int addr = *((unsigned long int *)host->h_addr);
>
>     printf("%d.%d.%d.%d\n",
>         (addr & 0x000000FF),
>         (addr & 0x0000FF00) >> 8,
>         (addr & 0x00FF0000) >> 16,
>         (addr & 0xFF000000) >> 24);
>
>     return 0;
> }
>
> $gcc test.c -o t
> $./t
> 212.57.138.6
> $
>
>   and 212.57.138.6 != 212.71.138.6 ...  071 = 57
>
>   Yes, I know this, because if you have number with leading zero it's octal
> number and linux works fine in this way, but there are some programs which
> are using 010.000.000.001 as decimal numbers, so it's 10.0.0.1 ==
> 010.000.000.001.
>   Now, I don't know what is true. In my previous e-mail there is an example
> from rfc with leading zeroes and when I try dotted format with leading zeroes
> linux use this numbers as octal one.
>
> Best regards,
>   Robert
>
>

-- 

Regards,
Chris Knipe

Vardus (PTY) Ltd.
Technical Administrator



-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux