Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jan 2002 18:32:21 +0100
From:      Thomas Quinot <thomas@cuivre.fr.eu.org>
To:        freebsd-audit@freebsd.org
Subject:   conf/31358: NFS and amd startup fixes
Message-ID:  <20020117183221.A87451@melusine.cuivre.fr.eu.org>

next in thread | raw e-mail | index | archive | help
Hi auditors,

I'd be interested in a review and test feeback of the attached patch,
which addresses the two issues raised by PR conf/31358:
  * when enabling amd, nfsclient needs to be enabled as well;
  * when nfsclient is enabled, the LKM needs to be loaded if the
    code was not compiled into the kernel.

Thanks,
Thomas.

diff -u {/usr/src,}/etc/rc
--- /usr/src/etc/rc	Fri Jan  4 14:35:43 2002
+++ /etc/rc	Tue Jan  8 18:06:12 2002
@@ -103,6 +103,7 @@
 }
 
 chkdepend amd amd_enable        portmap portmap_enable
+chkdepend amd amd_enable        NFS nfs_client_enable
 chkdepend NFS nfs_server_enable portmap portmap_enable
 chkdepend NIS nis_server_enable portmap portmap_enable
 chkdepend NIS nis_client_enable portmap portmap_enable
diff -u {/usr/src,}/etc/rc.network
--- /usr/src/etc/rc.network	Fri Jan  4 14:35:44 2002
+++ /etc/rc.network	Tue Jan  8 18:06:30 2002
@@ -714,24 +714,59 @@
 
 		case ${nfs_client_enable} in
 		[Yy][Ee][Ss])
-			if [ -n "${nfs_access_cache}" ]; then
-				echo -n " NFS access cache time=${nfs_access_cache}"
-				sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
+			nfsclient_in_kernel=0
+			# Handle absent nfs client support
+			if sysctl vfs.nfs >/dev/null 2>&1; then
+				nfsclient_in_kernel=1
+			else
+				kldload nfsclient && nfsclient_in_kernel=1
 			fi
-			if [ -n "${nfs_bufpackets}" ]; then
-				sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
+
+			if [ ${nfsclient_in_kernel} -eq 1 ]
+			then
+				if [ -n "${nfs_access_cache}" ]; then
+					echo -n " NFS access cache time=${nfs_access_cache}"
+					sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
+				fi
+				if [ -n "${nfs_bufpackets}" ]; then
+					sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
+				fi
+				case ${rpc_statd_enable} in
+				[Yy][Ee][Ss])
+					echo -n ' rpc.statd';	rpc.statd
+					;;
+				esac
+
+				case ${rpc_lockd_enable} in
+				[Yy][Ee][Ss])
+					echo -n ' rpc.lockd';	rpc.lockd
+					;;
+				esac
+
+				case ${amd_enable} in
+				[Yy][Ee][Ss])
+					echo -n ' amd'
+					case ${amd_map_program} in
+					[Nn][Oo] | '')
+						;;
+					*)
+						amd_flags="${amd_flags} `eval\
+							${amd_map_program}`"
+						;;
+					esac
+
+					if [ -n "${amd_flags}" ]; then
+						amd -p ${amd_flags}\
+							> /var/run/amd.pid 2> /dev/null
+					else
+						amd 2> /dev/null
+					fi
+					;;
+				esac
+			else
+				echo 'Warning: NFS client kernel module failed to load'
+				nfs_client_enable=NO
 			fi
-			case ${rpc_statd_enable} in
-			[Yy][Ee][Ss])
-				echo -n ' rpc.statd';	rpc.statd
-				;;
-			esac
-
-			case ${rpc_lockd_enable} in
-			[Yy][Ee][Ss])
-				echo -n ' rpc.lockd';	rpc.lockd
-				;;
-			esac
 			;;
 		esac
 
@@ -742,26 +777,6 @@
 			rpc.umntall -k
 		fi
 
-		case ${amd_enable} in
-		[Yy][Ee][Ss])
-			echo -n ' amd'
-			case ${amd_map_program} in
-			[Nn][Oo] | '')
-				;;
-			*)
-				amd_flags="${amd_flags} `eval\
-					${amd_map_program}`"
-				;;
-			esac
-
-			if [ -n "${amd_flags}" ]; then
-				amd -p ${amd_flags}\
-					> /var/run/amd.pid 2> /dev/null
-			else
-				amd 2> /dev/null
-			fi
-			;;
-		esac
 		;;
 	esac
 
-- 
    Thomas.Quinot@Cuivre.FR.EU.ORG

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020117183221.A87451>