[AGENT++] Usage of gethostbyname and gethostbyaddr in SNMP++v3.2.1b.

Jochen Katz katz at agentpp.com
Thu Apr 22 22:47:42 CEST 2004


Hi,

> We have observed that IpAddress class (address.cpp) uses non-thread
> safe functions gethostbyname and  gethostbyaddr.  I found that this
> problem has been fixed in current version (SNMP++v3.2.11).  However
> we can't upgrade to this newer version as our product is too close
> for a release. Also I cannot use the newer version of this file as it
> uses macros (HAVE_GETHOSTBYADDR_R, HAVE_GETHOSTBYNAME_R and other
> macros) from config_snmp_pp.h (this file does not exist in 3.2.1b).

config.h has been renamed to config_snmp_pp.h because of name conflicts.

> It would be great if anyone can provide me a version of this file in
> which this problem has been addressed and works with SNMP 3.2.1b
> version without much code changes.

It should be easy to do it if you use a graphical diff tool for 
address.cpp and msec.cpp and only update the functions that used the non 
reentrant system calls.

Then you have to copy the HAVE_XXX checks/defines into config.h.

Regards,
   Jochen



More information about the AGENTPP mailing list