e55890
From 90416594843a56550e40b11561807786219ce1c4 Mon Sep 17 00:00:00 2001
e55890
From: Evan Hunt <each@isc.org>
e55890
Date: Mon, 11 Sep 2017 15:01:36 -0700
e55890
Subject: [PATCH] remap getaddrinfo() to irs_getgetaddrinfo()
e55890
e55890
The libirs version of getaddrinfo() cannot be called from within BIND9.
e55890
e55890
fix prototypes
e55890
---
e55890
 lib/irs/include/irs/netdb.h.in | 94 ++++++++++++++++++++++++++++++++++++++++++
e55890
 1 file changed, 94 insertions(+)
e55890
e55890
diff --git a/lib/irs/include/irs/netdb.h.in b/lib/irs/include/irs/netdb.h.in
e55890
index 23dcd37..f36113d 100644
e55890
--- a/lib/irs/include/irs/netdb.h.in
e55890
+++ b/lib/irs/include/irs/netdb.h.in
e55890
@@ -150,6 +150,100 @@ struct addrinfo {
e55890
 #define	NI_DGRAM	0x00000010
e55890
 
e55890
 /*
e55890
+ * Define to map into irs_ namespace.
e55890
+ */
e55890
+
e55890
+#define IRS_NAMESPACE
e55890
+
e55890
+#ifdef IRS_NAMESPACE
e55890
+
e55890
+/*
e55890
+ * Use our versions not the ones from the C library.
e55890
+ */
e55890
+
e55890
+#ifdef getnameinfo
e55890
+#undef getnameinfo
e55890
+#endif
e55890
+#define getnameinfo irs_getnameinfo
e55890
+
e55890
+#ifdef getaddrinfo
e55890
+#undef getaddrinfo
e55890
+#endif
e55890
+#define getaddrinfo irs_getaddrinfo
e55890
+
e55890
+#ifdef freeaddrinfo
e55890
+#undef freeaddrinfo
e55890
+#endif
e55890
+#define freeaddrinfo irs_freeaddrinfo
e55890
+
e55890
+#ifdef gai_strerror
e55890
+#undef gai_strerror
e55890
+#endif
e55890
+#define gai_strerror irs_gai_strerror
e55890
+
e55890
+#endif
e55890
+
e55890
+extern int getaddrinfo (const char *name,
e55890
+			const char *service,
e55890
+			const struct addrinfo *req,
e55890
+			struct addrinfo **pai);
e55890
+extern int getnameinfo (const struct sockaddr *sa,
e55890
+			socklen_t salen, char *host,
e55890
+			socklen_t hostlen, char *serv,
e55890
+			socklen_t servlen, int flags);
e55890
+extern void freeaddrinfo (struct addrinfo *ai);
e55890
+extern const char *gai_strerror (int ecode);
e55890
+
e55890
+/*
e55890
+ * Define to map into irs_ namespace.
e55890
+ */
e55890
+
e55890
+#define IRS_NAMESPACE
e55890
+
e55890
+#ifdef IRS_NAMESPACE
e55890
+
e55890
+/*
e55890
+ * Use our versions not the ones from the C library.
e55890
+ */
e55890
+
e55890
+#ifdef getnameinfo
e55890
+#undef getnameinfo
e55890
+#endif
e55890
+#define getnameinfo irs_getnameinfo
e55890
+
e55890
+#ifdef getaddrinfo
e55890
+#undef getaddrinfo
e55890
+#endif
e55890
+#define getaddrinfo irs_getaddrinfo
e55890
+
e55890
+#ifdef freeaddrinfo
e55890
+#undef freeaddrinfo
e55890
+#endif
e55890
+#define freeaddrinfo irs_freeaddrinfo
e55890
+
e55890
+#ifdef gai_strerror
e55890
+#undef gai_strerror
e55890
+#endif
e55890
+#define gai_strerror irs_gai_strerror
e55890
+
e55890
+int
e55890
+getaddrinfo(const char *hostname, const char *servname,
e55890
+	    const struct addrinfo *hints, struct addrinfo **res);
e55890
+
e55890
+int
e55890
+getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen,
e55890
+	    char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen,
e55890
+	    char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen,
e55890
+	    IRS_GETNAMEINFO_FLAGS_T flags);
e55890
+
e55890
+void freeaddrinfo (struct addrinfo *ai);
e55890
+
e55890
+IRS_GAISTRERROR_RETURN_T
e55890
+gai_strerror(int ecode);
e55890
+
e55890
+#endif
e55890
+
e55890
+/*
e55890
  * Tell Emacs to use C mode on this file.
e55890
  * Local variables:
e55890
  * mode: c
e55890
-- 
e55890
2.9.5
e55890