Blame SOURCES/autofs-5.1.7-make-NFS-version-check-flags-consistent.patch

4218b4
autofs-5.1.7 - make NFS version check flags consistent
4218b4
4218b4
From: Ian Kent <raven@themaw.net>
4218b4
4218b4
Several of the NFS connection macros have the same value so that they
4218b4
can be used as internal code documentation of what is being done.
4218b4
4218b4
Adjust the protocol macro naming to be consistent in a few places.
4218b4
4218b4
Also make sure the correct flags are set for the function they indicate.
4218b4
4218b4
Signed-off-by: Ian Kent <raven@themaw.net>
4218b4
---
4218b4
 CHANGELOG           |    1 +
4218b4
 modules/mount_nfs.c |   16 +++++++++-------
4218b4
 2 files changed, 10 insertions(+), 7 deletions(-)
4218b4
4218b4
--- autofs-5.1.7.orig/CHANGELOG
4218b4
+++ autofs-5.1.7/CHANGELOG
4218b4
@@ -96,6 +96,7 @@
4218b4
 - fix sysconf(3) return handling.
4218b4
 - remove nonstrict parameter from tree_mapent_umount_offsets().
4218b4
 - fix handling of incorrect return from umount_ent().
4218b4
+- make NFS version check flags consistent.
4218b4
 
4218b4
 25/01/2021 autofs-5.1.7
4218b4
 - make bind mounts propagation slave by default.
4218b4
--- autofs-5.1.7.orig/modules/mount_nfs.c
4218b4
+++ autofs-5.1.7/modules/mount_nfs.c
4218b4
@@ -178,18 +178,20 @@ int mount_mount(struct autofs_point *ap,
4218b4
 						port = 0;
4218b4
 				} else if (_strncmp("proto=udp", cp, o_len) == 0 ||
4218b4
 					   _strncmp("udp", cp, o_len) == 0) {
4218b4
-					vers &= ~TCP_SUPPORTED;
4218b4
+					vers &= ~TCP_REQUESTED;
4218b4
+					vers |= UDP_REQUESTED;
4218b4
 				} else if (_strncmp("proto=udp6", cp, o_len) == 0 ||
4218b4
 					   _strncmp("udp6", cp, o_len) == 0) {
4218b4
-					vers &= ~TCP_SUPPORTED;
4218b4
-					vers |= UDP6_REQUESTED;
4218b4
+					vers &= ~(TCP_REQUESTED|TCP6_REQUESTED);
4218b4
+					vers |= (UDP_REQUESTED|UDP6_REQUESTED);
4218b4
 				} else if (_strncmp("proto=tcp", cp, o_len) == 0 ||
4218b4
 					   _strncmp("tcp", cp, o_len) == 0) {
4218b4
-					vers &= ~UDP_SUPPORTED;
4218b4
+					vers &= ~UDP_REQUESTED;
4218b4
+					vers |= TCP_REQUESTED;
4218b4
 				} else if (_strncmp("proto=tcp6", cp, o_len) == 0 ||
4218b4
 					   _strncmp("tcp6", cp, o_len) == 0) {
4218b4
-					vers &= ~UDP_SUPPORTED;
4218b4
-					vers |= TCP6_REQUESTED;
4218b4
+					vers &= ~(UDP_REQUESTED|UDP6_REQUESTED);
4218b4
+					vers |= TCP_REQUESTED|TCP6_REQUESTED;
4218b4
 				}
4218b4
 				/* Check for options that also make sense
4218b4
 				   with bind mounts */
4218b4
@@ -246,7 +248,7 @@ int mount_mount(struct autofs_point *ap,
4218b4
 	    mount_default_proto == 4 &&
4218b4
 	    (vers & NFS_VERS_MASK) != 0 &&
4218b4
 	    (vers & NFS4_VERS_MASK) != 0 &&
4218b4
-	    !(vers & UDP6_REQUESTED)) {
4218b4
+	    !(vers & (UDP_REQUESTED|UDP6_REQUESTED))) {
4218b4
 		unsigned int v4_probe_ok = 0;
4218b4
 		struct host *tmp = new_host(hosts->name, 0,
4218b4
 					    hosts->addr, hosts->addr_len,