From owner-freebsd-bugs Thu Apr 10 13:00:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA26615 for bugs-outgoing; Thu, 10 Apr 1997 13:00:07 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA26600; Thu, 10 Apr 1997 13:00:03 -0700 (PDT) Resent-Date: Thu, 10 Apr 1997 13:00:03 -0700 (PDT) Resent-Message-Id: <199704102000.NAA26600@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, alk@East.Sun.COM Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id MAA26462 for ; Thu, 10 Apr 1997 12:56:55 -0700 (PDT) Received: from East.Sun.COM ([129.148.1.241]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id NAA05780 for ; Thu, 10 Apr 1997 13:02:21 -0700 Received: from suneast.East.Sun.COM by East.Sun.COM (SMI-8.6/SMI-5.3) id PAA01019; Thu, 10 Apr 1997 15:55:44 -0400 Received: from compound.east.sun.com by suneast.East.Sun.COM (SMI-8.6/SMI-SVR4) id PAA05575; Thu, 10 Apr 1997 15:55:42 -0400 Received: (from alk@localhost) by compound.east.sun.com (8.8.5/8.7.3) id OAA06621; Thu, 10 Apr 1997 14:56:14 -0500 (CDT) Message-Id: <199704101956.OAA06621@compound.east.sun.com> Date: Thu, 10 Apr 1997 14:56:14 -0500 (CDT) From: Tony Kimball Reply-To: alk@East.Sun.COM To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/3249: ppp link down transition hook Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 3249 >Category: bin >Synopsis: user ppp does not provide a linkdown hook >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 10 13:00:02 PDT 1997 >Last-Modified: >Originator: Tony Kimball >Organization: Dis >Release: FreeBSD 3.0-CURRENT i386 >Environment: Current >Description: /usr/sbin/ppp provides a means of taking a configurable action when a link comes up, but not when a link goes down. Incidentally, I submitted this in the past but did not receive back a tracking number, so I must've goofed somehow. >How-To-Repeat: Hang up the phone :-) >Fix: cvs diff: Diffing . Index: defs.h =================================================================== RCS file: /home/alk/w/repository/FreeBSD/src/usr.sbin/ppp/defs.h,v retrieving revision 1.10 diff -c -3 -r1.10 defs.h *** defs.h 1997/02/22 16:10:10 1.10 --- defs.h 1997/03/19 18:52:55 *************** *** 42,55 **** #else #define MODEM_DEV "/dev/tty01" /* name of tty device */ #endif ! #define MODEM_SPEED B38400 /* tty speed */ #define SERVER_PORT 3000 /* Base server port no. */ #define MODEM_CTSRTS TRUE /* Default (true): use CTS/RTS signals */ #define REDIAL_PERIOD 30 /* Default Hold time to redial */ #define CONFFILE "ppp.conf" ! #define LINKFILE "ppp.linkup" #define ETHERFILE "ppp.etherup" #define SECRETFILE "ppp.secret" --- 42,56 ---- #else #define MODEM_DEV "/dev/tty01" /* name of tty device */ #endif ! #define MODEM_SPEED B115200 /* tty speed */ #define SERVER_PORT 3000 /* Base server port no. */ #define MODEM_CTSRTS TRUE /* Default (true): use CTS/RTS signals */ #define REDIAL_PERIOD 30 /* Default Hold time to redial */ #define CONFFILE "ppp.conf" ! #define LINKUPFILE "ppp.linkup" ! #define LINKDOWNFILE "ppp.linkdown" #define ETHERFILE "ppp.etherup" #define SECRETFILE "ppp.secret" Index: os.c =================================================================== RCS file: /home/alk/w/repository/FreeBSD/src/usr.sbin/ppp/os.c,v retrieving revision 1.14 diff -c -3 -r1.14 os.c *** os.c 1997/02/25 14:05:06 1.14 --- os.c 1997/03/19 18:57:45 *************** *** 193,204 **** s = (char *)inet_ntoa(peer_addr); LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkup: %s\n", s); ! if (SelectSystem(inet_ntoa(IpcpInfo.want_ipaddr), LINKFILE) < 0) { if (dstsystem) { ! if (SelectSystem(dstsystem, LINKFILE) < 0) ! SelectSystem("MYADDR", LINKFILE); } else ! SelectSystem("MYADDR", LINKFILE); } linkup = 1; } --- 193,204 ---- s = (char *)inet_ntoa(peer_addr); LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkup: %s\n", s); ! if (SelectSystem(inet_ntoa(IpcpInfo.want_ipaddr), LINKUPFILE) < 0) { if (dstsystem) { ! if (SelectSystem(dstsystem, LINKUPFILE) < 0) ! SelectSystem("MYADDR", LINKUPFILE); } else ! SelectSystem("MYADDR", LINKUPFILE); } linkup = 1; } *************** *** 210,220 **** char *s; if (linkup) { ! s = (char *)inet_ntoa(peer_addr); ! LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkdown: %s\n", s); ! if (!(mode & MODE_AUTO)) ! DeleteIfRoutes(0); ! linkup = 0; } } --- 210,227 ---- char *s; if (linkup) { ! s = (char *)inet_ntoa(peer_addr); ! LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkdown: %s\n", s); ! if (!(mode & MODE_AUTO)) ! DeleteIfRoutes(0); ! linkup = 0; ! if (SelectSystem(s, LINKDOWNFILE) < 0) { ! if (dstsystem) { ! if (SelectSystem(dstsystem, LINKDOWNFILE) < 0) ! SelectSystem("MYADDR", LINKDOWNFILE); ! } else ! SelectSystem("MYADDR", LINKDOWNFILE); ! } } } Index: ppp.8 =================================================================== RCS file: /home/alk/w/repository/FreeBSD/src/usr.sbin/ppp/ppp.8,v retrieving revision 1.26 diff -c -3 -r1.26 ppp.8 *** ppp.8 1997/03/13 21:39:41 1.26 --- ppp.8 1997/03/19 18:54:53 *************** *** 308,314 **** .Em PPP connection is established. See the provided example which adds a default route. The string HISADDR represents the IP address of the ! remote peer. .Sh BACKGROUND DIALING --- 308,317 ---- .Em PPP connection is established. See the provided example which adds a default route. The string HISADDR represents the IP address of the ! remote peer. Similarly, when a connection is closed, the contents of the ! .Pa /etc/ppp/ppp.linkdown ! file are executed. ! .Sh BACKGROUND DIALING *************** *** 870,888 **** .Sh FILES .Nm ! refers to three files: ppp.conf, ppp.linkup and ppp.secret. These files are placed in .Pa /etc/ppp , but the user can create his own files under his $HOME directory as .Pa .ppp.conf , ! .Pa .ppp.linkup and .Pa .ppp.secret. .Nm will always try to consult the user's personal setup first. .Bl -tag -width flag ! .Pa $HOME/ppp/.ppp.[conf|linkup|secret] User dependent configuration files. .Pa /etc/ppp/ppp.conf --- 873,892 ---- .Sh FILES .Nm ! refers to four files: ppp.conf, ppp.linkup, ppp.linkdown, and ppp.secret. These files are placed in .Pa /etc/ppp , but the user can create his own files under his $HOME directory as .Pa .ppp.conf , ! .Pa .ppp.linkup , ! .Pa .ppp.linkdown and .Pa .ppp.secret. .Nm will always try to consult the user's personal setup first. .Bl -tag -width flag ! .Pa $HOME/ppp/.ppp.[conf|linkup|linkdown|secret] User dependent configuration files. .Pa /etc/ppp/ppp.conf *************** *** 895,900 **** --- 899,909 ---- A file to check when .Nm establishes a network level connection. + + .Pa /etc/ppp/ppp.linkdown + A file to check when + .Nm + closes a network level connection. .Pa /var/log/ppp.log Logging and debugging information file. >Audit-Trail: >Unformatted: