Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jul 2000 17:47:21 -0500
From:      "Alejandro Ramirez" <ales@megared.net.mx>
To:        "Raymundo M. Vega" <RaymundoVega@home.com>, "Stephen Hovey" <shovey@buffnet.net>, "Rahul Siddharthan" <rsidd@physics.iisc.ernet.in>, "Jan Grant" <Jan.Grant@bristol.ac.uk>, "Theo Bell" <freebsd@cfdnet.me.tuns.ca>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: IP Address Convertion Formula???
Message-ID:  <00c801bfec53$243d48a0$02c134c8@megared.net.mx>
References:  <Pine.BSF.4.05.10007121119120.723-100000@buffnet11.buffnet.net> <396CCC00.1320965@home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> >
> > Oh I think easy is always proper! :)
> >
>
> unless you *really* want to know how it is done

That is exacly what I wanted to know, basically its very simple:

Quote from Andresen,Jason R. <jandrese@mitre.org>
Both of them represent 32 bits.  Your first form simply leaves all of the
bits together to form a single 32 bit number, the second form breaks the
bits up into four 8 bit numbers.

Example:
10.10.35.158
= 00001010.00001010.00100011.10011110
= 00001010000010100010001110011110
= 168436638 = 10.10.35.158

It is a "feature" of the BSD-derived inet_aton() function. Originally, the
function was supposed to convert the shorthand "12.1" into the
corresponding 32-bit IPv4 binary address for 12.0.0.1. It also converts
things w/o dot like "121" into 0.0.0.121. That way, it also converts the
what I call big-int addresses like "168436638 " into 10.10.35.158. As
digit strings are always network byteorder, the conversion is not affected
by endianess issues.

Thanks to all who helped me with this...
Sincerely
Ales





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00c801bfec53$243d48a0$02c134c8>