Makefile: Conditionalize IPV6 files and build some commands as .rel

At least ifconfig has "static" global C constructors and you have
to force the objects in.
This commit is contained in:
Joel Sherrill
2012-10-23 13:31:30 -05:00
parent cc2aec486d
commit 68e0948111
6 changed files with 314 additions and 37 deletions

View File

@@ -340,6 +340,7 @@ gethostanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
break;
#else
he->h_name = bp;
#ifdef INET6
if (statp->options & RES_USE_INET6) {
n = strlen(bp) + 1; /* for the \0 */
if (n >= MAXHOSTNAMELEN) {
@@ -349,6 +350,7 @@ gethostanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
bp += n;
_map_v4v6_hostent(he, &bp, ep);
}
#endif
RES_SET_H_ERRNO(statp, NETDB_SUCCESS);
return (0);
#endif
@@ -424,8 +426,10 @@ gethostanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
he->h_name = bp;
bp += n;
}
#ifdef INET6
if (statp->options & RES_USE_INET6)
_map_v4v6_hostent(he, &bp, ep);
#endif
RES_SET_H_ERRNO(statp, NETDB_SUCCESS);
return (0);
}
@@ -699,11 +703,13 @@ _dns_gethostbyaddr(void *rval, void *cb_data, va_list ap)
memcpy(hed->host_addr, uaddr, len);
hed->h_addr_ptrs[0] = (char *)hed->host_addr;
hed->h_addr_ptrs[1] = NULL;
#ifdef INET6
if (af == AF_INET && (statp->options & RES_USE_INET6)) {
_map_v4v6_address((char*)hed->host_addr, (char*)hed->host_addr);
he.h_addrtype = AF_INET6;
he.h_length = NS_IN6ADDRSZ;
}
#endif
if (__copy_hostent(&he, hptr, buffer, buflen) != 0) {
*errnop = errno;
RES_SET_H_ERRNO(statp, NETDB_INTERNAL);