You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/27 18:50:05 UTC
[incubator-nuttx-apps] 02/03: nshlib: cmd_nfsmount support the
mount through domain name
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr107
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 26a5fb0e74b6d5dbb0a95eebe895bcaba063ae15
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 28 01:25:08 2020 +0800
nshlib: cmd_nfsmount support the mount through domain name
Change-Id: I9e4bfd6aee9ac4bd625e3bc66b6e196b013ca172
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
nshlib/nsh_mntcmds.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c
index 0748a8c..0e4a1df 100644
--- a/nshlib/nsh_mntcmds.c
+++ b/nshlib/nsh_mntcmds.c
@@ -49,6 +49,7 @@
#include <unistd.h>
#include <errno.h>
#include <debug.h>
+#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -279,6 +280,23 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Convert the IP address string into its binary form */
+#ifdef CONFIG_LIBC_NETDB
+ if (data.addrlen == 0)
+ {
+ FAR struct addrinfo *res;
+ char serv[16];
+
+ itoa(NFS_PMAPPORT, serv, 10);
+ ret = getaddrinfo(address, serv, NULL, &res);
+ if (ret == OK)
+ {
+ data.addrlen = res->ai_addrlen;
+ memcpy(&data.addr, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
+ }
+ }
+#endif
+
#ifdef CONFIG_NET_IPv6
if (data.addrlen == 0)
{