Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  is inet:gethostbyname( IP ) correct?

garry
Posted: Tue Oct 13, 2009 6:18 pm Reply with quote
User Joined: 11 Aug 2009 Posts: 11
recently, a bug in my code caused us to pass a string
representing a floating point number to inet:gethostbyname().
i would have expected it to return an error, but instead it
returned an ip address, but one that made no sense to me:

1> inet:gethostbyname( '12.27' ).
{ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}

so my question is, is this behavior correct, and if so, what
exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?

thanks

--
Garry Hodgson
Lead Member of Technical Staff
AT&T Chief Security Office (CSO)

"This e-mail and any files transmitted with it are AT&T property, are
confidential, and are intended solely for the use of the individual or
entity to whom this e-mail is addressed. If you are not one of the named
recipient(s) or otherwise have reason to believe that you have received
this message in error, please notify the sender and delete this message
immediately from your computer. Any other use, retention, dissemination,
forwarding, printing, or copying of this e-mail is strictly prohibited."

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
View user's profile Send private message
Guest
Posted: Tue Oct 13, 2009 7:08 pm Reply with quote
Guest
Interesting case.

The result doesn't appear to be an issue, but a feature of the gethostbyname
original implementation, in C code.

You get the same result, testing with PHP:

$ php -r 'var_dump(gethostbyname("12.27"));'
string(9) "12.0.0.27"

And other interesting results:

$ php -r 'var_dump(gethostbyname("255.2.256"));'
string(9) "255.2.1.0"

But I can't see where it's really useful.

Caio Ariede
http://caioariede.com/


On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com>wrote:

> recently, a bug in my code caused us to pass a string
> representing a floating point number to inet:gethostbyname().
> i would have expected it to return an error, but instead it
> returned an ip address, but one that made no sense to me:
>
> 1> inet:gethostbyname( '12.27' ).
> {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
>
> so my question is, is this behavior correct, and if so, what
> exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
>
> thanks
>
> --
> Garry Hodgson
> Lead Member of Technical Staff
> AT&T Chief Security Office (CSO)
>
> "This e-mail and any files transmitted with it are AT&T property, are
> confidential, and are intended solely for the use of the individual or
> entity to whom this e-mail is addressed. If you are not one of the named
> recipient(s) or otherwise have reason to believe that you have received this
> message in error, please notify the sender and delete this message
> immediately from your computer. Any other use, retention, dissemination,
> forwarding, printing, or copying of this e-mail is strictly prohibited."
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


Post received from mailinglist
prof3ta
Posted: Wed Oct 14, 2009 9:36 am Reply with quote
User Joined: 06 Feb 2009 Posts: 34
This is due to the dot notation used in inet_addr().

Reading from the doc:
Values specified using the dot notation take one of the following forms:

*/a/*.*/b/*.*/c/*.*/d/*
*/a/*.*/b/*.*/c/*
*/a/*.*/b/*
*/a/*

Each of the four notation types are described below.

* */a/*.*/b/*.*/c/*.*/d/* notation

When four parts are specified, each is interpreted as a byte of
data and assigned, from left to right, to the four bytes of an
Internet address.

* */a/*.*/b/*.*/c/* notation

When a three-part address is specified, the last part is
interpreted as a 16-bit quantity and placed in the right most two
bytes of the network address. This makes the three-part address
format convenient for specifying Class B network addresses as
128.*/net/*.*/host/*.

* */a/*.*/b/* notation

When a two-part address is supplied, the last part is interpreted
as a 24-bit quantity and placed in the right most three bytes of
the network address. This makes the two-part address format
convenient for specifying Class A network addresses as
*/net/*.*/host/*.

* */a/* notation

When only one part is given, the value is stored directly in the
network address without any byte rearrangement.

All numbers supplied as parts in dot notation may be decimal, octal, or
hexadecimal, as specified in the C language (that is, a leading 0x or 0X
implies hexadecimal; otherwise, a leading 0 implies octal; otherwise,
the number is interpreted as decimal).

Sources:
http://www.ietf.org/rfc/rfc3493.txt
http://uw714doc.sco.com/en/man/html.3N/inet.3N.html

Best regards,

Roberto Aloi
Erlang Training and Consulting Ltd.
http://www.erlang-consulting.com
http://aloiroberto.wordpress.com

Garry Hodgson wrote:
> recently, a bug in my code caused us to pass a string
> representing a floating point number to inet:gethostbyname().
> i would have expected it to return an error, but instead it
> returned an ip address, but one that made no sense to me:
>
> 1> inet:gethostbyname( '12.27' ).
> {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
>
> so my question is, is this behavior correct, and if so, what
> exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
>
> thanks
>


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
View user's profile Send private message
Guest
Posted: Wed Oct 14, 2009 10:18 am Reply with quote
Guest
This is part of the IP address spec (not sure where to look to find it,
though). I've seen addresses specified like this on and off in various
locations on a wide variety of OSes, for example in a /etc/hosts file you
can write:

localhost 127.1

Robby

On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com> wrote:

> Interesting case.
>
> The result doesn't appear to be an issue, but a feature of the
> gethostbyname
> original implementation, in C code.
>
> You get the same result, testing with PHP:
>
> $ php -r 'var_dump(gethostbyname("12.27"));'
> string(9) "12.0.0.27"
>
> And other interesting results:
>
> $ php -r 'var_dump(gethostbyname("255.2.256"));'
> string(9) "255.2.1.0"
>
> But I can't see where it's really useful.
>
> Caio Ariede
> http://caioariede.com/
>
>
> On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> >wrote:
>
> > recently, a bug in my code caused us to pass a string
> > representing a floating point number to inet:gethostbyname().
> > i would have expected it to return an error, but instead it
> > returned an ip address, but one that made no sense to me:
> >
> > 1> inet:gethostbyname( '12.27' ).
> > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> >
> > so my question is, is this behavior correct, and if so, what
> > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> >
> > thanks
> >
> > --
> > Garry Hodgson
> > Lead Member of Technical Staff
> > AT&T Chief Security Office (CSO)
> >
> > "This e-mail and any files transmitted with it are AT&T property, are
> > confidential, and are intended solely for the use of the individual or
> > entity to whom this e-mail is addressed. If you are not one of the named
> > recipient(s) or otherwise have reason to believe that you have received
> this
> > message in error, please notify the sender and delete this message
> > immediately from your computer. Any other use, retention, dissemination,
> > forwarding, printing, or copying of this e-mail is strictly prohibited."
> >
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
> >
> >
>


Post received from mailinglist
prof3ta
Posted: Wed Oct 14, 2009 10:22 am Reply with quote
User Joined: 06 Feb 2009 Posts: 34
At the end of my last mail you have the references.
Regards,

Roberto Aloi
Erlang Training and Consulting Ltd.
http://www.erlang-consulting.com
http://aloiroberto.wordpress.com

Robert Raschke wrote:
> This is part of the IP address spec (not sure where to look to find it,
> though). I've seen addresses specified like this on and off in various
> locations on a wide variety of OSes, for example in a /etc/hosts file you
> can write:
>
> localhost 127.1
>
> Robby
>
> On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com> wrote:
>
>
>> Interesting case.
>>
>> The result doesn't appear to be an issue, but a feature of the
>> gethostbyname
>> original implementation, in C code.
>>
>> You get the same result, testing with PHP:
>>
>> $ php -r 'var_dump(gethostbyname("12.27"));'
>> string(9) "12.0.0.27"
>>
>> And other interesting results:
>>
>> $ php -r 'var_dump(gethostbyname("255.2.256"));'
>> string(9) "255.2.1.0"
>>
>> But I can't see where it's really useful.
>>
>> Caio Ariede
>> http://caioariede.com/
>>
>>
>> On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
>>
>>> wrote:
>>>
>>> recently, a bug in my code caused us to pass a string
>>> representing a floating point number to inet:gethostbyname().
>>> i would have expected it to return an error, but instead it
>>> returned an ip address, but one that made no sense to me:
>>>
>>> 1> inet:gethostbyname( '12.27' ).
>>> {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
>>>
>>> so my question is, is this behavior correct, and if so, what
>>> exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
>>>
>>> thanks
>>>
>>> --
>>> Garry Hodgson
>>> Lead Member of Technical Staff
>>> AT&T Chief Security Office (CSO)
>>>
>>> "This e-mail and any files transmitted with it are AT&T property, are
>>> confidential, and are intended solely for the use of the individual or
>>> entity to whom this e-mail is addressed. If you are not one of the named
>>> recipient(s) or otherwise have reason to believe that you have received
>>>
>> this
>>
>>> message in error, please notify the sender and delete this message
>>> immediately from your computer. Any other use, retention, dissemination,
>>> forwarding, printing, or copying of this e-mail is strictly prohibited."
>>>
>>> ________________________________________________________________
>>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>>> erlang-questions (at) erlang.org
>>>
>>>
>>>
>
>


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
View user's profile Send private message
Guest
Posted: Wed Oct 14, 2009 1:35 pm Reply with quote
Guest
For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !


At the end of my last mail you have the references.
Regards,

Roberto Aloi
Erlang Training and Consulting Ltd.
http://www.erlang-consulting.com
http://aloiroberto.wordpress.com

Robert Raschke wrote:
> This is part of the IP address spec (not sure where to look to find it,
> though). I've seen addresses specified like this on and off in various
> locations on a wide variety of OSes, for example in a /etc/hosts file you
> can write:
>
> localhost 127.1
>
> Robby
>
> On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
>
>
> > Interesting case.
> >
> > The result doesn't appear to be an issue, but a feature of the
> > gethostbyname
> > original implementation, in C code.
> >
> > You get the same result, testing with PHP:
> >
> > $ php -r 'var_dump(gethostbyname("12.27"));'
> > string(9) "12.0.0.27"
> >
> > And other interesting results:
> >
> > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > string(9) "255.2.1.0"
> >
> > But I can't see where it's really useful.
> >
> > Caio Ariede
> > http://caioariede.com/
> >
> >
> > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> >
> > > wrote:
> > >
> > > recently, a bug in my code caused us to pass a string
> > > representing a floating point number to inet:gethostbyname().
> > > i would have expected it to return an error, but instead it
> > > returned an ip address, but one that made no sense to me:
> > >
> > > 1 > inet:gethostbyname( '12.27' ).
> > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > >
> > > so my question is, is this behavior correct, and if so, what
> > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > >
> > > thanks
> > >
> > > --
> > > Garry Hodgson
> > > Lead Member of Technical Staff
> > > AT&T Chief Security Office (CSO)
> > >
> > > "This e-mail and any files transmitted with it are AT&T property, are
> > > confidential, and are intended solely for the use of the individual or
> > > entity to whom this e-mail is addressed. If you are not one of the named
> > > recipient(s) or otherwise have reason to believe that you have received
> > >
> > this
> >
> > > message in error, please notify the sender and delete this message
> > > immediately from your computer. Any other use, retention, dissemination,
> > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > >
> > > ________________________________________________________________
> > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > erlang-questions (at) erlang.org
> > >
> > >
> > >
>
>


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


Post received from mailinglist
garry
Posted: Wed Oct 14, 2009 2:06 pm Reply with quote
User Joined: 11 Aug 2009 Posts: 11
Roberto Aloi <roberto.aloi@erlang-consulting.com>Roberto Aloi wrote:
> This is due to the dot notation used in inet_addr().
>
> Reading from the doc:
> Values specified using the dot notation take one of the following forms:
>
> */a/*.*/b/*.*/c/*.*/d/*
> */a/*.*/b/*.*/c/*
> */a/*.*/b/*
> */a/*

thanks to roberto and all the others who clarified this for me.


--
Garry Hodgson
Lead Member of Technical Staff
AT&T Chief Security Office (CSO)

"This e-mail and any files transmitted with it are AT&T property, are
confidential, and are intended solely for the use of the individual or
entity to whom this e-mail is addressed. If you are not one of the named
recipient(s) or otherwise have reason to believe that you have received
this message in error, please notify the sender and delete this message
immediately from your computer. Any other use, retention, dissemination,
forwarding, printing, or copying of this e-mail is strictly prohibited."

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
View user's profile Send private message
Guest
Posted: Thu Oct 15, 2009 12:49 pm Reply with quote
Guest
On Wed, Oct 14, 2009 at 03:34:12PM +0200, info wrote:
> For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !

Sorry about that, but your problem became a just too spooky
Windows 2003 problem and that is not really my turf, and
you seemed to have a possible workaround through inet_res.
But it has been on my todo list to have a second look
at the whole conversation when I could find the time...

>
>
> At the end of my last mail you have the references.
> Regards,
>
> Roberto Aloi
> Erlang Training and Consulting Ltd.
> http://www.erlang-consulting.com
> http://aloiroberto.wordpress.com
>
> Robert Raschke wrote:
> > This is part of the IP address spec (not sure where to look to find it,
> > though). I've seen addresses specified like this on and off in various
> > locations on a wide variety of OSes, for example in a /etc/hosts file you
> > can write:
> >
> > localhost 127.1
> >
> > Robby
> >
> > On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
> >
> >
> > > Interesting case.
> > >
> > > The result doesn't appear to be an issue, but a feature of the
> > > gethostbyname
> > > original implementation, in C code.
> > >
> > > You get the same result, testing with PHP:
> > >
> > > $ php -r 'var_dump(gethostbyname("12.27"));'
> > > string(9) "12.0.0.27"
> > >
> > > And other interesting results:
> > >
> > > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > > string(9) "255.2.1.0"
> > >
> > > But I can't see where it's really useful.
> > >
> > > Caio Ariede
> > > http://caioariede.com/
> > >
> > >
> > > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> > >
> > > > wrote:
> > > >
> > > > recently, a bug in my code caused us to pass a string
> > > > representing a floating point number to inet:gethostbyname().
> > > > i would have expected it to return an error, but instead it
> > > > returned an ip address, but one that made no sense to me:
> > > >
> > > > 1 > inet:gethostbyname( '12.27' ).
> > > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > > >
> > > > so my question is, is this behavior correct, and if so, what
> > > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > > >
> > > > thanks
> > > >
> > > > --
> > > > Garry Hodgson
> > > > Lead Member of Technical Staff
> > > > AT&T Chief Security Office (CSO)
> > > >
> > > > "This e-mail and any files transmitted with it are AT&T property, are
> > > > confidential, and are intended solely for the use of the individual or
> > > > entity to whom this e-mail is addressed. If you are not one of the named
> > > > recipient(s) or otherwise have reason to believe that you have received
> > > >
> > > this
> > >
> > > > message in error, please notify the sender and delete this message
> > > > immediately from your computer. Any other use, retention, dissemination,
> > > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > > >
> > > > ________________________________________________________________
> > > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > > erlang-questions (at) erlang.org
> > > >
> > > >
> > > >
> >
> >
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
Guest
Posted: Thu Oct 15, 2009 1:04 pm Reply with quote
Guest
Dear Raimo,
I can resume: I discovered that gethostbyname call inet_gethost.c
I don't understand inet_gethost.c Sad
Where "goes" this problem for finding the information ?
If we know where and what, we could perhaps find what is missing in my windows 2003 ...
Hope to read you soon !
John

On Wed, Oct 14, 2009 at 03:34:12PM +0200, info wrote:
> For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !

Sorry about that, but your problem became a just too spooky
Windows 2003 problem and that is not really my turf, and
you seemed to have a possible workaround through inet_res.
But it has been on my todo list to have a second look
at the whole conversation when I could find the time...

>
>
> At the end of my last mail you have the references.
> Regards,
>
> Roberto Aloi
> Erlang Training and Consulting Ltd.
> http://www.erlang-consulting.com
> http://aloiroberto.wordpress.com
>
> Robert Raschke wrote:
> > This is part of the IP address spec (not sure where to look to find it,
> > though). I've seen addresses specified like this on and off in various
> > locations on a wide variety of OSes, for example in a /etc/hosts file you
> > can write:
> >
> > localhost 127.1
> >
> > Robby
> >
> > On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
> >
> >
> > > Interesting case.
> > >
> > > The result doesn't appear to be an issue, but a feature of the
> > > gethostbyname
> > > original implementation, in C code.
> > >
> > > You get the same result, testing with PHP:
> > >
> > > $ php -r 'var_dump(gethostbyname("12.27"));'
> > > string(9) "12.0.0.27"
> > >
> > > And other interesting results:
> > >
> > > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > > string(9) "255.2.1.0"
> > >
> > > But I can't see where it's really useful.
> > >
> > > Caio Ariede
> > > http://caioariede.com/
> > >
> > >
> > > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> > >
> > > > wrote:
> > > >
> > > > recently, a bug in my code caused us to pass a string
> > > > representing a floating point number to inet:gethostbyname().
> > > > i would have expected it to return an error, but instead it
> > > > returned an ip address, but one that made no sense to me:
> > > >
> > > > 1 > inet:gethostbyname( '12.27' ).
> > > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > > >
> > > > so my question is, is this behavior correct, and if so, what
> > > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > > >
> > > > thanks
> > > >
> > > > --
> > > > Garry Hodgson
> > > > Lead Member of Technical Staff
> > > > AT&T Chief Security Office (CSO)
> > > >
> > > > "This e-mail and any files transmitted with it are AT&T property, are
> > > > confidential, and are intended solely for the use of the individual or
> > > > entity to whom this e-mail is addressed. If you are not one of the named
> > > > recipient(s) or otherwise have reason to believe that you have received
> > > >
> > > this
> > >
> > > > message in error, please notify the sender and delete this message
> > > > immediately from your computer. Any other use, retention, dissemination,
> > > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > > >
> > > > ________________________________________________________________
> > > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > > erlang-questions (at) erlang.org
> > > >
> > > >
> > > >
> >
> >
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


Post received from mailinglist
Guest
Posted: Thu Oct 15, 2009 3:30 pm Reply with quote
Guest
On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> Dear Raimo,
> I can resume: I discovered that gethostbyname call inet_gethost.c
> I don't understand inet_gethost.c Sad
> Where "goes" this problem for finding the information ?
> If we know where and what, we could perhaps find what is missing in my windows 2003 ...
> Hope to read you soon !
> John

Well, there is not much more to say. inet_gethost.c calls
struct hostent *gethostbyname(const char *name) in the
winsock2 library:
http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx
It never returns.
It is deprecated but that does not mean broken.
I have a Windows 2003 server that it works on.
We have not found the reason it differs between
my server and your server.
And that is about it.


>
> On Wed, Oct 14, 2009 at 03:34:12PM +0200, info wrote:
> > For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !
>
> Sorry about that, but your problem became a just too spooky
> Windows 2003 problem and that is not really my turf, and
> you seemed to have a possible workaround through inet_res.
> But it has been on my todo list to have a second look
> at the whole conversation when I could find the time...
>
> >
> >
> > At the end of my last mail you have the references.
> > Regards,
> >
> > Roberto Aloi
> > Erlang Training and Consulting Ltd.
> > http://www.erlang-consulting.com
> > http://aloiroberto.wordpress.com
> >
> > Robert Raschke wrote:
> > > This is part of the IP address spec (not sure where to look to find it,
> > > though). I've seen addresses specified like this on and off in various
> > > locations on a wide variety of OSes, for example in a /etc/hosts file you
> > > can write:
> > >
> > > localhost 127.1
> > >
> > > Robby
> > >
> > > On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
> > >
> > >
> > > > Interesting case.
> > > >
> > > > The result doesn't appear to be an issue, but a feature of the
> > > > gethostbyname
> > > > original implementation, in C code.
> > > >
> > > > You get the same result, testing with PHP:
> > > >
> > > > $ php -r 'var_dump(gethostbyname("12.27"));'
> > > > string(9) "12.0.0.27"
> > > >
> > > > And other interesting results:
> > > >
> > > > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > > > string(9) "255.2.1.0"
> > > >
> > > > But I can't see where it's really useful.
> > > >
> > > > Caio Ariede
> > > > http://caioariede.com/
> > > >
> > > >
> > > > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> > > >
> > > > > wrote:
> > > > >
> > > > > recently, a bug in my code caused us to pass a string
> > > > > representing a floating point number to inet:gethostbyname().
> > > > > i would have expected it to return an error, but instead it
> > > > > returned an ip address, but one that made no sense to me:
> > > > >
> > > > > 1 > inet:gethostbyname( '12.27' ).
> > > > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > > > >
> > > > > so my question is, is this behavior correct, and if so, what
> > > > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > > > >
> > > > > thanks
> > > > >
> > > > > --
> > > > > Garry Hodgson
> > > > > Lead Member of Technical Staff
> > > > > AT&T Chief Security Office (CSO)
> > > > >
> > > > > "This e-mail and any files transmitted with it are AT&T property, are
> > > > > confidential, and are intended solely for the use of the individual or
> > > > > entity to whom this e-mail is addressed. If you are not one of the named
> > > > > recipient(s) or otherwise have reason to believe that you have received
> > > > >
> > > > this
> > > >
> > > > > message in error, please notify the sender and delete this message
> > > > > immediately from your computer. Any other use, retention, dissemination,
> > > > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > > > >
> > > > > ________________________________________________________________
> > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > > > erlang-questions (at) erlang.org
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
> >
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
Guest
Posted: Thu Oct 15, 2009 3:50 pm Reply with quote
Guest
On Thu, Oct 15, 2009 at 4:28 PM, Raimo Niskanen <
raimo+erlang-questions@erix.ericsson.se<raimo%2Berlang-questions@erix.ericsson.se>
> wrote:

> On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> > Dear Raimo,
> > I can resume: I discovered that gethostbyname call inet_gethost.c
> > I don't understand inet_gethost.c Sad
> > Where "goes" this problem for finding the information ?
> > If we know where and what, we could perhaps find what is missing in my
> windows 2003 ...
> > Hope to read you soon !
> > John
>
> Well, there is not much more to say. inet_gethost.c calls
> struct hostent *gethostbyname(const char *name) in the
> winsock2 library:
> http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx<http://msdn.microsoft.com/en-us/library/ms738524%28VS.85%29.aspx>
> It never returns.
> It is deprecated but that does not mean broken.
> I have a Windows 2003 server that it works on.
> We have not found the reason it differs between
> my server and your server.
> And that is about it.
>
>
>
I can consistently reproduce the hanging gethostbyname() in inet_gethost.exe
on Windows 2003 when I have the 'Microsoft Firewall Client for ISA Server
Version 4.0' installed. This is a specific add-on, nothing to do with
Microsoft Firewall in your Network Properties.

If I remove it, it works fine, if I add it it hangs. Apart from that the
W2003 build is as vanilla as it gets.

Nothing much to go on, but I would not be surprised if some system DLL is
getting in the way. This is very hard to diagnose.

One day I'll get around to compiling inet_gethost.exe in my setup, just to
rule out poor linkage due to the VC++ setup used to build the shipping
executables. If I compile up a trivial gethostbyname() example from MSDN, it
works OK in all circumstances.

There are a few strange dependencies in other shipped Windows files, for
example beam.dll seems to depend on a particular MSVCR80.DLL with the
version 8.0.50727.1433 . And if you have an older Windows machine, you get
the completely unhelpful popup box telling you that your program could not
be run. This has something to do with Windows Side-by-Side DLL deployment,
and I completely fail to grasp what that's all about.

Robby


Post received from mailinglist
Guest
Posted: Fri Oct 16, 2009 10:49 am Reply with quote
Guest
On Thu, Oct 15, 2009 at 04:48:38PM +0100, Robert Raschke wrote:
> On Thu, Oct 15, 2009 at 4:28 PM, Raimo Niskanen <
> raimo+erlang-questions@erix.ericsson.se<raimo%2Berlang-questions@erix.ericsson.se>
> > wrote:
>
> > On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> > > Dear Raimo,
> > > I can resume: I discovered that gethostbyname call inet_gethost.c
> > > I don't understand inet_gethost.c Sad
> > > Where "goes" this problem for finding the information ?
> > > If we know where and what, we could perhaps find what is missing in my
> > windows 2003 ...
> > > Hope to read you soon !
> > > John
> >
> > Well, there is not much more to say. inet_gethost.c calls
> > struct hostent *gethostbyname(const char *name) in the
> > winsock2 library:
> > http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx<http://msdn.microsoft.com/en-us/library/ms738524%28VS.85%29.aspx>
> > It never returns.
> > It is deprecated but that does not mean broken.
> > I have a Windows 2003 server that it works on.
> > We have not found the reason it differs between
> > my server and your server.
> > And that is about it.
> >
> >
> >
> I can consistently reproduce the hanging gethostbyname() in inet_gethost.exe
> on Windows 2003 when I have the 'Microsoft Firewall Client for ISA Server
> Version 4.0' installed. This is a specific add-on, nothing to do with
> Microsoft Firewall in your Network Properties.
>
> If I remove it, it works fine, if I add it it hangs. Apart from that the
> W2003 build is as vanilla as it gets.
>

This rings a bell for our Windows guys.

Firewall software on Windows do nasty things. They e.g replace
the Winsock API for other applications so things you had to do
before suddenly breaks. Especially since inet_gethost.exe
does calls from worker threads the API replacement may mess up.
We have had hanging gethostbyname() for certain firewalls.

We will install virtual a Windows 2003 server machine,
the Microsoft Firewall Client for ISA Server seems to be
downloadable
http://www.microsoft.com/DownLoads/details.aspx?FamilyID=05c2c932-b15a-4990-b525-66380743da89&displaylang=en
from Microsoft, but where to find, if we need, the Microsoft ISA Server
I do not know...

Then we will try to reproduce the problem.


> Nothing much to go on, but I would not be surprised if some system DLL is
> getting in the way. This is very hard to diagnose.
>
> One day I'll get around to compiling inet_gethost.exe in my setup, just to
> rule out poor linkage due to the VC++ setup used to build the shipping
> executables. If I compile up a trivial gethostbyname() example from MSDN, it
> works OK in all circumstances.
>
> There are a few strange dependencies in other shipped Windows files, for
> example beam.dll seems to depend on a particular MSVCR80.DLL with the
> version 8.0.50727.1433 . And if you have an older Windows machine, you get
> the completely unhelpful popup box telling you that your program could not
> be run. This has something to do with Windows Side-by-Side DLL deployment,
> and I completely fail to grasp what that's all about.
>
> Robby

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
Guest
Posted: Fri Oct 16, 2009 2:26 pm Reply with quote
Guest
My idea was to analyse the return parameters because gethostbyname doesn't return "timeout".
Who and where decides to transform an error code in timeout code ?
I hope to escalade the problem like this ...
John
On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> Dear Raimo,
> I can resume: I discovered that gethostbyname call inet_gethost.c
> I don't understand inet_gethost.c Sad
> Where "goes" this problem for finding the information ?
> If we know where and what, we could perhaps find what is missing in my windows 2003 ...
> Hope to read you soon !
> John

Well, there is not much more to say. inet_gethost.c calls
struct hostent *gethostbyname(const char *name) in the
winsock2 library:
http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx
It never returns.
It is deprecated but that does not mean broken.
I have a Windows 2003 server that it works on.
We have not found the reason it differs between
my server and your server.
And that is about it.


>
> On Wed, Oct 14, 2009 at 03:34:12PM +0200, info wrote:
> > For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !
>
> Sorry about that, but your problem became a just too spooky
> Windows 2003 problem and that is not really my turf, and
> you seemed to have a possible workaround through inet_res.
> But it has been on my todo list to have a second look
> at the whole conversation when I could find the time...
>
> >
> >
> > At the end of my last mail you have the references.
> > Regards,
> >
> > Roberto Aloi
> > Erlang Training and Consulting Ltd.
> > http://www.erlang-consulting.com
> > http://aloiroberto.wordpress.com
> >
> > Robert Raschke wrote:
> > > This is part of the IP address spec (not sure where to look to find it,
> > > though). I've seen addresses specified like this on and off in various
> > > locations on a wide variety of OSes, for example in a /etc/hosts file you
> > > can write:
> > >
> > > localhost 127.1
> > >
> > > Robby
> > >
> > > On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
> > >
> > >
> > > > Interesting case.
> > > >
> > > > The result doesn't appear to be an issue, but a feature of the
> > > > gethostbyname
> > > > original implementation, in C code.
> > > >
> > > > You get the same result, testing with PHP:
> > > >
> > > > $ php -r 'var_dump(gethostbyname("12.27"));'
> > > > string(9) "12.0.0.27"
> > > >
> > > > And other interesting results:
> > > >
> > > > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > > > string(9) "255.2.1.0"
> > > >
> > > > But I can't see where it's really useful.
> > > >
> > > > Caio Ariede
> > > > http://caioariede.com/
> > > >
> > > >
> > > > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> > > >
> > > > > wrote:
> > > > >
> > > > > recently, a bug in my code caused us to pass a string
> > > > > representing a floating point number to inet:gethostbyname().
> > > > > i would have expected it to return an error, but instead it
> > > > > returned an ip address, but one that made no sense to me:
> > > > >
> > > > > 1 > inet:gethostbyname( '12.27' ).
> > > > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > > > >
> > > > > so my question is, is this behavior correct, and if so, what
> > > > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > > > >
> > > > > thanks
> > > > >
> > > > > --
> > > > > Garry Hodgson
> > > > > Lead Member of Technical Staff
> > > > > AT&T Chief Security Office (CSO)
> > > > >
> > > > > "This e-mail and any files transmitted with it are AT&T property, are
> > > > > confidential, and are intended solely for the use of the individual or
> > > > > entity to whom this e-mail is addressed. If you are not one of the named
> > > > > recipient(s) or otherwise have reason to believe that you have received
> > > > >
> > > > this
> > > >
> > > > > message in error, please notify the sender and delete this message
> > > > > immediately from your computer. Any other use, retention, dissemination,
> > > > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > > > >
> > > > > ________________________________________________________________
> > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > > > erlang-questions (at) erlang.org
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
> >
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


Post received from mailinglist
Guest
Posted: Fri Oct 16, 2009 2:30 pm Reply with quote
Guest
On Thu, Oct 15, 2009 at 4:28 PM, Raimo Niskanen <
raimo+erlang-questions@erix.ericsson.se <raimo%2Berlang-questions@erix.ericsson.se >
> wrote:

> On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> > Dear Raimo,
> > I can resume: I discovered that gethostbyname call inet_gethost.c
> > I don't understand inet_gethost.c Sad
> > Where "goes" this problem for finding the information ?
> > If we know where and what, we could perhaps find what is missing in my
> windows 2003 ...
> > Hope to read you soon !
> > John
>
> Well, there is not much more to say. inet_gethost.c calls
> struct hostent *gethostbyname(const char *name) in the
> winsock2 library:
> http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx <http://msdn.microsoft.com/en-us/library/ms738524%28VS.85%29.aspx >
> It never returns.
> It is deprecated but that does not mean broken.
> I have a Windows 2003 server that it works on.
> We have not found the reason it differs between
> my server and your server.
> And that is about it.
>
>
>
I can consistently reproduce the hanging gethostbyname() in inet_gethost.exe
on Windows 2003 when I have the 'Microsoft Firewall Client for ISA Server
Version 4.0' installed. This is a specific add-on, nothing to do with
Microsoft Firewall in your Network Properties.

but I don't use ISA server !!!

If I remove it, it works fine, if I add it it hangs. Apart from that the
W2003 build is as vanilla as it gets.

Nothing much to go on, but I would not be surprised if some system DLL is
getting in the way. This is very hard to diagnose.

One day I'll get around to compiling inet_gethost.exe in my setup, just to
rule out poor linkage due to the VC++ setup used to build the shipping
executables. If I compile up a trivial gethostbyname() example from MSDN, it
works OK in all circumstances.

There are a few strange dependencies in other shipped Windows files, for
example beam.dll seems to depend on a particular MSVCR80.DLL with the
version 8.0.50727.1433 . And if you have an older Windows machine, you get
the completely unhelpful popup box telling you that your program could not
be run. This has something to do with Windows Side-by-Side DLL deployment,
and I completely fail to grasp what that's all about.

but I don't have msvcr80.dll !!!

Robby


Post received from mailinglist
Guest
Posted: Fri Oct 16, 2009 3:29 pm Reply with quote
Guest
On Fri, Oct 16, 2009 at 04:24:53PM +0200, info wrote:
> My idea was to analyse the return parameters because gethostbyname doesn't return "timeout".
> Who and where decides to transform an error code in timeout code ?
> I hope to escalade the problem like this ...
> John

The debug trick I showed earlier (inet_gethost_native:control({debug_level,99}))
would show the return value, but as I understood it it never
returns; it gets interrupted from inet_gethost.erl, even
if you set the timeout ridiculously high, so we have
no return value to go on...

> On Thu, Oct 15, 2009 at 03:02:40PM +0200, info wrote:
> > Dear Raimo,
> > I can resume: I discovered that gethostbyname call inet_gethost.c
> > I don't understand inet_gethost.c Sad
> > Where "goes" this problem for finding the information ?
> > If we know where and what, we could perhaps find what is missing in my windows 2003 ...
> > Hope to read you soon !
> > John
>
> Well, there is not much more to say. inet_gethost.c calls
> struct hostent *gethostbyname(const char *name) in the
> winsock2 library:
> http://msdn.microsoft.com/en-us/library/ms738524(VS.85).aspx
> It never returns.
> It is deprecated but that does not mean broken.
> I have a Windows 2003 server that it works on.
> We have not found the reason it differs between
> my server and your server.
> And that is about it.
>
>
> >
> > On Wed, Oct 14, 2009 at 03:34:12PM +0200, info wrote:
> > > For me this function always returns {error,timeout} and I didn't find the reason even with the help of Raimo Niskanen !
> >
> > Sorry about that, but your problem became a just too spooky
> > Windows 2003 problem and that is not really my turf, and
> > you seemed to have a possible workaround through inet_res.
> > But it has been on my todo list to have a second look
> > at the whole conversation when I could find the time...
> >
> > >
> > >
> > > At the end of my last mail you have the references.
> > > Regards,
> > >
> > > Roberto Aloi
> > > Erlang Training and Consulting Ltd.
> > > http://www.erlang-consulting.com
> > > http://aloiroberto.wordpress.com
> > >
> > > Robert Raschke wrote:
> > > > This is part of the IP address spec (not sure where to look to find it,
> > > > though). I've seen addresses specified like this on and off in various
> > > > locations on a wide variety of OSes, for example in a /etc/hosts file you
> > > > can write:
> > > >
> > > > localhost 127.1
> > > >
> > > > Robby
> > > >
> > > > On Tue, Oct 13, 2009 at 8:06 PM, caio ariede <caio.ariede@gmail.com > wrote:
> > > >
> > > >
> > > > > Interesting case.
> > > > >
> > > > > The result doesn't appear to be an issue, but a feature of the
> > > > > gethostbyname
> > > > > original implementation, in C code.
> > > > >
> > > > > You get the same result, testing with PHP:
> > > > >
> > > > > $ php -r 'var_dump(gethostbyname("12.27"));'
> > > > > string(9) "12.0.0.27"
> > > > >
> > > > > And other interesting results:
> > > > >
> > > > > $ php -r 'var_dump(gethostbyname("255.2.256"));'
> > > > > string(9) "255.2.1.0"
> > > > >
> > > > > But I can't see where it's really useful.
> > > > >
> > > > > Caio Ariede
> > > > > http://caioariede.com/
> > > > >
> > > > >
> > > > > On Tue, Oct 13, 2009 at 3:15 PM, Garry Hodgson <garry@research.att.com
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > > recently, a bug in my code caused us to pass a string
> > > > > > representing a floating point number to inet:gethostbyname().
> > > > > > i would have expected it to return an error, but instead it
> > > > > > returned an ip address, but one that made no sense to me:
> > > > > >
> > > > > > 1 > inet:gethostbyname( '12.27' ).
> > > > > > {ok,{hostent,"12.27",[],inet,4,[{12,0,0,27}]}}
> > > > > >
> > > > > > so my question is, is this behavior correct, and if so, what
> > > > > > exactly does it mean that a lookup of '12.27' maps to '12.0.0.27'?
> > > > > >
> > > > > > thanks
> > > > > >
> > > > > > --
> > > > > > Garry Hodgson
> > > > > > Lead Member of Technical Staff
> > > > > > AT&T Chief Security Office (CSO)
> > > > > >
> > > > > > "This e-mail and any files transmitted with it are AT&T property, are
> > > > > > confidential, and are intended solely for the use of the individual or
> > > > > > entity to whom this e-mail is addressed. If you are not one of the named
> > > > > > recipient(s) or otherwise have reason to believe that you have received
> > > > > >
> > > > > this
> > > > >
> > > > > > message in error, please notify the sender and delete this message
> > > > > > immediately from your computer. Any other use, retention, dissemination,
> > > > > > forwarding, printing, or copying of this e-mail is strictly prohibited."
> > > > > >
> > > > > > ________________________________________________________________
> > > > > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > > > > erlang-questions (at) erlang.org
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > >
> > >
> > > ________________________________________________________________
> > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > erlang-questions (at) erlang.org
> >
> > --
> >
> > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> >
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 3
Goto page 1, 2, 3  Next
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum