You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/02/19 15:08:15 UTC
[GitHub] [incubator-nuttx] yamt commented on a change in pull request #2869: netdb.h: Add NI_MAXHOST and NI_MAXSERV
yamt commented on a change in pull request #2869:
URL: https://github.com/apache/incubator-nuttx/pull/2869#discussion_r579253664
##########
File path: include/netdb.h
##########
@@ -156,6 +156,28 @@
#define NO_RECOVERY 3
#define TRY_AGAIN 4
+/* NI_MAXHOST is the max of
+ *
+ * CONFIG_NETDB_DNSCLIENT_NAMESIZE + 1
+ * INET6_ADDRSTRLEN
+ * INET_ADDRSTRLEN
+ *
+ * Note: INETxxx_ADDRSTRLEN already includes the terminating NUL.
+ * Note: INET6_ADDRSTRLEN > INET_ADDRSTRLEN is assumed.
+ */
+
+#if CONFIG_NETDB_DNSCLIENT_NAMESIZE > INET6_ADDRSTRLEN
+#define NI_MAXHOST CONFIG_NETDB_DNSCLIENT_NAMESIZE
+#else
+#define NI_MAXHOST INET6_ADDRSTRLEN
Review comment:
> should we check CONFIG_NET_IPv6 and CONFIG_NET_IPv4 here?
maybe.
> And should we replace CONFIG_NETDB_DNSCLIENT_NAMESIZE in source code with NI_MAXHOST? since NI_MAXHOST may different from CONFIG_NETDB_DNSCLIENT_NAMESIZE.
it depends.
----------------------------------------------------------------
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