nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #664: Dns the dual stack support(part 2)
Date Tue, 31 Mar 2020 12:29:05 GMT
xiaoxiang781216 commented on a change in pull request #664: Dns the dual stack support(part
2)
URL: https://github.com/apache/incubator-nuttx/pull/664#discussion_r400871412
 
 

 ##########
 File path: include/netdb.h
 ##########
 @@ -184,14 +184,17 @@ struct hostent
   FAR char **h_aliases;    /* A pointer to an array of pointers to the
                             * alternative host names, terminated by a
                             * null pointer. */
-  int        h_addrtype;   /* Address type. */
-  int        h_length;     /* The length, in bytes, of the address. */
+  FAR int   *h_addrtypes;  /* A pointer to an array of address type. */
+  FAR int   *h_lengths;    /* A pointer to an array of the length, in bytes,
+                            * of the address. */
   FAR char **h_addr_list;  /* A pointer to an array of pointers to network
                             * addresses (in network byte order) for the host,
                             * terminated by a null pointer. */
 };
 
 #define h_addr h_addr_list[0] /* For backward compatibility */
+#define h_length h_lengths[0]
+#define h_addrtype h_addrtypes[0]
 
 Review comment:
   > as gethostbyname etc should not return hostent containing multiple types anyway, there's
little point to change struct hostent.
   > for getaddrinfo, it's better to implement gethostbyname2 and use it.
   
   I also consider this solution before but:
   1.getaddrinfo need call gethostbyname2 twice.
   2.dns cache hold the name to address(multiple entries) mapping. It's hard to manage the
dns cache if we split IPv4/IPv6 query into two call.
   3.gethostbyname2 isn't POSIX too.
   
   If we want to implement getaddrinfo on top of gethostbyname or gethostbyname2, the current
method is the most clean one.
   Another way is to implement gethostbyname on top of getaddrinfo, but the change is very
huge. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message