From root@chrullrich.de  Tue Jan 21 22:42:27 2003
Return-Path: <root@chrullrich.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F0A4337B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 21 Jan 2003 22:42:27 -0800 (PST)
Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B68F243EB2
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 21 Jan 2003 22:42:21 -0800 (PST)
	(envelope-from root@chrullrich.de)
Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de)
	by moutng.kundenserver.de with esmtp (Exim 3.35 #1)
	id 18bEaa-00025t-00
	for FreeBSD-gnats-submit@freebsd.org; Wed, 22 Jan 2003 07:42:20 +0100
Received: from [217.237.101.80] (helo=ser1.chrullrich.de)
	by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1)
	id 18bEaa-00025p-00
	for FreeBSD-gnats-submit@freebsd.org; Wed, 22 Jan 2003 07:42:20 +0100
Received: by ser1.chrullrich.de (Postfix, from userid 0)
	id 02B7349; Wed, 22 Jan 2003 07:42:10 +0100 (CET)
Message-Id: <20030122064210.02B7349@ser1.chrullrich.de>
Date: Wed, 22 Jan 2003 07:42:10 +0100 (CET)
From: Christian Ullrich <chris+freebsd@chrullrich.de>
Reply-To: Christian Ullrich <chris+freebsd@chrullrich.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rc.network supports only one ppp profile
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47350
>Category:       conf
>Synopsis:       [patch] rc.network supports only one ppp profile
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 21 22:50:01 PST 2003
>Closed-Date:    Fri Jun 27 16:04:49 UTC 2008
>Last-Modified:  Fri Jun 27 16:04:49 UTC 2008
>Originator:     Christian Ullrich
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD ser1.chrullrich.de 4.7-STABLE FreeBSD 4.7-STABLE #1: Sat Oct 26 14:04:33 CEST 2002 toor@ser1.chrullrich.de:/usr/obj/usr/src/sys/SER1 i386


	
>Description:
	rc.network supports starting only one ppp instance. If
	any additional instances are required, they must be started
	manually or from rc.d . This patch fixes this.
	It introduces a new rc.conf variable ppp_profiles, which
	defaults to $ppp_profile to keep backwards compatibility,
	and uses variables which follow the pattern
	ppp_${profile}_mode (profile-specific $ppp_mode, defaults to
	$ppp_mode) and ppp_${profile}_args (supports additional
	command-line arguments such as -unitX, defaults to empty).
	The patch applies cleanly against -STABLE as of five minutes ago.
>How-To-Repeat:
	
>Fix:

	

--- multippp.diff begins here ---
--- etc/rc.network.orig	Sun Nov 10 22:02:39 2002
+++ etc/rc.network	Wed Jan 22 07:27:02 2003
@@ -266,28 +266,45 @@
 	#
 	case ${ppp_enable} in
 	[Yy][Ee][Ss])
-		# Establish ppp mode.
-		#
-		if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
-			-a "${ppp_mode}" != "dedicated" \
-			-a "${ppp_mode}" != "background" ]; then
-			ppp_mode="auto"
+		# Backward compatibility (defaults/rc.conf uses this, too).
+		if [ -z "${ppp_profiles}" -a -n "${ppp_profile}" ]; then
+			ppp_profiles=$ppp_profile
 		fi
 
-		ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
+		# Start all profiles.
+		for i in ${ppp_profiles}; do
+			eval pppmode=\$ppp_${i}_mode
+			eval pppargs=\$ppp_${i}_args
 
-		# Switch on NAT mode?
-		#
-		case ${ppp_nat} in
-		[Yy][Ee][Ss])
-			ppp_command="${ppp_command} -nat"
-			;;
-		esac
+			# If no profile-specific mode, use default mode
+			if [ -z "${pppmode}" -a -n "${ppp_mode}" ]; then
+				pppmode=$ppp_mode
+			fi
 
-		ppp_command="${ppp_command} ${ppp_profile}"
+			# Establish ppp mode.
+			#
+			if [ "${pppmode}" != "ddial" \
+				-a "${pppmode}" != "direct" \
+				-a "${pppmode}" != "dedicated" \
+				-a "${pppmode}" != "background" ]; then
+				pppmode="auto"
+			fi
 
-		echo "Starting ppp as \"${ppp_user}\""
-		su -m ${ppp_user} -c "exec ${ppp_command}"
+			ppp_command="/usr/sbin/ppp -quiet ${pppargs} -${pppmode}"
+
+			# Switch on NAT mode?
+			#
+			case ${ppp_nat} in
+			[Yy][Ee][Ss])
+				ppp_command="${ppp_command} -nat"
+				;;
+			esac
+
+			ppp_command="${ppp_command} ${i}"
+
+			echo "Starting ppp as \"${ppp_user}\""
+			su -m ${ppp_user} -c "exec ${ppp_command}"
+		done
 		;;
 	esac
 
--- multippp.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mtm 
State-Changed-When: Fri Jun 27 16:00:47 UTC 2008 
State-Changed-Why:  
This functionality was added by brooks@ in rev. 1.14 - 1.19 of rc.d/ppp 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47350 
>Unformatted:
