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