Skip to contentSkip to conversation

mount.nfs: protocol version set on command line being ignored

PATCH In review Steve Dickson 1 participant 2 messages Oct 8, 2009 – Oct 9, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.nfs: protocol version set on command line being ignored

Here is a bug that was found in some recent test cycles...

Author: Steve Dickson <[email protected]>
Date:   Thu Oct 8 10:56:57 2009 -0400

There are a number of different mount options that can be used to set the protocol version on the command line. The config file code needs to know about each option so the command line value will override the config file value.

utils/mount/configfile.c +20 -0
index e347b0e..b0aa6f0 100644
@@ -185,6 +185,20 @@ void free_all(void)
 		free(entry);
 	}
 }
+static char *versions[] = {"v2", "v3", "v4", "vers", "nfsvers", NULL};
+int inline check_vers(char *mopt, char *field)
+{
+	int i;
+
+	if (strncmp("mountvers", field, strlen("mountvers") != 0 &&
+			(strcasecmp(field, "nfsvers") == 0 || 
+				strcasecmp(field, "vers") == 0))) {
+		for (i=0; versions[i]; i++) 
+			if (strcasestr(mopt, versions[i]) != NULL)
+				return 1;
+	}
+	return 0;
+}
 /*
  * Parse the given section of the configuration 
  * file to if there are any mount options set.
@@ -207,6 +221,12 @@ conf_parse_mntopts(char *section, char *arg, char *opts)
 		snprintf(buf, BUFSIZ, "%s=", node->field);
 		if (opts && strcasestr(opts, buf) != NULL)
 			continue;
+		/* 
+		 * Protocol verions can be set in a number of ways
+		 */
+		if (opts && check_vers(opts, node->field))
+			continue;
+
 		if (lookup_entry(node->field) != NULL)
 			continue;
 		buf[0] = '\0';

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 6 lines · Steve Dickson

Here is a bug that was found in some recent test cycles...

Author: Steve Dickson <[email protected]>
Date:   Thu Oct 8 10:56:57 2009 -0400
Quoted 7 lines

There are a number of different mount options that can be used to set the protocol version on the command line. The config file code needs to know about each option so the command line value will override the config file value.

Committed...

steved