Merge "Delete unused variable res_state.rstatic"
am: 852c08e595
Change-Id: Iab83baa30b3984ccec797cdc131ad29dac89bb4d
diff --git a/gethnamaddr.cpp b/gethnamaddr.cpp
index c9a6b2a..a2e88b4 100644
--- a/gethnamaddr.cpp
+++ b/gethnamaddr.cpp
@@ -76,6 +76,7 @@
#include "netd_resolv/resolv.h"
#include "resolv_cache.h"
#include "resolv_private.h"
+#include "resolv_static.h"
#include "stats.pb.h"
using android::net::NetworkDnsEventReported;
diff --git a/res_send.cpp b/res_send.cpp
index 30d1cd2..6616ca3 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -290,16 +290,8 @@
}
}
-/* int
- * res_isourserver(ina)
- * looks up "ina" in _res.ns_addr_list[]
- * returns:
- * 0 : not found
- * >0 : found
- * author:
- * paul vixie, 29may94
- */
-static int res_ourserver_p(res_state statp, const sockaddr* sa) {
+// Looks up the nameserver address in res.nsaddrs[], returns true if found, otherwise false.
+static bool res_ourserver_p(res_state statp, const sockaddr* sa) {
const sockaddr_in *inp, *srv;
const sockaddr_in6 *in6p, *srv6;
int ns;
@@ -312,7 +304,7 @@
if (srv->sin_family == inp->sin_family && srv->sin_port == inp->sin_port &&
(srv->sin_addr.s_addr == INADDR_ANY ||
srv->sin_addr.s_addr == inp->sin_addr.s_addr))
- return 1;
+ return true;
}
break;
case AF_INET6:
@@ -325,13 +317,13 @@
#endif
(IN6_IS_ADDR_UNSPECIFIED(&srv6->sin6_addr) ||
IN6_ARE_ADDR_EQUAL(&srv6->sin6_addr, &in6p->sin6_addr)))
- return 1;
+ return true;
}
break;
default:
break;
}
- return 0;
+ return false;
}
/* int
diff --git a/res_state.cpp b/res_state.cpp
index 7606e0b..316a4f9 100644
--- a/res_state.cpp
+++ b/res_state.cpp
@@ -41,6 +41,7 @@
#include "res_init.h"
#include "resolv_cache.h"
#include "resolv_private.h"
+#include "resolv_static.h"
typedef struct {
// TODO: Have one __res_state per network so we don't have to repopulate frequently.
diff --git a/resolv_private.h b/resolv_private.h
index 903f881..4c881c2 100644
--- a/resolv_private.h
+++ b/resolv_private.h
@@ -65,7 +65,6 @@
#include "netd_resolv/params.h"
#include "netd_resolv/resolv.h"
#include "netd_resolv/stats.h"
-#include "resolv_static.h"
#include "stats.pb.h"
// Linux defines MAXHOSTNAMELEN as 64, while the domain name limit in
@@ -82,11 +81,11 @@
#define RES_DFLRETRY 2 /* Default #/tries. */
// Holds either a sockaddr_in or a sockaddr_in6.
-typedef union sockaddr_union {
+union sockaddr_union {
struct sockaddr sa;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
-} sockaddr_union;
+};
struct __res_state {
unsigned netid; // NetId: cache key and socket mark
@@ -95,12 +94,11 @@
uint16_t id; // current message id
std::vector<std::string> search_domains; // domains to search
sockaddr_union nsaddrs[MAXNS];
- int nssocks[MAXNS];
+ int nssocks[MAXNS]; // UDP sockets to nameservers
unsigned ndots : 4; // threshold for initial abs. query
- unsigned _mark; /* If non-0 SET_MARK to _mark on all request sockets */
- int _vcsock; /* PRIVATE: for res_send VC i/o */
- uint32_t _flags; /* PRIVATE: see below */
- struct res_static rstatic[1];
+ unsigned _mark; // If non-0 SET_MARK to _mark on all request sockets
+ int _vcsock; // TCP socket (but why not one per nameserver?)
+ uint32_t _flags; // See RES_F_* defines below
android::net::NetworkDnsEventReported* event;
uint32_t netcontext_flags;
};
diff --git a/sethostent.cpp b/sethostent.cpp
index 6423bee..acd7151 100644
--- a/sethostent.cpp
+++ b/sethostent.cpp
@@ -42,6 +42,7 @@
#include "hostent.h"
#include "resolv_private.h"
+#include "resolv_static.h"
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES)