AI_* defines in netdb.h

Natanael Copa natanael.copa at gmail.com
Thu Nov 8 02:02:32 PST 2007


from the libc/inet/getaddrinfo.c:

/* The following declarations and definitions have been removed from
 *    the public header since we don't want people to use them.  */
#define AI_V4MAPPED     0x0008  /* IPv4-mapped addresses are acceptable.  */
#define AI_ALL          0x0010  /* Return both IPv4 and IPv6 addresses.  */
#define AI_ADDRCONFIG   0x0020  /* Use configuration of this host to choose 
                                    returned address type.  */
#define AI_DEFAULT    (AI_V4MAPPED | AI_ADDRCONFIG)

It looks that those defines made its way to the netdb.h in r11195
anyway:

@@ -401,6 +572,21 @@
 # define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
 # define AI_CANONNAME  0x0002  /* Request for canonical name.  */
 # 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..  */
...

My question is, are the AI_* flags supposed to be in the public header
or not? If they are supposed to be there, we should remove the defines
and comment in getaddrinfo.c.

If we should remove it from the public header, we can also save som
space by removing the addrconfig() func in getaddrinfo.c.

Personally I don't understand why the flag exist at all. You will need
to check that your socket were successfully created anyway. Why check
twice?

-nc



More information about the uClibc mailing list