From pmc@phase23.dinoex.sub.de  Wed Mar 26 19:46:01 2008
Return-Path: <pmc@phase23.dinoex.sub.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A1281065677
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 26 Mar 2008 19:45:56 +0000 (UTC)
	(envelope-from pmc@phase23.dinoex.sub.de)
Received: from uucp.dinoex.sub.de (uucp.dinoex.sub.de [194.45.71.2])
	by mx1.freebsd.org (Postfix) with ESMTP id DE0E98FC24
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 26 Mar 2008 19:45:55 +0000 (UTC)
	(envelope-from pmc@phase23.dinoex.sub.de)
Received: from uucp.dinoex.sub.de (uucp@uucp.dinoex.sub.de [194.45.71.2] (may be forged))
	by uucp.dinoex.sub.de (8.14.1/8.14.0) with ESMTP id m2QJF8XQ017632
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 26 Mar 2008 20:15:09 +0100 (CET)
	(envelope-from pmc@phase23.dinoex.sub.de)
Received: from phase23.dinoex.sub.de (uucp@localhost)
	by uucp.dinoex.sub.de (8.14.1/8.14.0/Submit) with UUCP id m2QJF8qD017631
	for FreeBSD-gnats-submit@freebsd.org; Wed, 26 Mar 2008 20:15:08 +0100 (CET)
	(envelope-from pmc@phase23.dinoex.sub.de)
Received: from gate.oper.dinoex.org (gate-e [192.168.98.2])
	by citylink.dinoex.sub.de (8.14.2/8.13.6) with ESMTP id m2O4Kx1t009456
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Mar 2008 05:21:00 +0100 (CET)
	(envelope-from pmc@disp.oper.dinoex.org)
Received: from disp.oper.dinoex.org (disp-fe.oper.dinoex.org [192.168.96.5])
	by gate.oper.dinoex.org (8.14.2/8.14.2) with ESMTP id m2O4JdTD008378
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Mar 2008 05:19:39 +0100 (CET)
	(envelope-from pmc@disp.oper.dinoex.org)
Received: from disp.oper.dinoex.org (localhost [127.0.0.1])
	by disp.oper.dinoex.org (8.14.2/8.14.2) with ESMTP id m2O4JWl8009271
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 24 Mar 2008 05:19:32 +0100 (CET)
	(envelope-from pmc@disp.oper.dinoex.org)
Received: (from pmc@localhost)
	by disp.oper.dinoex.org (8.14.2/8.14.2/Submit) id m2O4JWP2009270;
	Mon, 24 Mar 2008 05:19:32 +0100 (CET)
	(envelope-from pmc)
Message-Id: <200803240419.m2O4JWP2009270@disp.oper.dinoex.org>
Date: Mon, 24 Mar 2008 05:19:32 +0100 (CET)
From: Peter Much <pmc@citylink.dinoex.sub.org>
Reply-To: Peter Much <pmc@citylink.dinoex.sub.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [rc.d] ppp unit not settable
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         122127
>Category:       conf
>Synopsis:       [rc.d] ppp unit not settable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 26 19:50:03 UTC 2008
>Closed-Date:    Tue Apr 15 22:38:45 UTC 2008
>Last-Modified:  Tue Apr 29 20:40:04 UTC 2008
>Originator:     Peter Much
>Release:        FreeBSD 6.3-RELEASE-p1 i386
>Organization:
n/a
>Environment:
System: FreeBSD disp.oper.dinoex.org 6.3-RELEASE-p1 FreeBSD 6.3-RELEASE-p1 #4: Tue Feb 26 15:01:43 CET 2008 root@disp.oper.dinoex.org:/usr/src/sys/i386/compile/D1R63V1 i386


>Description:

The ppp program usually opens the next available tunX device.

There is a good reason to override this and give a specific number
of tunX device to use, that is when the interface name will be used
in firewall definitions. 
But this can only be done via command-line, with the -unitX option.

In earlier FBSD releases the following could be used in rc.conf and 
would do the trick:
	ppp_profile="-unit0 t-adsl"

This is no longer working now, because the name of the profile is
now used as part of shell-variable names in /etc/rc.d/ppp, and
this makes spaces in that value illegal.
So the possibility to set the unit number thru the rc.d mechanics is 
now lacking.

BTW: If you try this out, you will notice that minus-signs
within the profile-name, while perfectly legal for ppp, are for
the same reason also no longer working from rc.conf.

>How-To-Repeat:

see description.

>Fix:

The most simple and straightforward solution is to add another
variable "ppp_cmdopts" to rc.conf, which gets promoted into the
actual command line.
(I for my part prefer to continue using the old script from rel. 5.5, 
since I luckily do not need multiple ppp sessions brought up early.)

The more general idea would be to think about some healthy
self-restriction when putting all too complex features into the
rc.d mechanics, because they tend to break some facets of the more
simple configurations. At some point of complexity people are in
the need to create their individual scripts anyway.
>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/122127: commit references a PR
Date: Wed, 26 Mar 2008 21:54:54 +0000 (UTC)

 brooks      2008-03-26 21:54:48 UTC
 
   FreeBSD src repository
 
   Modified files:
     etc/rc.d             ppp 
     share/man/man5       rc.conf.5 
   Log:
   Allow the characters .-+/ to appear in ppp profile names by folding them
   to _ when evaluating ppp_<profile>_nat and ppp_<profile>_mode.  Document
   the per-profile variables.
   
   PR:             conf/121452, conf/122127 (partial)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.17      +7 -2      src/etc/rc.d/ppp
   1.336     +24 -3     src/share/man/man5/rc.conf.5
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->feedback 
State-Changed-By: brooks 
State-Changed-When: Wed Mar 26 22:10:53 UTC 2008 
State-Changed-Why:  
Fixed part of this in head and sent a patch for testing for unit issue. 


Responsible-Changed-From-To: freebsd-bugs->brooks 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Wed Mar 26 22:10:53 UTC 2008 
Responsible-Changed-Why:  
Fixed part of this in head and sent a patch for testing for unit issue. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122127 

From: Brooks Davis <brooks@freebsd.org>
To: Peter Much <pmc@citylink.dinoex.sub.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: conf/122127: [rc.d] ppp unit not settable
Date: Wed, 26 Mar 2008 17:10:42 -0500

 I've committed a fix for the problem of '-'s in profile names to HEAD
 and plan to MFC next week.
 
 Below I've included a patch relative to that version which also
 addresses unit numbers with a new ppp_<profile>_unit variable.  Please
 test.
 
 -- Brooks
 
 Index: etc/rc.d/ppp
 ===================================================================
 RCS file: /home/ncvs/src/etc/rc.d/ppp,v
 retrieving revision 1.17
 diff -u -p -r1.17 ppp
 --- etc/rc.d/ppp	26 Mar 2008 21:54:48 -0000	1.17
 +++ etc/rc.d/ppp	26 Mar 2008 22:09:19 -0000
 @@ -18,7 +18,7 @@ start_postcmd="ppp_poststart"
  
  ppp_start_profile()
  {
 -	local _ppp_profile _ppp_mode _ppp_nat
 +	local _ppp_profile _ppp_mode _ppp_nat _ppp_unit
  
  	_ppp_profile=$1
  	_ppp_profile_cleaned=$1
 @@ -59,6 +59,12 @@ ppp_start_profile()
  		;;
  	esac
  
 +	# Check for hard wired unit
 +	eval _ppp_unit=\$ppp_${_ppp_profile_cleaned}_unit
 +	if [ -n "_ppp_unit" ]; then
 +		_ppp_unit="-unit${_ppp_unit}"
 +	fi
 +
  	# Run!
  	#
  	su -m $ppp_user -c "$command ${rc_flags} ${_ppp_profile}"
 Index: share/man/man5/rc.conf.5
 ===================================================================
 RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
 retrieving revision 1.336
 diff -u -p -r1.336 rc.conf.5
 --- share/man/man5/rc.conf.5	26 Mar 2008 21:54:48 -0000	1.336
 +++ share/man/man5/rc.conf.5	26 Mar 2008 22:09:19 -0000
 @@ -1320,9 +1320,10 @@ daemon.
  The name of the profile to use from
  .Pa /etc/ppp/ppp.conf .
  Also used for per-profile overrides of
 -.Va ppp_mode
 +.Va ppp_mode ,
 +.Va ppp_nat
  and
 -.Va ppp_nat .
 +.Va ppp_unit .
  When the profile name contains any of the characters
  .Dq Li .-/+
  they are translated to
 @@ -1361,6 +1362,12 @@ Overrides the global
  .Va ppp_nat
  for
  .Ar profile .
 +.It Va ppp_ Ns Ao Ar profile Ac Ns _unit
 +.Pq Vt int
 +Set the unit number to be used for this profile.
 +See the manual description of
 +.Fl unit Ns Ar N
 +for details.
  .It Va ppp_user
  .Pq Vt str
  The name of the user under which

From: Peter Much <pmc@citylink.dinoex.sub.org>
To: Brooks Davis <brooks@FreeBSD.org>
Cc: Peter Much <pmc@citylink.dinoex.sub.org>, FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: conf/122127: [rc.d] ppp unit not settable
Date: Fri, 28 Mar 2008 01:07:23 +0100

 On Wed, Mar 26, 2008 at 05:10:42PM -0500, Brooks Davis wrote:
 
 Thanks for the quick reaction! :)
 
 ! I've committed a fix for the problem of '-'s in profile names to HEAD
 ! and plan to MFC next week.
 
 This piece works.
 
 ! Below I've included a patch relative to that version which also
 ! addresses unit numbers with a new ppp_<profile>_unit variable.  Please
 ! test.
 
 And this needed a little workover to run (it didn't make it into the
 commandline) - see below.
 (And I didn't look at the manpage - as I use Rel. 6.3, and I do not
 know how to CVS merge - I do it manually).
 
 rgds,
 PMc
 
 Index: etc/rc.d/ppp
 ===================================================================
 RCS file: /Repos/src/etc/rc.d/ppp,v
 retrieving revision 1.17
 diff -u -r1.17 ppp
 --- etc/rc.d/ppp	26 Mar 2008 21:54:48 -0000	1.17
 +++ etc/rc.d/ppp	27 Mar 2008 23:45:43 -0000
 @@ -18,7 +18,7 @@
  
  ppp_start_profile()
  {
 -	local _ppp_profile _ppp_mode _ppp_nat
 +	local _ppp_profile _ppp_mode _ppp_nat _ppp_unit
  
  	_ppp_profile=$1
  	_ppp_profile_cleaned=$1
 @@ -59,6 +59,15 @@
  		;;
  	esac
  
 +	# Check for hard wired unit
 +	eval _ppp_unit=\$ppp_${_ppp_profile_cleaned}_unit
 +	if [ -z "$_ppp_unit" ]; then
 +		_ppp_unit=$ppp_unit
 +	fi
 +	if [ -n "$_ppp_unit" ]; then
 +		rc_flags="$rc_flags -unit${_ppp_unit}"
 +	fi
 +
  	# Run!
  	#
  	su -m $ppp_user -c "$command ${rc_flags} ${_ppp_profile}"
State-Changed-From-To: feedback->patched 
State-Changed-By: brooks 
State-Changed-When: Fri Mar 28 07:58:04 UTC 2008 
State-Changed-Why:  
I've committed a patch for ppp_<profile>_unit to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122127 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/122127: commit references a PR
Date: Fri, 28 Mar 2008 07:57:57 +0000 (UTC)

 brooks      2008-03-28 07:57:52 UTC
 
   FreeBSD src repository
 
   Modified files:
     etc/rc.d             ppp 
     share/man/man5       rc.conf.5 
   Log:
   Add support for hardwiring ppp sessions to particular devices with new
   per-profile variables of the form ppp_<profile>_unit.  No ppp_unit
   variable is supported since tying the same unit to more than one profile
   won't work.
   
   PR:             conf/122127
   MFC after:      1 week
   
   Revision  Changes    Path
   1.18      +8 -1      src/etc/rc.d/ppp
   1.337     +9 -1      src/share/man/man5/rc.conf.5
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: brooks 
State-Changed-When: Tue Apr 15 22:38:13 UTC 2008 
State-Changed-Why:  
Fixed in HEAD, RELENG_7, and RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122127 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/122127: commit references a PR
Date: Tue, 15 Apr 2008 22:37:48 +0000 (UTC)

 brooks      2008-04-15 22:37:43 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     etc/rc.d             ppp 
   Log:
   MFC revs 1.17-1.20, the functional components of which are:
   
   1.17:
   Allow the characters .-+/ to appear in ppp profile names by folding them
   to _ when evaluating ppp_<profile>_nat and ppp_<profile>_mode.  Document
   the per-profile variables.
   
   1.18:
   Add support for hardwiring ppp sessions to particular devices with new
   per-profile variables of the form ppp_<profile>_unit.  No ppp_unit
   variable is supported since tying the same unit to more than one profile
   won't work.
   
   PR:             conf/121452, conf/122127
   
   Revision  Changes    Path
   1.11.2.5  +16 -3     src/etc/rc.d/ppp
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/122127: commit references a PR
Date: Tue, 29 Apr 2008 20:17:53 +0000 (UTC)

 brooks      2008-04-29 20:17:46 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     share/man/man5       rc.conf.5 
   Log:
   MFC per ppp profile variable documentation (revs 1.336 and 1.337)
   
   PR:             conf/121452, conf/122127
   
   Revision   Changes    Path
   1.327.2.5  +32 -3     src/share/man/man5/rc.conf.5
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/122127: commit references a PR
Date: Tue, 29 Apr 2008 20:34:37 +0000 (UTC)

 brooks      2008-04-29 20:34:31 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     share/man/man5       rc.conf.5 
   Log:
   MFC per ppp profile variable documentation (revs 1.336 and 1.337)
   
   PR:             conf/121452, conf/122127
   
   Revision    Changes    Path
   1.256.2.38  +32 -3     src/share/man/man5/rc.conf.5
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
