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
This commit is contained in:
Jordan K. Hubbard 1994-11-19 13:57:21 +00:00
parent ee2b9e6b02
commit db85ed15df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4673
2 changed files with 34 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 <stdio.h>
@ -37,6 +37,7 @@ static char rcsid[] = "$Id: slstat.c,v 1.1.1.1 1994/06/17 06:42:39 rich Exp $";
#include <sys/mbuf.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/file.h>
#include <errno.h>
#include <signal.h>
@ -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;
}