about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_send.c9
-rw-r--r--resolv/resolv.h12
2 files changed, 20 insertions, 1 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index bf500b1df7..735fba342c 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -361,6 +361,9 @@ res_nsend(res_state statp,
 		else
 			for (ns = 0; ns < statp->nscount; ns++)
 				if (!sock_eq(&statp->nsaddr_list[ns],
+#ifdef _LIBC
+					     (struct sockaddr_in *)
+#endif
 					     &EXT(statp).nsaddrs[ns])) {
 					needclose++;
 					break;
@@ -374,7 +377,13 @@ res_nsend(res_state statp,
 	 */
 	if (EXT(statp).nscount == 0) {
 		for (ns = 0; ns < statp->nscount; ns++) {
+#ifdef _LIBC
+			memcpy(&EXT(statp).nsaddrs[ns],
+			       &statp->nsaddr_list[ns],
+			       sizeof (&EXT(statp).nsaddrs[0]));
+#else
 			EXT(statp).nsaddrs[ns] = statp->nsaddr_list[ns];
+#endif
 			EXT(statp).nstimes[ns] = RES_MAXTIME;
 			EXT(statp).nssocks[ns] = -1;
 		}
diff --git a/resolv/resolv.h b/resolv/resolv.h
index 058c631279..d9f798b3b2 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -123,6 +123,16 @@ struct res_sym {
 #define	RES_DFLRETRY		2	/* Default #/tries. */
 #define	RES_MAXTIME		65535	/* Infinity, in milliseconds. */
 
+/*
+ * Like "struct sockaddr_in", but without any padding (to avoid making
+ * "struct __rest_state" too large).
+ */
+struct __sockaddr_in {
+	__SOCKADDR_COMMON (sin_);
+	in_port_t	sin_port;
+	struct in_addr	sin_addr;
+};
+
 struct __res_state {
 	int	retrans;	 	/* retransmition time interval */
 	int	retry;			/* number of times to retransmit */
@@ -153,7 +163,7 @@ struct __res_state {
 			u_int16_t		nscount;
 			u_int16_t		nstimes[MAXNS];	/* ms. */
 			int			nssocks[MAXNS];
-			struct sockaddr_in	nsaddrs[MAXNS];
+			struct __sockaddr_in	nsaddrs[MAXNS];
 		} _ext;
 	} _u;
 };