diff options
author | brian <brian@FreeBSD.org> | 1997-02-09 18:34:25 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-02-09 18:34:25 +0000 |
commit | ca71d718ab76e63a14787f1320c465cba3c42bab (patch) | |
tree | 5aa53bb3f7db1cd7f3175af5e4d7b76969d4b0c9 /usr.sbin/pppd | |
parent | bf3d8cc375af3ea5a33ebcc8367767e1bc088cd4 (diff) | |
download | FreeBSD-src-ca71d718ab76e63a14787f1320c465cba3c42bab.zip FreeBSD-src-ca71d718ab76e63a14787f1320c465cba3c42bab.tar.gz |
Connections are timed and the call duration is logged
via syslog.
Submitted by: Lars Fredriksen <fredriks@mcs.com>
Obtained from: Lars Fredriksen <fredriks@mcs.com>
Diffstat (limited to 'usr.sbin/pppd')
-rw-r--r-- | usr.sbin/pppd/auth.c | 8 | ||||
-rw-r--r-- | usr.sbin/pppd/main.c | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index 564e97b..ad97e4f 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -131,12 +131,18 @@ void link_terminated(unit) int unit; { + extern time_t etime, stime; + extern int minutes; + if (phase == PHASE_DEAD) return; if (logged_in) ppplogout(); phase = PHASE_DEAD; - syslog(LOG_NOTICE, "Connection terminated."); + etime = time((time_t *) NULL); + minutes = (etime-stime)/60; + syslog(LOG_NOTICE, "Connection terminated, connected for %d minutes\n", + minutes > 1 ? minutes : 1); } /* diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c index dde2fdd..72cf752 100644 --- a/usr.sbin/pppd/main.c +++ b/usr.sbin/pppd/main.c @@ -71,6 +71,8 @@ static char default_devnam[MAXPATHLEN]; /* name of default device */ static pid_t pid; /* Our pid */ static pid_t pgrpid; /* Process Group ID */ static uid_t uid; /* Our real user-id */ +time_t etime,stime; /* End and Start time */ +int minutes; /* connection duration */ int fd = -1; /* Device file descriptor */ @@ -221,6 +223,7 @@ main(argc, argv) } pid = getpid(); p = getlogin(); + stime = time((time_t *) NULL); if (p == NULL) { pw = getpwuid(uid); if (pw != NULL && pw->pw_name != NULL) @@ -468,7 +471,9 @@ get_input() return; if (len == 0) { - syslog(LOG_NOTICE, "Modem hangup"); + etime = time((time_t *) NULL); + minutes = (etime-stime)/60; + syslog(LOG_NOTICE, "Modem hangup, connected for %d minutes", (minutes >1) ? minutes : 1); hungup = 1; lcp_lowerdown(0); /* serial link is no longer available */ phase = PHASE_DEAD; |