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