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

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