fs: nfs: Introduce CONFIG_NFS_DONT_BIND_TCP_SOCKET

Summary:
- Some network drivers such as GS2200M do not support to bind
  a local port for TCP client socket. In this case, this config
  disables to bind the port.
- See also https://github.com/apache/nuttx/pull/3707

Impact:
- None

Testing:
- Tested with spresense:wifi_smp (Kconfig will be updated later)
- Tested with sabre-6quad:netnsh_smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2023-06-30 14:57:33 +09:00 committed by Xiang Xiao
parent 221d919b77
commit c2af551355
2 changed files with 20 additions and 0 deletions

View file

@ -13,6 +13,15 @@ config NFS
#if NFS
config NFS_DONT_BIND_TCP_SOCKET
bool
default n
depends on NFS
---help---
Some network drivers such as GS2200M do not support to bind
a local port for TCP client socket. In this case, this config
disables to bind the port.
config NFS_STATISTICS
bool "NFS Statistics"
default n

View file

@ -240,6 +240,13 @@ static int rpcclnt_socket(FAR struct rpcclnt *rpc, in_port_t rport)
goto bad;
}
#ifdef CONFIG_NFS_DONT_BIND_TCP_SOCKET
if (rpc->rc_sotype == SOCK_STREAM)
{
goto connect;
}
#endif
/* Some servers require that the client port be a reserved port
* number. We always allocate a reserved port, as this prevents
* filehandle disclosure through UDP port capture.
@ -263,6 +270,10 @@ static int rpcclnt_socket(FAR struct rpcclnt *rpc, in_port_t rport)
goto bad;
}
#ifdef CONFIG_NFS_DONT_BIND_TCP_SOCKET
connect:
#endif
/* Protocols that do not require connections could be optionally left
* unconnected. That would allow servers to reply from a port other than
* the NFS_PORT.