diff --git a/usr.sbin/pppstats/pppstats.c b/usr.sbin/pppstats/pppstats.c index 018277a62bb..1a1e7ebec3d 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 @@ -39,6 +39,7 @@ static char rcsid[] = "$Id: pppstats.c,v 1.1.1.1 1994/11/12 06:07:15 lars Exp $" #include #include #include +#include #include #include #include @@ -59,6 +60,9 @@ static char rcsid[] = "$Id: pppstats.c,v 1.1.1.1 1994/11/12 06:07:15 lars Exp $" #include #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; } diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c index 1382518e3d6..87e91382817 100644 --- a/usr.sbin/slstat/slstat.c +++ b/usr.sbin/slstat/slstat.c @@ -22,7 +22,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: slstat.c,v 1.1.1.1 1994/06/17 06:42:39 rich Exp $"; +static char rcsid[] = "$Id: slstat.c,v 1.2 1994/10/17 06:05:32 davidg Exp $"; #endif #include @@ -37,6 +37,7 @@ static char rcsid[] = "$Id: slstat.c,v 1.1.1.1 1994/06/17 06:42:39 rich Exp $"; #include #include #include +#include #include #include #include @@ -55,6 +56,9 @@ struct nlist nl[] = { { 0 } }; +#define INTERFACE_PREFIX "sl%d" +char interface[IFNAMSIZ]; + const char *system = NULL; char *kmemf = NULL; @@ -99,9 +103,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; }