diff options
author | brian <brian@FreeBSD.org> | 2001-11-03 21:45:32 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-11-03 21:45:32 +0000 |
commit | 6a1de171ac53cf7f8b25dd40c8d9578c6d9cbc5d (patch) | |
tree | ec148ab8a0b3c8d98c08221f9c5b958f68a4203f /usr.sbin/ppp/bundle.c | |
parent | 008cbb2ddee52fd6e070d16340a547b330412183 (diff) | |
download | FreeBSD-src-6a1de171ac53cf7f8b25dd40c8d9578c6d9cbc5d.zip FreeBSD-src-6a1de171ac53cf7f8b25dd40c8d9578c6d9cbc5d.tar.gz |
Add a ``log'' command for logging specific information.
Add an ``UPTIME'' variable to indicate the bundle uptime.
It's now possible to put something like this in ppp.linkdown
for a server setup:
MYADDR:
log Session closing: User USER, address HISADDR, up UPTIME
Fixed some memory leakage with commands that expand words.
Made some functions static.
Fixed a diagnostic bug (iface add .... SIOCDIFADDR)
Diffstat (limited to 'usr.sbin/ppp/bundle.c')
-rw-r--r-- | usr.sbin/ppp/bundle.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 908a9a6..026eb68 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -1034,7 +1034,7 @@ bundle_ShowStatus(struct cmdargs const *arg) arg->bundle->iface->name, arg->bundle->bandwidth); if (arg->bundle->upat) { - int secs = time(NULL) - arg->bundle->upat; + int secs = bundle_Uptime(arg->bundle); prompt_Printf(arg->prompt, ", up time %d:%02d:%02d", secs / 3600, (secs / 60) % 60, secs % 60); @@ -1925,3 +1925,12 @@ bundle_ChangedPID(struct bundle *bundle) ioctl(bundle->dev.fd, TUNSIFPID, 0); #endif } + +int +bundle_Uptime(struct bundle *bundle) +{ + if (bundle->upat) + return time(NULL) - bundle->upat; + + return 0; +} |