From 519061ed14ad6d372fcbb9233623fadb2baaba0e Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Thu, 7 Aug 2014 22:09:32 +0100 Subject: [PATCH] rc.d/ppp: add support for -unitN override * Man page changes taken from FreeBSD. --- etc/rc.d/ppp-user | 15 +++++++++++++++ share/man/man5/rc.conf.5 | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/etc/rc.d/ppp-user b/etc/rc.d/ppp-user index 9a8cb430d6..b8eab95000 100644 --- a/etc/rc.d/ppp-user +++ b/etc/rc.d/ppp-user @@ -15,6 +15,14 @@ stop_cmd="ppp_stop" ppp_start() { + local _punct_c _punct _ppp_unit + _profile=${ppp_profile} + + _punct=". - / +" + for _punct_c in $_punct; do + _profile=`ltr ${_profile} ${_punct_c} '_'` + done + # Establish ppp mode. # if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \ @@ -33,6 +41,13 @@ ppp_start() ;; esac + # Check whether we are asked to use a specific unit + # + eval _ppp_unit=\$ppp_${_profile}_unit + if [ -n "${_ppp_unit}" ]; then + ppp_command="${ppp_command} -unit${_ppp_unit}" + fi + ppp_command="${ppp_command} ${ppp_profile}" echo "Starting ppp as \"${ppp_user}\"" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 884125ace1..40744b8178 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -913,6 +913,21 @@ this host as a network address translating router. .Pq Vt str The name of the profile to use from .Pa /etc/ppp/ppp.conf . +Also used for per-profile overrides of +.Va ppp_ Ns Ao Ar profile Ac Ns _unit . +Where the profile contains any of the characters +.Dq Li .-/+ +they are translated to +.Dq Li _ +for the purposes of the override variable names. +.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 +in +.Xr ppp 8 +for details. .It Va ppp_user .Pq Vt str The name of the user under which -- 2.41.0