diff options
author | jkh <jkh@FreeBSD.org> | 1994-11-19 13:57:21 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1994-11-19 13:57:21 +0000 |
commit | c49122881a112d0f782f7e48538ba5e607e9bc1b (patch) | |
tree | ccb20d4bb5f107f44d527ced68940d5a2760a38a /usr.sbin/pppstats | |
parent | 33879b3599a5b8bf60b3f49055c1e2a75bbcbe24 (diff) | |
download | FreeBSD-src-c49122881a112d0f782f7e48538ba5e607e9bc1b.zip FreeBSD-src-c49122881a112d0f782f7e48538ba5e607e9bc1b.tar.gz |
Some miscellaneous bug fixes inspired by Adam Glass's work. Adam's
work is actually more comprehensive, but I just took what was needed
for now given our compressed time schedules. Thanks, Adam!
Submitted by: glass
Diffstat (limited to 'usr.sbin/pppstats')
-rw-r--r-- | usr.sbin/pppstats/pppstats.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/pppstats/pppstats.c b/usr.sbin/pppstats/pppstats.c index 018277a..1a1e7eb 100644 --- a/usr.sbin/pppstats/pppstats.c +++ b/usr.sbin/pppstats/pppstats.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: pppstats.c,v 1.1.1.1 1994/11/12 06:07:15 lars Exp $"; +static char rcsid[] = "$Id: pppstats.c,v 1.2 1994/11/12 19:33:41 lars Exp $"; #endif #include <ctype.h> @@ -39,6 +39,7 @@ static char rcsid[] = "$Id: pppstats.c,v 1.1.1.1 1994/11/12 06:07:15 lars Exp $" #include <sys/mbuf.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/sockio.h> #include <sys/file.h> #include <net/if.h> #include <netinet/in.h> @@ -59,6 +60,9 @@ static char rcsid[] = "$Id: pppstats.c,v 1.1.1.1 1994/11/12 06:07:15 lars Exp $" #include <net/ppp_str.h> #endif +#define INTERFACE_PREFIX "ppp%d" +char interface[IFNAMSIZ]; + #ifdef BSD4_4 #define KVMLIB #endif @@ -146,9 +150,21 @@ main(argc, argv) continue; } if (isdigit(argv[0][0])) { + int s; + struct ifreq ifr; + unit = atoi(argv[0]); if (unit < 0) usage(); + sprintf(interface, INTERFACE_PREFIX, unit); + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) + err(1, "creating socket"); + strcpy(ifr.ifr_name, interface); + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) + errx(1, + "unable to confirm existence of interface '%s'", + interface); ++argv, --argc; continue; } |