Blame SOURCES/autofs-5.0.7-check-for-protocol-option.patch

306fa1
autofs-5.0.7 - check for protocol option
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
When a specific protocol is requested in the mount options only
306fa1
that protocol should be probed for.
306fa1
---
306fa1
 modules/mount_nfs.c |   10 ++++++++++
306fa1
 1 file changed, 10 insertions(+)
306fa1
306fa1
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
306fa1
index 9de8a73..3d2ccea 100644
306fa1
--- a/modules/mount_nfs.c
306fa1
+++ b/modules/mount_nfs.c
306fa1
@@ -156,6 +156,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
306fa1
 					if (port < 0)
306fa1
 						port = 0;
306fa1
 					port_opt = cp;
306fa1
+				} else if (strncmp("proto=udp", cp, o_len) == 0 ||
306fa1
+					   strncmp("udp", cp, o_len) == 0) {
306fa1
+					vers &= ~TCP_SUPPORTED;
306fa1
+				} else if (strncmp("proto=tcp", cp, o_len) == 0 ||
306fa1
+					   strncmp("tcp", cp, o_len) == 0) {
306fa1
+					vers &= ~UDP_SUPPORTED;
306fa1
 				}
306fa1
 				/* Check for options that also make sense
306fa1
 				   with bind mounts */
306fa1
@@ -167,6 +173,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
306fa1
 			}
306fa1
 		}
306fa1
 
306fa1
+		/* In case both tcp and udp options were given */
306fa1
+		if ((vers & NFS_PROTO_MASK) == 0)
306fa1
+			vers |= NFS_PROTO_MASK;
306fa1
+
306fa1
 		debug(ap->logopt, MODPREFIX
306fa1
 		      "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
306fa1
 		      nfsoptions, nobind, nosymlink, ro);