Package: ppp
Version: 2.4.5-5
Severity: wishlist
Tags: patch

Prompted by a mail from Andreas Kohlbach <[email protected]>, it occurs
to me that the assumption that is built into pon that ppp will be used
will a modem connection is a little dated, and that many people will
now be using ppp for PPPoE, and that if that's the case they're liable
to have used pppoeconf to create a dsl-provider config file.

That being the case, I've written the attached patch to modify the
behaviour when calling pon without an isp-name so that it looks first
for the 'provider' config, then tries 'dsl-provider'.

Cheers, Phil.

-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (800, 'stable'), (200, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -ur ../extra-orig//pon ./pon
--- ../extra-orig//pon	2011-09-23 11:29:54.000000000 +0100
+++ ./pon	2011-09-24 08:38:31.000000000 +0100
@@ -42,17 +42,29 @@
     [ "$QUICK" ] && touch /var/run/ppp-quick
     exec /etc/ppp/ppp_on_boot
   fi
-  # try the default script
-  PROVIDER=provider
+  # check if there's a default provider to use
+  for p in provider dsl-provider ; do
+    if [ -e "/etc/ppp/peers/$p" ]; then
+      PROVIDER=$p
+      break ;
+    fi
+  done
 fi
 
-if [ ! -e "/etc/ppp/peers/$PROVIDER" ]; then
+if [ -z "$PROVIDER" ]; then
   echo "\
-The file /etc/ppp/peers/$PROVIDER does not exist. Please create it or use
-a command line argument to use another file in the /etc/ppp/peers/ directory."
+No default configuration found in the /etc/ppp/peers/ directory. Please eather
+create a 'provider' file there or use a command line argument to use another
+file in the /etc/ppp/peers/ directory.  See the man page for full details"
   exit 1
 fi
 
+if [ ! -e "/etc/ppp/peers/$PROVIDER" ]; then
+  echo "\
+The provider's configuration file (/etc/ppp/peers/$PROVIDER) does not exist"
+  exit 2
+fi
+
 [ "$QUICK" ] && touch /var/run/ppp-quick
 exec /usr/sbin/pppd call $PROVIDER "$@"
 
diff -ur ../extra-orig//pon.1 ./pon.1
--- ../extra-orig//pon.1	2011-09-23 11:29:54.000000000 +0100
+++ ./pon.1	2011-09-24 08:51:12.000000000 +0100
@@ -3,7 +3,7 @@
 .\" To get an ascii file:
 .\" groff -man -Tascii pon.1 > pon.txt
 .\"
-.TH PON 1 "July 2000" "Debian Project" "Debian PPPD"
+.TH PON 1 "September 2011" "Debian Project" "Debian PPPD"
 .SH NAME
 pon, poff, plog \- starts up, shuts down or lists the log of PPP connections
 .SH SYNOPSIS
@@ -22,7 +22,8 @@
 .SS pon
 \fBpon\fP, invoked without arguments, runs the \fI/etc/ppp/ppp_on_boot\fP
 file, if it exists and is executable. Otherwise, a PPP connection will be
-started using configuration from \fI/etc/ppp/peers/provider\fP.
+started using configuration from \fI/etc/ppp/peers/provider\fP if it exists,
+ or failing that it will try \fI/etc/ppp/peers/dsl-provider\fP instead.
 This is the default behaviour unless an \fBisp\-name\fP argument is given.
 .PP
 For instance, to use ISP configuration "myisp" run:
@@ -118,7 +119,7 @@
 Updated and revised by Philip Hands <[email protected]>.
 .br
 This manual was written by Othmar Pasteka <[email protected]>. Modified
-by Rob Levin <[email protected]>, with some extensions taken from
+by Rob Levin <[email protected]> and then Philip Hands, with some extensions taken from
 the old p-commands manual written by John Hasler <[email protected]>.
 .SH "SEE ALSO"
 .BR pppd (8),

Reply via email to