non-critical impact:
getipnodebyaddr - not documented; use getnameinfo (NcWn14)
Problem description
The getipnodebyaddr function, although available, is not documented on HP-UX.
This API may not be supported in future release of HPUX.
The getipnodebyaddr function is used to get a node name and service name for an address. This routine is deprecated on Tru64 UNIX and is not documented on HP-UX. Identifiers
 getipnodebyaddr |
|
|
Old behavior
The following example shows how to use the getipnodebyaddr routine:
int err;
struct hostent *hp = NULL;
struct in_addr *in;
const char *name = NULL;
if (( hp = getipnodebyaddr( (char *)in, sizeof(struct in_addr),
AF_INET, &err)) != NULL) {
name = hp->h_name;
.
.
.
}
See also
Solution description
Although the getipnodebyaddr function is available on HP-UX, it might be safer to use the getnameinfo to achieve similar results.
Replace calls to the getipnodebyaddr function with the getnameinfo function.
The getnameinfo function does not behave exactly the same as the getipnodebyaddr function. Review your code and applicable manpages for more information.
New behavior
The following example shows how to use the getnameinfo function:
const char *name = NULL;
struct sockaddr_in sinaddr;
char tmp_buf[MAXHOSTNAMELEN];
if ( getnameinfo( (struct sockaddr*)&sinaddr, sizeof(struct sockaddr_in),
tmp_buf, sizeof(tmp_buf), NULL, 0, NI_NAMEREQD) == 0 ) {
name = tmp_buf;
.
.
.
}
See also
Problem summary
| classifications |
source types |
OS release |
severity |
type |
| NW |
C, C++ |
any HP-UX 11i version |
non-critical |
warning |
|