On Wed, Jul 07, 1999 at 10:02:44PM +0100, Brian Somers wrote:
> 
> This aside, I think there are more bits required for the patches :*1
> 
> rc.conf.5 needs to be updated - that's the easy bit.
Done - see attached.
 
> I think we also need a src/etc/ppp/ppp.conf that installs with 0600 
> permissions at installation time.  This file would have a default 
> and a papchap entry in it - that's where the url for Waynes ppp.conf 
> comes in - its contents are probably what we're after.  Older versions 
> of src/etc/Makefile installed ppp.conf, so it should be easy to do that 
> side of things.
Done - attached is Waynes ppp.conf and a patch for /usr/src/etc/Makefile.
 
> Sysinstall however is also capable of writing ppp.conf.  It would 
> need to be smart enough to update the default one with the lines that 
> it wants to use (just appending an ``install'' label with the 
> necessary bits is probably the best thing to do).  This answers your 
> other question..... src/release/sysinstall/network.c - search for 
> ppp.conf.  That's how sysinstall does it :-)
Attached is network.c.patch, which should do the right thing.  It
simply appends to /etc/ppp/ppp.conf with an 'install' profile, and also
sets the relevent rc.conf variables so that the configuration survives
across reboots.  (This should probably be a little more intelligent,
but lets get the functionality in first and "better" it up later.)

> Ha, and you thought it'd be straight forward ;^P
Of course not ;).
 
Joe
-- 
Josef Karthauser        FreeBSD: How many times have you booted today?
Technical Manager       Viagra for your server (http://www.uk.freebsd.org)
Pavilion Internet plc.  [[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]]
#################################################################
# PPP  Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by [EMAIL PROTECTED]
#
# $Id$
#################################################################

default:

 #
 # Instructions:
 #
 # edit the next three lines and replace the items in caps with
 # the values which have been assigned by your ISP.
 #

 set phone PHONE_NUM
 set authname USERNAME
 set authkey PASSWORD

 #
 # Make sure that "device" references the correct serial port
 # for your modem. (cuaa0 = COM1, cuaa1 = COM2)
 #

 set device /dev/cuaa1

 set log Phase Chat LCP IPCP CCP tun command
 set speed 115200
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT OK-AT-OK ATE1Q0 OK 
\\dATDT\\T TIMEOUT 40 CONNECT"

 set timeout 120
 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
 add default HISADDR
 enable dns

Index: etc/Makefile
===================================================================
RCS file: /home/ncvs/src/etc/Makefile,v
retrieving revision 1.201
diff -u -r1.201 Makefile
--- Makefile    1999/07/10 18:02:12     1.201
+++ Makefile    1999/07/25 17:46:57
@@ -24,6 +24,7 @@
        BSD.var.dist BSD.x11.dist
 NAMEDB= PROTO.localhost.rev named.conf named.root make-localhost
 PPPCNF= ppp.deny ppp.shells.sample
+PPPCF2= ppp.conf
 NOSPAM=        Makefile README
 
 
@@ -79,6 +80,8 @@
            ${NAMEDB} ${DESTDIR}/etc/namedb
        cd ${.CURDIR}/ppp; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
            ${PPPCNF} ${DESTDIR}/etc/ppp
+       cd ${.CURDIR}/ppp; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 \
+           ${PPPCF2} ${DESTDIR}/etc/ppp
        cd ${.CURDIR}/mail; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
            ${NOSPAM} ${DESTDIR}/etc/mail
        ${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
Index: rc.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.36
diff -u -r1.36 rc.conf.5
--- rc.conf.5   1999/07/16 09:22:01     1.36
+++ rc.conf.5   1999/07/25 17:19:02
@@ -218,6 +218,30 @@
 .Ed
 Then note that alias4 would \fBnot\fR be added since the search would
 stop with the missing alias3 entry.
+.It Ar ppp_enable
+(bool) If set to
+.Ar YES ,
+run the
+.Xr ppp 8
+daemon.
+.It Ar ppp_mode
+(str) Mode in which to run the
+.Xr ppp 8
+daemon.  Accepted modes are
+.Ar auto , ddial , direct
+and
+.Ar dedicated .
+See the manual for a full description.
+.It Ar ppp_alias
+(bool) If set to
+.Ar YES ,
+enables packet aliasing. Used in conjunction with
+.Ar gateway_enable
+allows hosts on private network addresses access the Internet using
+this host as a network address translating router.
+.It Ar ppp_profile
+(str) The name of the profile to use from
+.Ar /etc/ppp/ppp.conf .
 .It Ar rc_conf_files
 (str) This option is used to specify a list of files that will override
 the settings in
Index: sysinstall.h
===================================================================
RCS file: /home/ncvs/src/release/sysinstall/sysinstall.h,v
retrieving revision 1.171
diff -u -r1.171 sysinstall.h
--- sysinstall.h        1999/07/19 10:06:17     1.171
+++ sysinstall.h        1999/07/25 21:24:15
@@ -148,6 +148,8 @@
 #define VAR_PCNFSD                     "pcnfsd"
 #define VAR_PKG_TMPDIR                 "PKG_TMPDIR"
 #define VAR_PORTS_PATH                 "ports"
+#define VAR_PPP_ENABLE                 "ppp_enable"
+#define VAR_PPP_PROFILE                        "ppp_profile"
 #define VAR_RELNAME                    "releaseName"
 #define VAR_ROOT_SIZE                  "rootSize"
 #define VAR_ROUTER                     "router"
Index: network.c
===================================================================
RCS file: /home/ncvs/src/release/sysinstall/network.c,v
retrieving revision 1.37
diff -u -r1.37 network.c
--- network.c   1999/07/18 10:18:05     1.37
+++ network.c   1999/07/25 21:56:15
@@ -246,7 +246,7 @@
        close(fd2);
     }
     if (!Fake)
-       fp = fopen("/etc/ppp/ppp.conf", "w");
+       fp = fopen("/etc/ppp/ppp.conf", "a");
     else
        fp = fopen("/dev/stderr", "w");
     if (!fp) {
@@ -268,7 +268,7 @@
        dialog_clear_norefresh();
        pulse = dialog_yesno("", "Does your telephone line support tone dialing?", -1, 
-1);
     }
-    fprintf(fp, "default:\n");
+    fprintf(fp, "\ninstall:\n");
     fprintf(fp, " set speed %s\n", speed);
     fprintf(fp, " set device %s\n", devp->devname);
     fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
@@ -282,10 +282,14 @@
        fprintf(fp, " set authkey %s\n", authkey);
        fprintf(fp, " set phone %s\n", phone);
     }
-    if (fchmod(fileno(fp), 0640) != 0)
+    if (fchmod(fileno(fp), 0600) != 0)
        msgConfirm("Warning: Failed to fix permissions on /etc/ppp/ppp.conf !");
     fclose(fp);
 
+    /* Make the ppp config persistant */  
+    variable_set2(VAR_PPP_ENABLE, "YES", 0);
+    variable_set2(VAR_PPP_PROFILE, "install", 0);
+
     if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, 
makedev(52, 0))) {
        msgConfirm("Warning:  No /dev/tun0 device.  PPP will not work!");
        return 0;
@@ -318,7 +322,7 @@
        }
        else
            msgDebug("ppp: Unable to get the terminal attributes!\n");
-       execlp("ppp", "ppp", (char *)NULL);
+       execlp("ppp", "ppp install", (char *)NULL);
        msgDebug("PPP process failed to exec!\n");
        exit(1);
     }

Reply via email to