1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Add ppp.linkdown file to compliment ppp.linkup.

Submitted by:	Forgotten
Passed on by:	Terry Dwyer 61 8 9491 5161 <tdwyer@io.telstra.com.au>

Also remove extraneous setuid(0) - it's only undone by
the subsequent call to SelectSystem().
This commit is contained in:
Brian Somers 1997-06-13 02:07:32 +00:00
parent 582691713e
commit 94b3022ec7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26589
4 changed files with 45 additions and 23 deletions

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: defs.h,v 1.14 1997/05/10 03:39:52 brian Exp $
* $Id: defs.h,v 1.15 1997/06/09 03:27:18 brian Exp $
*
* TODO:
*/
@ -53,8 +53,8 @@
#define NEXT_REDIAL_PERIOD 3 /* Default Hold time to next number redial */
#define CONFFILE "ppp.conf"
#define LINKFILE "ppp.linkup"
#define ETHERFILE "ppp.etherup"
#define LINKUPFILE "ppp.linkup"
#define LINKDOWNFILE "ppp.linkdown"
#define SECRETFILE "ppp.secret"
/*

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: os.c,v 1.21 1997/06/01 03:43:26 brian Exp $
* $Id: os.c,v 1.22 1997/06/09 03:27:31 brian Exp $
*
*/
#include "fsm.h"
@ -182,8 +182,6 @@ OsLinkup()
char *s;
if (linkup == 0) {
if (setuid(0) < 0)
LogPrintf(LogERROR, "setuid failed\n");
reconnectState = RECON_UNKNOWN;
if (mode & MODE_BACKGROUND && BGFiledes[1] != -1) {
char c = EX_NORMAL;
@ -201,12 +199,12 @@ OsLinkup()
else
LogPrintf(LogLCP, "OsLinkup: %s\n", s);
if (SelectSystem(inet_ntoa(IpcpInfo.want_ipaddr), LINKFILE) < 0) {
if (SelectSystem(inet_ntoa(IpcpInfo.want_ipaddr), LINKUPFILE) < 0) {
if (dstsystem) {
if (SelectSystem(dstsystem, LINKFILE) < 0)
SelectSystem("MYADDR", LINKFILE);
if (SelectSystem(dstsystem, LINKUPFILE) < 0)
SelectSystem("MYADDR", LINKUPFILE);
} else
SelectSystem("MYADDR", LINKFILE);
SelectSystem("MYADDR", LINKUPFILE);
}
linkup = 1;
}
@ -226,8 +224,14 @@ OsLinkdown()
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);
}
}
}

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.36 1997/06/09 23:38:34 brian Exp $
.\" $Id: ppp.8,v 1.37 1997/06/13 00:04:58 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -379,7 +379,10 @@ connection is established. See the provided
example in
.Pa /etc/ppp/ppp.conf.sample
which adds a default route. The string HISADDR is available as the IP
address of the remote peer.
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
@ -1822,19 +1825,20 @@ commands.
.Sh FILES
.Nm Ppp
refers to three files: ppp.conf, ppp.linkup and ppp.secret.
These files are placed in
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.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|secret]
.Pa $HOME/ppp/.ppp.[conf|linkup|linkdown|secret]
User dependent configuration files.
.Pa /etc/ppp/ppp.conf
@ -1848,6 +1852,11 @@ 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.tun0.log
Logging and debugging information file.

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.36 1997/06/09 23:38:34 brian Exp $
.\" $Id: ppp.8,v 1.37 1997/06/13 00:04:58 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -379,7 +379,10 @@ connection is established. See the provided
example in
.Pa /etc/ppp/ppp.conf.sample
which adds a default route. The string HISADDR is available as the IP
address of the remote peer.
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
@ -1822,19 +1825,20 @@ commands.
.Sh FILES
.Nm Ppp
refers to three files: ppp.conf, ppp.linkup and ppp.secret.
These files are placed in
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.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|secret]
.Pa $HOME/ppp/.ppp.[conf|linkup|linkdown|secret]
User dependent configuration files.
.Pa /etc/ppp/ppp.conf
@ -1848,6 +1852,11 @@ 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.tun0.log
Logging and debugging information file.