From 74a69831556c91ef9c410a38f1e2bd37c305322f Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 28 Apr 2016 11:27:49 +0200 Subject: [PATCH] resolv: Remove RESOLVSORT preprocess conditionals --- ChangeLog | 7 +++++++ resolv/gethnamaddr.c | 8 -------- resolv/nss_dns/dns-host.c | 4 ---- resolv/res_init.c | 11 ----------- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55ed914..47ef7a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2016-04-28 Florian Weimer + * resolv/gethnamaddr.c (RESOLVSORT): Do not define. Remove + RESOLVSORT preprocessor conditionals. + * resolv/nss_dns/dns-host.c: Likewise. + * resolv/res_init.c: Likewise. + +2016-04-28 Florian Weimer + * resolv/res_data.c: Remove code conditional on BIND_UPDATE. It is never defined. diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 2e92df8..2c71313 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -67,8 +67,6 @@ #include #include -#define RESOLVSORT - #ifndef LOG_AUTH # define LOG_AUTH 0 #endif @@ -107,9 +105,7 @@ static int stayopen = 0; static void map_v4v6_address (const char *src, char *dst) __THROW; static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW; -#ifdef RESOLVSORT extern void addrsort (char **, int) __THROW; -#endif #if PACKETSZ > 65536 #define MAXPACKET PACKETSZ @@ -434,7 +430,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype) if (haveanswer) { *ap = NULL; *hap = NULL; -# if defined(RESOLVSORT) /* * Note: we sort even if host can take only one address * in its return structures - should give it the "best" @@ -442,7 +437,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype) */ if (_res.nsort && haveanswer > 1 && qtype == T_A) addrsort(h_addr_ptrs, haveanswer); -# endif /*RESOLVSORT*/ if (!host.h_name) { n = strlen(qname) + 1; /* for the \0 */ if (n > buflen || n >= MAXHOSTNAMELEN) @@ -929,7 +923,6 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp) } } -#ifdef RESOLVSORT extern void addrsort (char **ap, int num) { @@ -970,7 +963,6 @@ addrsort (char **ap, int num) needsort++; } } -#endif #if defined(BSD43_BSD43_NFS) || defined(sun) /* some libc's out there are bound internally to these names (UMIPS) */ diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 403a005..93fee10 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -556,7 +556,6 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af, errnop, h_errnop, NULL); } -#ifdef RESOLVSORT static void addrsort (char **ap, int num); static void @@ -600,7 +599,6 @@ addrsort (char **ap, int num) else break; } -#endif static enum nss_status getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, @@ -955,7 +953,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, { *ap = NULL; *hap = NULL; -#if defined RESOLVSORT /* * Note: we sort even if host can take only one address * in its return structures - should give it the "best" @@ -963,7 +960,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, */ if (_res.nsort && haveanswer > 1 && qtype == T_A) addrsort (host_data->h_addr_ptrs, haveanswer); -#endif /*RESOLVSORT*/ if (result->h_name == NULL) { diff --git a/resolv/res_init.c b/resolv/res_init.c index de96d84..da1f79e 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -85,18 +85,15 @@ #include /* Options. Should all be left alone. */ -#define RESOLVSORT #define RFC1535 /* #undef DEBUG */ static void res_setoptions (res_state, const char *, const char *) internal_function; -#ifdef RESOLVSORT static const char sort_mask_chars[] = "/&"; #define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL) static u_int32_t net_mask (struct in_addr) __THROW; -#endif #if !defined(isascii) /* XXX - could be a function */ # define isascii(c) (!(c & 0200)) @@ -134,10 +131,8 @@ __res_vinit(res_state statp, int preinit) { int have_serv6 = 0; int haveenv = 0; int havesearch = 0; -#ifdef RESOLVSORT int nsort = 0; char *net; -#endif #ifndef RFC1535 int dots; #endif @@ -328,7 +323,6 @@ __res_vinit(res_state statp, int preinit) { } continue; } -#ifdef RESOLVSORT if (MATCH(buf, "sortlist")) { struct in_addr a; @@ -370,7 +364,6 @@ __res_vinit(res_state statp, int preinit) { } continue; } -#endif if (MATCH(buf, "options")) { res_setoptions(statp, buf + sizeof("options") - 1, "conf"); continue; @@ -381,9 +374,7 @@ __res_vinit(res_state statp, int preinit) { /* We try IPv6 servers again. */ statp->ipv6_unavail = false; } -#ifdef RESOLVSORT statp->nsort = nsort; -#endif (void) fclose(fp); } if (__builtin_expect(statp->nscount == 0, 0)) { @@ -524,7 +515,6 @@ res_setoptions(res_state statp, const char *options, const char *source) { } } -#ifdef RESOLVSORT /* XXX - should really support CIDR which means explicit masks always. */ /* XXX - should really use system's version of this */ static u_int32_t @@ -538,7 +528,6 @@ net_mask (struct in_addr in) return (htonl(IN_CLASSB_NET)); return (htonl(IN_CLASSC_NET)); } -#endif u_int res_randomid(void) { -- 2.7.4