Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2004 11:48:06 +0200 (IST)
From:      Amir Shalem <amir@active.ath.cx>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   misc/72505: [patch] Fix rc.d/ppp-user to make use of rc.subr
Message-ID:  <20041011094806.337A05D25@active.ath.cx>
Resent-Message-ID: <200410110950.i9B9oOVg070092@freefall.freebsd.org>

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

>Number:         72505
>Category:       misc
>Synopsis:       [patch] Fix rc.d/ppp-user to make use of rc.subr
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 11 09:50:20 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Amir Shalem
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD active.ath.cx 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Sun Oct 10 18:53:39 IST 2004 amir@active.ath.cx:/usr/obj/usr/src/sys/ACTIVE i386

>Description:
	/etc/rc.d/ppp-user, the script which controls /usr/sbin/ppp
	doesn't support many rc.subr features, such as `ppp_nice`.
	because the script starts the /usr/sbin/ppp manually
	which includes the `su`ing part.

>How-To-Repeat:
	set ppp_nice in rc.conf, and see it doesn't change a thing.

>Fix:
	Apply this patch:
--- etc/defaults/rc.conf.orig	Mon Oct 11 11:41:47 2004
+++ etc/defaults/rc.conf	Mon Oct 11 11:42:30 2004
@@ -142,6 +142,7 @@
 
 # User ppp configuration.
 ppp_enable="NO"		# Start user-ppp (or NO).
+ppp_program="/usr/sbin/ppp" # path to user-ppp program.
 ppp_mode="auto"		# Choice of "auto", "ddial", "direct" or "dedicated".
 			# For details see man page for ppp(8). Default is auto.
 ppp_nat="YES"		# Use PPP's internal network address translation or NO.
--- etc/rc.d/ppp-user.orig	Sun Oct 10 16:26:35 2004
+++ etc/rc.d/ppp-user	Mon Oct 11 11:37:58 2004
@@ -10,11 +10,11 @@
 . /etc/rc.subr
 
 name="ppp"
-rcvar="ppp_enable"
-start_cmd="ppp_start"
-stop_cmd=":"
+rcvar=`set_rcvar`
+start_precmd="ppp_precmd"
+start_postcmd="ppp_postcmd"
 
-ppp_start()
+ppp_precmd()
 {
 	# Establish ppp mode.
 	#
@@ -24,21 +24,21 @@
 		ppp_mode="auto"
 	fi
 
-	ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
+	rc_flags="$rc_flags -quiet -${ppp_mode}"
 
 	# Switch on NAT mode?
 	#
 	case ${ppp_nat} in
 	[Yy][Ee][Ss])
-		ppp_command="${ppp_command} -nat"
+		rc_flags="${rc_flags} -nat"
 		;;
 	esac
 
-	ppp_command="${ppp_command} ${ppp_profile}"
-
-	echo "Starting ppp as \"${ppp_user}\""
-	su -m ${ppp_user} -c "exec ${ppp_command}"
+	rc_flags="${rc_flags} ${ppp_profile}"
+}
 
+ppp_postcmd()
+{
 	# Re-Sync ipfilter so it picks up any new network interfaces
 	#
 	/etc/rc.d/ipfilter resync


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



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