nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] juniskane commented on a change in pull request #892: Netdb multiple dns servers pr
Date Mon, 27 Apr 2020 06:14:47 GMT

juniskane commented on a change in pull request #892:
URL: https://github.com/apache/incubator-nuttx/pull/892#discussion_r415533560



##########
File path: libs/libc/netdb/lib_dnsaddserver.c
##########
@@ -198,10 +198,24 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen)
 {
   FAR uint16_t *pport;
   size_t copylen;
+  int nservers;
+  int idx;
 
   DEBUGASSERT(addr != NULL);
 
-  /* Copy the new server IP address into our private global data structure */
+  /* Get the index of the next free nameserver slot. */
+
+  dns_semtake();
+  if (g_dns_nservers == CONFIG_NETDB_DNSSERVER_NAMESERVERS)

Review comment:
       Perhaps, but note that the resolv.conf version of the function appends the new nameserver
at the end of the file. It should be changed to match for consistency. I would leave that
to some future PR.
   
   I think the most common use case is to get DNS1, DNS2,... IPs from operator and then add
entire list by first calling dns_default_nameserver() and then add the DNS1, DNS2, DNS3...
and maybe add some generic fallback server like Google's 8.8.8.8 as *last* in case operator's
preferred servers are down.




----------------------------------------------------------------
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



Mime
View raw message