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:03 UTC
[incubator-nuttx-apps] branch pr107 updated (404b330 -> 08d4527)
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a change to branch pr107
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.
from 404b330 Ensure "build" before "install"
new 11fedb6 nshlib: cmd_nfsmount should try IPv6 then IPv4 if dual stack is enabled
new 26a5fb0 nshlib: cmd_nfsmount support the mount through domain name
new 08d4527 nshlib: cmd_nfsmount support the mount with TCP protocol
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
nshlib/nsh_command.c | 2 +-
nshlib/nsh_mntcmds.c | 122 ++++++++++++++++++++++++++++++---------------------
2 files changed, 73 insertions(+), 51 deletions(-)
[incubator-nuttx-apps] 02/03: nshlib: cmd_nfsmount support the
mount through domain name
Posted by gn...@apache.org.
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)
{
[incubator-nuttx-apps] 03/03: nshlib: cmd_nfsmount support the
mount with TCP protocol
Posted by gn...@apache.org.
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 08d4527f9ed38775be1223adbfee2ed0a2086c21
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 28 01:39:16 2020 +0800
nshlib: cmd_nfsmount support the mount with TCP protocol
and make TCP as the default like Linux
Change-Id: Ic65862483f7c4e5d14c6849ff7184f64be7fc8da
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
nshlib/nsh_command.c | 2 +-
nshlib/nsh_mntcmds.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 5e84024..f078f4c 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -361,7 +361,7 @@ static const struct cmdmap_s g_cmdmap[] =
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \
defined(CONFIG_NFS)
# ifndef CONFIG_NSH_DISABLE_NFSMOUNT
- { "nfsmount", cmd_nfsmount, 4, 4, "<server-address> <mount-point> <remote-path>" },
+ { "nfsmount", cmd_nfsmount, 4, 5, "<server-address> <mount-point> <remote-path> [udp]" },
# endif
#endif
diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c
index 0e4a1df..085ead4 100644
--- a/nshlib/nsh_mntcmds.c
+++ b/nshlib/nsh_mntcmds.c
@@ -45,6 +45,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -334,7 +335,15 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- data.sotype = SOCK_DGRAM;
+ if (argc > 4 && strcmp(argv[4], "udp") == 0)
+ {
+ data.sotype = SOCK_DGRAM;
+ }
+ else
+ {
+ data.sotype = SOCK_STREAM;
+ }
+
data.path = rpath;
data.flags = 0; /* 0=Use all defaults */
[incubator-nuttx-apps] 01/03: nshlib: cmd_nfsmount should try IPv6
then IPv4 if dual stack is enabled
Posted by gn...@apache.org.
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 11fedb6b9584862ca5e8ad912050fb9887a5e2f3
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Feb 16 21:12:21 2020 +0800
nshlib: cmd_nfsmount should try IPv6 then IPv4 if dual stack is enabled
Change-Id: I0126a97a74008a860beeff363090ee6933286d45
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
nshlib/nsh_mntcmds.c | 99 +++++++++++++++++++++++++---------------------------
1 file changed, 47 insertions(+), 52 deletions(-)
diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c
index fa3b137..0748a8c 100644
--- a/nshlib/nsh_mntcmds.c
+++ b/nshlib/nsh_mntcmds.c
@@ -257,25 +257,8 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
FAR char *address;
FAR char *lpath;
FAR char *rpath;
- bool badarg = false;
-#ifdef CONFIG_NET_IPv6
- FAR struct sockaddr_in6 *sin;
- struct in6_addr inaddr;
-#else
- FAR struct sockaddr_in *sin;
- struct in_addr inaddr;
-#endif
int ret;
- /* If a bad argument was encountered, then return without processing the
- * command.
- */
-
- if (badarg)
- {
- return ERROR;
- }
-
/* The fist argument on the command line should be the NFS server IP address
* in standard IPv4 (or IPv6) dot format.
*/
@@ -286,54 +269,66 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- /* The local mount point path (lpath) might be relative to the current working
- * directory.
- */
-
- lpath = nsh_getfullpath(vtbl, argv[2]);
- if (!lpath)
- {
- return ERROR;
- }
-
/* Get the remote mount point path */
rpath = argv[3];
- /* Convert the IP address string into its binary form */
+ /* Place all of the NFS arguments into the nfs_args structure */
+
+ memset(&data, 0, sizeof(data));
+
+ /* Convert the IP address string into its binary form */
#ifdef CONFIG_NET_IPv6
- ret = inet_pton(AF_INET6, address, &inaddr);
-#else
- ret = inet_pton(AF_INET, address, &inaddr);
+ if (data.addrlen == 0)
+ {
+ FAR struct sockaddr_in6 *sin;
+
+ sin = (FAR struct sockaddr_in6 *)&data.addr;
+ ret = inet_pton(AF_INET6, address, &sin->sin6_addr);
+ if (ret == 1)
+ {
+ sin->sin6_family = AF_INET6;
+ sin->sin6_port = htons(NFS_PMAPPORT);
+ data.addrlen = sizeof(struct sockaddr_in6);
+ }
+ }
#endif
- if (ret != 1)
+
+#ifdef CONFIG_NET_IPv4
+ if (data.addrlen == 0)
{
- nsh_freefullpath(lpath);
- return ERROR;
+ FAR struct sockaddr_in *sin;
+
+ sin = (FAR struct sockaddr_in *)&data.addr;
+ ret = inet_pton(AF_INET, address, &sin->sin_addr);
+ if (ret == 1)
+ {
+ sin->sin_family = AF_INET;
+ sin->sin_port = htons(NFS_PMAPPORT);
+ data.addrlen = sizeof(struct sockaddr_in);
+ }
}
+#endif
- /* Place all of the NFS arguments into the nfs_args structure */
+ if (data.addrlen == 0)
+ {
+ return ERROR;
+ }
- memset(&data, 0, sizeof(data));
+ data.sotype = SOCK_DGRAM;
+ data.path = rpath;
+ data.flags = 0; /* 0=Use all defaults */
-#ifdef CONFIG_NET_IPv6
- sin = (FAR struct sockaddr_in6 *)&data.addr;
- sin->sin6_family = AF_INET6;
- sin->sin6_port = htons(NFS_PMAPPORT);
- memcpy(&sin->sin6_addr, &inaddr, sizeof(struct in6_addr));
- data.addrlen = sizeof(struct sockaddr_in6);
-#else
- sin = (FAR struct sockaddr_in *)&data.addr;
- sin->sin_family = AF_INET;
- sin->sin_port = htons(NFS_PMAPPORT);
- sin->sin_addr = inaddr;
- data.addrlen = sizeof(struct sockaddr_in);
-#endif
+ /* The local mount point path (lpath) might be relative to the current working
+ * directory.
+ */
- data.sotype = SOCK_DGRAM;
- data.path = rpath;
- data.flags = 0; /* 0=Use all defaults */
+ lpath = nsh_getfullpath(vtbl, argv[2]);
+ if (!lpath)
+ {
+ return ERROR;
+ }
/* Perform the mount */