summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pppd/auth.c8
-rw-r--r--usr.sbin/pppd/main.c7
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;
OpenPOWER on IntegriCloud