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