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