diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-07 16:42:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-07 16:46:11 +0200 |
commit | c533aca08e29d4f659ca0ac011e5162b483dc6a9 (patch) | |
tree | f26ee0138d7d1f34409d2aa8b7bd5d05768265a7 /libc | |
parent | f22cca4722fa66e424562e69f4afa2bca0af871d (diff) |
pmap_getport: use TCP to talk to portmapper if protocol == IPPROTO_TCP.
Before the patch, the query itself was sent via UDP
(the query contained correct protocol ID).
The fix is taken from glibc.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libc')
-rw-r--r-- | libc/inet/rpc/pm_getport.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libc/inet/rpc/pm_getport.c b/libc/inet/rpc/pm_getport.c index ac20bb18c..9a0e79178 100644 --- a/libc/inet/rpc/pm_getport.c +++ b/libc/inet/rpc/pm_getport.c @@ -65,7 +65,19 @@ pmap_getport (struct sockaddr_in *address, u_long program, u_long version, struct pmap parms; address->sin_port = htons (PMAPPORT); - client = clntudp_bufcreate (address, PMAPPROG, + if (protocol == IPPROTO_TCP) + { + // glibc does this: + ///* Don't need a reserved port to get ports from the portmapper. */ + //socket = __get_socket(address); // does socket(TCP),bind(),connect(address) + //if (_socket != -1) + // closeit = true; + // do we need/want to do the same? + client = clnttcp_create (address, PMAPPROG, + PMAPVERS, &_socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + } + else + client = clntudp_bufcreate (address, PMAPPROG, PMAPVERS, timeout, &_socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); if (client != (CLIENT *) NULL) { |