Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 1997 13:23:06 -0600 (CST)
From:      Tony Kimball <Anthony.Kimball@East.Sun.COM>
To:        current@freebsd.org
Subject:   suggested ppp enhancement
Message-ID:  <199703191923.NAA03906@compound.east.sun.com>

next in thread | raw e-mail | index | archive | help
Here's a diff, including a documentation patch, to add support for a
ppp.linkdown file, symmetric to the ppp.linkup file.

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.



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