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

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