[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NetBSD 5.0’s <netdb.h> lacks AI_* macros
From: |
Simon Josefsson |
Subject: |
Re: NetBSD 5.0’s <netdb.h> lacks AI_* macros |
Date: |
Wed, 17 Feb 2010 09:27:54 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) |
address@hidden (Ludovic Courtès) writes:
> Hello,
>
> NetBSD 5.0’s <netdb.h> doesn’t define ‘AI_ALL’, ‘AI_V4MAPPED’, and
> ‘AI_ADDRCONFIG’. This can be worked around with something like this:
>
> #ifndef AI_ALL
> # define AI_ALL 0
> #endif
> #ifndef AI_V4MAPPED
> # define AI_V4MAPPED 0
> #endif
> #ifndef AI_ADDRCONFIG
> # define AI_ADDRCONFIG 0
> #endif
Thanks, fixed as below. Note that _support_ for these symbols is not
required by POSIX (it is conditional on IPv6 support), but the symbols
are required to be defined. So this is a bug in NetBSD netdb.h and
should be reported.
/Simon
>From be51f2652b95b8b7b8778039c012d0c9c70741a0 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Wed, 17 Feb 2010 09:19:03 +0100
Subject: [PATCH] netdb.h: Define AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG when needed.
---
ChangeLog | 6 ++++++
lib/netdb.in.h | 28 +++++++++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1609f87..b3d0853 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-17 Simon Josefsson <address@hidden>
+
+ * lib/netdb.in.h (AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG): Define to 0
+ if not provided by the system's netdb.h. Reported by
+ address@hidden (Ludovic Courtès).
+
2010-02-15 Jim Meyering <address@hidden>
maint.mk: mark syntax-check sc_*.m rules as .PHONY
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 6f3695b..def9b5f 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -74,18 +74,24 @@ struct addrinfo
# endif
# if 0
-/* The commented out definitions below are not yet implemented in the
- GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
- cause conflicts on systems with a getaddrinfo() function which does not
- define them.
-
- If they are restored, be sure to protect the definitions with #ifndef. */
# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
-# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
-# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6
addresses. */
-# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
- returned address type.. */
-# endif /* 0 */
+# endif
+
+/* These symbolic constants are required to be present by POSIX, but
+ our getaddrinfo replacement doesn't use them (yet). Setting them
+ to 0 on systems that doesn't have them avoids causing problems for
+ system getaddrinfo implementations that would be confused by
+ unknown values. */
+# ifndef AI_V4MAPPED
+# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */
+# endif
+# ifndef AI_ALL
+# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
+# endif
+# ifndef AI_ADDRCONFIG
+# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose
+ returned address type.. */
+# endif
/* Error values for `getaddrinfo' function. */
# ifndef EAI_BADFLAGS
--
1.6.6.1