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