From owner-freebsd-rc@FreeBSD.ORG Sat Oct 6 22:49:59 2007 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59F3716A41A for ; Sat, 6 Oct 2007 22:49:59 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.186]) by mx1.freebsd.org (Postfix) with ESMTP id DF2BC13C45B for ; Sat, 6 Oct 2007 22:49:58 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by mu-out-0910.google.com with SMTP id w9so1075655mue for ; Sat, 06 Oct 2007 15:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=JMPTBRqWlPYtZ8Ys4roRQg9YfpW+jBf1WNQXgxM1xYo=; b=CuPNDZsI6n711qVwGINGsHj5NdvJWQ8ND2vx1DnJRm9XKexbATvVsTn/uAO0Ij65SzXoWQ1vQSyWBccEzErAZ84PZKB0e6LCw/TB04aQHL756Wj1Cw/rcis3xC8Iop9rtGKahX4Fu+5gAzAiFOOnq9ONfzl+Pr9E5DDwD1HRSks= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kCECQJ+o8beZZcZr7vXkm82vY2IZWrtLIvYTt1g37OlAzgmbqrlnQykTquXkHxINjZ3hzqu7tsAiM5kWPR69A24C1dvkJZhL85j2bRxfLZcfK5lt3YAWhwwo33KKkZm8W4DA7DKQGkAjL7TdhHkF+cxadHA9LrhGDsCR9tRV7vc= Received: by 10.86.100.7 with SMTP id x7mr3704940fgb.1191710997500; Sat, 06 Oct 2007 15:49:57 -0700 (PDT) Received: by 10.86.25.9 with HTTP; Sat, 6 Oct 2007 15:49:57 -0700 (PDT) Message-ID: Date: Sat, 6 Oct 2007 15:49:57 -0700 From: "Maksim Yevmenkin" To: "Mike Makonnen" In-Reply-To: <20071006215757.GA10458@terra.mike.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071006215757.GA10458@terra.mike.lan> Cc: freebsd-rc@freebsd.org Subject: Re: multiple instances of ppp X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Oct 2007 22:49:59 -0000 Mike, On 10/6/07, Mike Makonnen wrote: > On Sat, Oct 06, 2007 at 01:14:18PM -0700, Maksim Yevmenkin wrote: > > hello, > > > > a friend of mine send me the following /etc/rc.c/ppp replacement > > script. the idea is to start multiple instances of ppp at boot time > > (possibly with different profiles). > > > > i'm not sure if this is ok to commit as it is, so i decided to ask if > > there is a better way to handle this. > > > > any thoughts on the subject is very much appreciated. > > I like it, but it has several bugs and needs to be cleaned up first. My > comments are inline. thanks for your comments. what do you think about something like # PROVIDE: ppp # REQUIRE: netif isdnd # KEYWORD: nojail . /etc/rc.subr name="ppp" rcvar=`set_rcvar` command="/usr/sbin/${name}" start_cmd="ppp_start" start_postcmd="ppp_poststart" ppp_start_profile() { local _ppp_profile, _ppp_mode, _ppp_nat _ppp_profile=$1 # Check for ppp profile mode override. # eval _ppp_mode=\$ppp_${_ppp_profile}_mode if [ -z "$_ppp_mode" ]; then _ppp_mode=$ppp_mode fi # Check for ppp profile nat override. # eval _ppp_nat=\$ppp_${_ppp_profile}_nat if [ -z "$_ppp_nat" ]; then _ppp_nat=$ppp_nat fi # Establish ppp mode. # if [ "${_ppp_mode}" != "ddial" -a "${_ppp_mode}" != "direct" \ -a "${_ppp_mode}" != "dedicated" \ -a "${_ppp_mode}" != "background" ]; then _ppp_mode="auto" fi rc_flags="-quiet -${_ppp_mode}" # Switch on NAT mode? # case ${_ppp_nat} in [Yy][Ee][Ss]) rc_flags="$rc_flags -nat" ;; esac # Run! # echo su -m $ppp_user -c "$command ${rc_flags} ${_ppp_profile}" } ppp_start() { local _p echo -n "Starting PPP profile:" for _p in $ppp_profile; do echo -n " $_p" ppp_start_profile $_p done echo "." } ppp_poststart() { # Re-Sync ipfilter and pf so they pick up any new network interfaces # /etc/rc.d/ipfilter resync /etc/rc.d/pf resync } load_rc_config $name run_rc_command "$1"