if doing 'netstat -I <intf> -w <delay>', and netstat can't find an

interface of the given name, print an error message and exit.
This whole section of code needs to be re-thought, if interfaces
can be dynamically added or removed.
This commit is contained in:
cgd 1996-06-04 20:09:03 +00:00
parent 78937ab274
commit 525c9d6e37
1 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.16 1996/05/07 05:30:45 thorpej Exp $ */
/* $NetBSD: if.c,v 1.17 1996/06/04 20:09:03 cgd Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
static char *rcsid = "$NetBSD: if.c,v 1.16 1996/05/07 05:30:45 thorpej Exp $";
static char *rcsid = "$NetBSD: if.c,v 1.17 1996/06/04 20:09:03 cgd Exp $";
#endif
#endif /* not lint */
@ -283,7 +283,7 @@ sidewaysintpr(interval, off)
lastif = iftot;
sum = iftot + MAXIF - 1;
total = sum - 1;
interesting = iftot;
interesting = (interface == NULL) ? iftot : NULL;
for (off = firstifnet, ip = iftot; off;) {
if (kread(off, (char *)&ifnet, sizeof ifnet))
break;
@ -298,6 +298,11 @@ sidewaysintpr(interval, off)
break;
off = (u_long)ifnet.if_list.tqe_next;
}
if (interesting == NULL) {
fprintf(stderr, "%s: %s: unknown interface\n",
__progname, interface);
exit(1);
}
lastif = ip;
(void)signal(SIGALRM, catchalarm);