summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-06-13 02:07:32 +0000
committerbrian <brian@FreeBSD.org>1997-06-13 02:07:32 +0000
commit1fd5f260cda7f6c95c4ac594c6bf879aeab7e3e4 (patch)
tree831ad05671253696bc09836cadf3a7237579254c /usr.sbin
parente6dedeb7e4bd1d34deb875f405b8b3a4457e09cc (diff)
downloadFreeBSD-src-1fd5f260cda7f6c95c4ac594c6bf879aeab7e3e4.zip
FreeBSD-src-1fd5f260cda7f6c95c4ac594c6bf879aeab7e3e4.tar.gz
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().
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/defs.h6
-rw-r--r--usr.sbin/ppp/os.c20
-rw-r--r--usr.sbin/ppp/ppp.821
-rw-r--r--usr.sbin/ppp/ppp.8.m421
4 files changed, 45 insertions, 23 deletions
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index a4aefca..2b90881 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -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"
/*
diff --git a/usr.sbin/ppp/os.c b/usr.sbin/ppp/os.c
index 2c384ef..a37a760 100644
--- a/usr.sbin/ppp/os.c
+++ b/usr.sbin/ppp/os.c
@@ -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);
+ }
}
}
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index ad57876..b040a05 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -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.
diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4
index ad57876..b040a05 100644
--- a/usr.sbin/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp.8.m4
@@ -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.
OpenPOWER on IntegriCloud