[Home]

Summary:ASTERISK-15039: [patch] ast_gethostbyname doesn't set h_length if argument is an IP Address
Reporter:David Ruggles (thedavidfactor)Labels:
Date Opened:2009-10-26 17:08:15Date Closed:2011-01-19 11:59:20.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Netsock
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) utils.patch
Description:If an IP Address is give as the argument to ast_gethostbyname it short-circuits and returns the ast_hostent with the provided IP Address, however it doesn't set the h_length attribute, as it does if the argument is a hostname. This was discussed with ebroad & mvanbaak on #asterisk-dev
Comments:By: Michiel van Baak (mvanbaak) 2009-12-04 11:42:26.000-0600

+1 from me.
It does not seem to break anything here.

By: nick_lewis (nick_lewis) 2010-06-08 08:29:29

does the h_addrtype also need to be set?

By: Sean Bright (seanbright) 2011-01-19 11:42:28.000-0600

I think the only reason this works is because h_addr is a char * which is 4 on 32 bit systems.  An IPv4 address will always be 4 bytes, regardless of bitness.  So the patch I am applying just hard codes this fact.

By: Digium Subversion (svnbot) 2011-01-19 11:56:33.000-0600

Repository: asterisk
Revision: 302504

U   branches/1.6.2/main/utils.c

------------------------------------------------------------------------
r302504 | seanbright | 2011-01-19 11:56:32 -0600 (Wed, 19 Jan 2011) | 7 lines

Make sure that h_length is set when we short-circuit out of ast_gethostbyname.

(closes issue ASTERISK-15039)
Reported by: thedavidfactor
Patches:
     utils.patch uploaded by thedavidfactor (license 903)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=302504

By: Digium Subversion (svnbot) 2011-01-19 11:58:12.000-0600

Repository: asterisk
Revision: 302505

_U  branches/1.8/
U   branches/1.8/main/utils.c

------------------------------------------------------------------------
r302505 | seanbright | 2011-01-19 11:58:12 -0600 (Wed, 19 Jan 2011) | 14 lines

Merged revisions 302504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r302504 | seanbright | 2011-01-19 12:56:32 -0500 (Wed, 19 Jan 2011) | 7 lines
 
 Make sure that h_length is set when we short-circuit out of ast_gethostbyname.
 
 (closes issue ASTERISK-15039)
 Reported by: thedavidfactor
 Patches:
       utils.patch uploaded by thedavidfactor (license 903)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=302505

By: Digium Subversion (svnbot) 2011-01-19 11:59:19.000-0600

Repository: asterisk
Revision: 302507

_U  trunk/
U   trunk/main/utils.c

------------------------------------------------------------------------
r302507 | seanbright | 2011-01-19 11:59:19 -0600 (Wed, 19 Jan 2011) | 21 lines

Merged revisions 302505 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r302505 | seanbright | 2011-01-19 12:58:11 -0500 (Wed, 19 Jan 2011) | 14 lines
 
 Merged revisions 302504 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r302504 | seanbright | 2011-01-19 12:56:32 -0500 (Wed, 19 Jan 2011) | 7 lines
   
   Make sure that h_length is set when we short-circuit out of ast_gethostbyname.
   
   (closes issue ASTERISK-15039)
   Reported by: thedavidfactor
   Patches:
         utils.patch uploaded by thedavidfactor (license 903)
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=302507