From 26a5fb0e74b6d5dbb0a95eebe895bcaba063ae15 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 28 Feb 2020 01:25:08 +0800 Subject: [PATCH] nshlib: cmd_nfsmount support the mount through domain name Change-Id: I9e4bfd6aee9ac4bd625e3bc66b6e196b013ca172 Signed-off-by: Xiang Xiao --- nshlib/nsh_mntcmds.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c index 0748a8c61..0e4a1df5e 100644 --- a/nshlib/nsh_mntcmds.c +++ b/nshlib/nsh_mntcmds.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -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) {