Skip to contentSkip to conversation

mountd --no-tcp -p bugs?

DISCUSSION Ben Leslie 2 participants 3 messages Feb 11, 2003 – Feb 19, 2003

Subsystems (2)
lore
Share & tools
lore

Ben Leslie

author
#0 lore raw

Hi all,

I'm running into a couple of problems with mountd.

I'm using nfs-kernel-server version 1:1.0-2 package provided in Debian stable. However looking at the source seems to indicate the same problems would exist in current cvs version.

Problem 1/

The -n flag (short for --no-tcp) is ignored.

To reproduce: rpc.mountd -n

The problem seems to be in utils/mountd/mountd.c.

while ((c = getopt_long(argc, argv, "o:Fd:f:p:P:hN:V:v", longopts, NULL)) != EOF)

Probably should be:

while ((c = getopt_long(argc, argv, "o:Fd:f:p:P:hN:V:vn", longopts, NULL)) != EOF)

Problem 2/

The --no-tcp and -p <portnum> options don't play well together. Specifically, if you specify --no-tcp the -p option is ignored. I couldn't find anything to indicate that this was the desired behaviour.

The problem here seems to be in the rpc_init() function (support/nfs/rpcmisc.c).

Specifically this bit:

if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
	static SVCXPRT *last_transp = NULL;
 
	if (_rpcfdtype == 0) {
		if (last_transp
		    && (!defport || defport == last_transp->xp_port)) {
			transp = last_transp;
			goto udp_transport;
		}
		if (defport == 0)
			sock = RPC_ANYSOCK;
		else if ((sock = makesock(defport, IPPROTO_UDP)) < 0) {
			xlog(L_FATAL, "%s: cannot make a UDP socket\n",
					name);
		}
	}
	if (sock == RPC_ANYSOCK)
		sock = svcudp_socket (prog, 1);
	transp = svcudp_create(sock);

defport is only looked at if the _rpcfgtype is set to zero, which seems to me to be incorrect behaviour. However, since the rpc_init() function is probably used by things other than mountd, chaning this behaviour may have other unintended side affects. (Or I could be wrong and this is indeed the correct behaviour, in which case the docs should probably explain this.)

Cheers,

Benno

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#1 lore raw
Quoted 3 lines · Benno

Hi all,

I'm running into a couple of problems with mountd.

Hi again,

I haven't had any feedback on this email from a few days ago. Is this not a bug and I'm missing something, or just no one cares about bugs in client programs, or am I just being impatient?

Thanks again,

Benno

-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
Quoted 4 lines · On Friday February 14, [email protected] wrote:
Quoted 2 lines · Benno

Hi all,

Quoted 8 lines
Quoted 1 line

I'm running into a couple of problems with mountd.

Hi again,

I haven't had any feedback on this email from a few days ago. Is this not a bug and I'm missing something, or just no one cares about bugs in client programs, or am I just being impatient?

It is a bug.
You aren't missing much.
People do care, but are also busy.
You were reasonably patient, and it does help to ask again (and again...) if you don't get a response. It gives an indication of how important it is, and helps people with short memory and long todo lists.

I have just committed the following patch to the nfs-utils CVS. It should address your issues.

NeilBrown

Index: ChangeLog
===================================================================
RCS file: /cvsroot/nfs/nfs-utils/ChangeLog,v
retrieving revision 1.187

ChangeLog +13 -0
diff -u -r1.187 ChangeLog
@@ -1,3 +1,16 @@
+2003-02-19 NeilBrown <[email protected]>	
+	Ben Leslie <[email protected]>
+
+	* support/nfs/rpcmisc.c(rpc_init):  change test for ignoring
+	"defport" from (__rpcfdtype == 0) to (__rpcpmstart==0).  The
+	former would incorectly ignore defport if the application 
+	explicitly set __rpcfdtype.  The later is sufficient to avoid the
+	special handling in the case where stdin is an internet socket.
+
+	* utils/mountd/mountd.c(main): Add 'n' to option list in
+	getopt_long as this is a short form of --no-tcp which want being
+	checked.
+	
 2003-02-12  Chip Salzenberg  <[email protected]>
 
 	* debian/changelog: Version 1.0.2-2.

Index: support/nfs/rpcmisc.c
===================================================================
RCS file: /cvsroot/nfs/nfs-utils/support/nfs/rpcmisc.c,v retrieving revision 1.13

nfs/rpcmisc.c +2 -2
diff -u -r1.13 rpcmisc.c
@@ -66,7 +66,7 @@
 	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
 		static SVCXPRT *last_transp = NULL;
  
-		if (_rpcfdtype == 0) {
+		if (_rpcpmstart == 0) {
 			if (last_transp
 			    && (!defport || defport == last_transp->xp_port)) {
 				transp = last_transp;
@@ -96,7 +96,7 @@
 	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
 		static SVCXPRT *last_transp = NULL;
 
-		if (_rpcfdtype == 0) {
+		if (_rpcpmstart == 0) {
 			if (last_transp
 			    && (!defport || defport == last_transp->xp_port)) {
 				transp = last_transp;

Index: utils/mountd/mountd.c
===================================================================
RCS file: /cvsroot/nfs/nfs-utils/utils/mountd/mountd.c,v retrieving revision 1.13

mountd/mountd.c +1 -1
diff -u -r1.13 mountd.c
@@ -399,7 +399,7 @@
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;
-	while ((c = getopt_long(argc, argv, "o:Fd:f:p:P:hN:V:v", longopts, NULL)) != EOF)
+	while ((c = getopt_long(argc, argv, "on:Fd:f:p:P:hN:V:v", longopts, NULL)) != EOF)
 		switch (c) {
 		case 'o':
 			descriptors = atoi(optarg);

-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs