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:
parent
78937ab274
commit
525c9d6e37
@ -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
|
* Copyright (c) 1983, 1988, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
|
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
|
||||||
#else
|
#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
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ sidewaysintpr(interval, off)
|
|||||||
lastif = iftot;
|
lastif = iftot;
|
||||||
sum = iftot + MAXIF - 1;
|
sum = iftot + MAXIF - 1;
|
||||||
total = sum - 1;
|
total = sum - 1;
|
||||||
interesting = iftot;
|
interesting = (interface == NULL) ? iftot : NULL;
|
||||||
for (off = firstifnet, ip = iftot; off;) {
|
for (off = firstifnet, ip = iftot; off;) {
|
||||||
if (kread(off, (char *)&ifnet, sizeof ifnet))
|
if (kread(off, (char *)&ifnet, sizeof ifnet))
|
||||||
break;
|
break;
|
||||||
@ -298,6 +298,11 @@ sidewaysintpr(interval, off)
|
|||||||
break;
|
break;
|
||||||
off = (u_long)ifnet.if_list.tqe_next;
|
off = (u_long)ifnet.if_list.tqe_next;
|
||||||
}
|
}
|
||||||
|
if (interesting == NULL) {
|
||||||
|
fprintf(stderr, "%s: %s: unknown interface\n",
|
||||||
|
__progname, interface);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
lastif = ip;
|
lastif = ip;
|
||||||
|
|
||||||
(void)signal(SIGALRM, catchalarm);
|
(void)signal(SIGALRM, catchalarm);
|
||||||
|
Loading…
Reference in New Issue
Block a user