Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Apr 1997 14:56:14 -0500 (CDT)
From:      Tony Kimball <alk@East.Sun.COM>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3249: ppp link down transition hook
Message-ID:  <199704101956.OAA06621@compound.east.sun.com>
Resent-Message-ID: <199704102000.NAA26600@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704101956.OAA06621>