Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Aug 2001 11:47:12 -0700 (PDT)
From:      OGAWA Takaya <t-ogawa@triaez.kaisei.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/29631: portmap not automatically enabled in /etc/rc
Message-ID:  <200108111847.f7BIlCx51285@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         29631
>Category:       conf
>Synopsis:       portmap not automatically enabled in /etc/rc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 11 11:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     OGAWA Takaya
>Release:        FreeBSD 4.4-PRERELEASE
>Organization:
>Environment:
FreeBSD gandalf.middle.earth 4.4-PRERELEASE FreeBSD 4.4-PRERELEASE #5: Thu Aug  9 00:50:08 JST 2001     root@gandalf.middle.earth:/usr/obj/usr/src/sys/GANDALF  i386

>Description:
In /etc/rc, special care is taken so that portmap will be automatically
enabled if either amd, nfs or nis enabled:

	chkdepend amd amd_enable        portmap portmap_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

Thanks to these lines, variable ${portmap_enable} will be set to "YES"
if needed.

However, /etc/rc later loads /etc/rc.firewall, which unconditionally
reloads /etc/defaults/rc.conf (and /etc/rc.conf, if exists):

        if [ -r /etc/defaults/rc.conf ]; then
                . /etc/defaults/rc.conf
                source_rc_confs
        elif [ -r /etc/rc.conf ]; then
                . /etc/rc.conf
        fi

Thus, unless user specifically set ${portmap_enable} to "YES" in /etc/rc.conf,
${portmap_enable} will be reset to "NO" in /etc/defaults/rc.conf.

Later on, /etc/rc invokes network_pass2() (which defined in /etc/rc.network)
but portmap won't be run because ${portmap_enable} has been reset to "NO".

>How-To-Repeat:
Create /etc/rc.conf as follows:
nfs_server_enable="YES"

And reboot the system. During bootup, rc shows:

	DEPENDENCY NOTE: portmap_enable will be enabled to support NFS

However,

	% ps ax | grep portmap

produces nothing.

>Fix:
In /etc/rc.firewall, don't reload /etc/rc.conf nor /etc/defaults/rc.conf
if they are already loaded.

/etc/rc.firewall6 already cares this so the same approach can be applied to
/etc/rc.firewall as well. Patch is as follows:

--- etc/rc.firewall.orig        Sun Aug 12 03:13:37 2001
+++ etc/rc.firewall     Sun Aug 12 03:17:58 2001
@@ -30,11 +30,13 @@
 #
 
 # Suck in the configuration variables.
-if [ -r /etc/defaults/rc.conf ]; then
-       . /etc/defaults/rc.conf
-       source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-       . /etc/rc.conf
+if [ -z "${source_rc_confs_defined}" ]; then
+       if [ -r /etc/defaults/rc.conf ]; then
+               . /etc/defaults/rc.conf
+               source_rc_confs
+       elif [ -r /etc/rc.conf ]; then
+               . /etc/rc.conf
+       fi
 fi
 
 ############

>Release-Note:
>Audit-Trail:
>Unformatted:

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




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