Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] clnt_com_create: Restore backwards compatibility with the legacy glibc code.
@ 2018-04-09 17:28 Steve Dickson
  2018-04-09 17:32 ` Chuck Lever
  0 siblings, 1 reply; 10+ messages in thread
From: Steve Dickson @ 2018-04-09 17:28 UTC (permalink / raw)
  To: Libtirpc-devel Mailing List; +Cc: Linux NFS Mailing list

Commit 46e04a73 changed clnt_com_create() to avoid
using reserved ports when creating the the CLIENT ptr.
This change breaks backward compatibility with the
legacy RPC code that was in glibc.

This patch reverts that commit to restore backwards compatibility

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 src/rpc_soc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/rpc_soc.c b/src/rpc_soc.c
index af6c482..ed0892a 100644
--- a/src/rpc_soc.c
+++ b/src/rpc_soc.c
@@ -67,8 +67,6 @@
 
 extern mutex_t	rpcsoc_lock;
 
-extern int __binddynport(int fd);
-
 static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
     int *, u_int, u_int, char *, int);
 static SVCXPRT *svc_com_create(int, u_int, u_int, char *);
@@ -147,8 +145,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags)
 	bindaddr.maxlen = bindaddr.len =  sizeof (struct sockaddr_in);
 	bindaddr.buf = raddr;
 
-	if (__binddynport(fd) == -1)
-		goto err;
+	bindresvport(fd, NULL);
 	cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers,
 				sendsz, recvsz);
 	if (cl) {
@@ -316,6 +313,7 @@ svc_com_create(fd, sendsize, recvsize, netid)
 	SVCXPRT *svc;
 	int madefd = FALSE;
 	int port;
+	struct sockaddr_in sin;
 
 	if ((nconf = __rpc_getconfip(netid)) == NULL) {
 		(void) syslog(LOG_ERR, "Could not get %s transport", netid);
@@ -332,6 +330,10 @@ svc_com_create(fd, sendsize, recvsize, netid)
 		madefd = TRUE;
 	}
 
+	memset(&sin, 0, sizeof sin);
+	sin.sin_family = AF_INET;
+	bindresvport(fd, &sin);
+	listen(fd, SOMAXCONN);
 	svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize);
 	(void) freenetconfigent(nconf);
 	if (svc == NULL) {
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-04-11 15:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-09 17:28 [PATCH] clnt_com_create: Restore backwards compatibility with the legacy glibc code Steve Dickson
2018-04-09 17:32 ` Chuck Lever
2018-04-09 17:58   ` Steve Dickson
2018-04-09 18:40     ` Chuck Lever
2018-04-09 20:04       ` Steve Dickson
2018-04-09 21:11         ` Chuck Lever
2018-04-10 15:21           ` Steve Dickson
2018-04-10 22:43             ` Chuck Lever
2018-04-11 14:10               ` Steve Dickson
2018-04-11 15:09                 ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox