Add support for printing bridging statistics with ``-p bdg '' .
If someone has a better flag to use I'll be glad to change it.
This commit is contained in:
parent
1e83f7627b
commit
0024d1db07
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46097
@ -36,18 +36,20 @@
|
||||
static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: if.c,v 1.24 1998/07/06 21:01:23 bde Exp $";
|
||||
"$Id: if.c,v 1.25 1999/04/20 22:04:31 billf Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/bridge.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
@ -76,6 +78,39 @@ static const char rcsid[] =
|
||||
static void sidewaysintpr __P((u_int, u_long));
|
||||
static void catchalarm __P((int));
|
||||
|
||||
void
|
||||
bdg_stats(u_long dummy, char *name) /* print bridge statistics */
|
||||
{
|
||||
int i, slen ;
|
||||
struct bdg_stats s ;
|
||||
int mib[4] ;
|
||||
|
||||
slen = sizeof(s);
|
||||
|
||||
mib[0] = CTL_NET ;
|
||||
mib[1] = PF_LINK ;
|
||||
mib[2] = IFT_ETHER ;
|
||||
mib[3] = PF_BDG ;
|
||||
if (sysctl(mib,4, &s,&slen,NULL,0)==-1)
|
||||
return ; /* no bridging */
|
||||
printf("-- Bridging statistics (%s) --\n", name) ;
|
||||
printf(
|
||||
"Name In Out Forward Drop Bcast Mcast Local Unknown\n");
|
||||
for (i = 0 ; i < 16 ; i++) {
|
||||
if (s.s[i].name[0])
|
||||
printf("%-6s %9d%9d%9d%9d%9d%9d%9d%9d\n",
|
||||
s.s[i].name,
|
||||
s.s[i].p_in[(int)BDG_IN],
|
||||
s.s[i].p_in[(int)BDG_OUT],
|
||||
s.s[i].p_in[(int)BDG_FORWARD],
|
||||
s.s[i].p_in[(int)BDG_DROP],
|
||||
s.s[i].p_in[(int)BDG_BCAST],
|
||||
s.s[i].p_in[(int)BDG_MCAST],
|
||||
s.s[i].p_in[(int)BDG_LOCAL],
|
||||
s.s[i].p_in[(int)BDG_UNKNOWN] );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a description of the network interfaces.
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ char const copyright[] =
|
||||
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: main.c,v 1.23 1999/01/18 02:09:15 fenner Exp $";
|
||||
"$Id: main.c,v 1.24 1999/02/06 19:12:48 jhay Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -145,6 +145,8 @@ struct protox {
|
||||
icmp_stats, "icmp", IPPROTO_ICMP },
|
||||
{ -1, -1, 1, protopr,
|
||||
igmp_stats, "igmp", IPPROTO_IGMP },
|
||||
{ -1, -1, 1, protopr,
|
||||
bdg_stats, "bdg", 1 /* bridging... */ },
|
||||
{ -1, -1, 0, 0,
|
||||
0, 0 }
|
||||
};
|
||||
|
@ -169,6 +169,8 @@ Show statistics about
|
||||
which is either a well-known name for a protocol or an alias for it. Some
|
||||
protocol names and aliases are listed in the file
|
||||
.Pa /etc/protocols .
|
||||
The special protocol name ``bdg''
|
||||
is used to show bridging statistics.
|
||||
A null response typically means that there are no interesting numbers to
|
||||
report.
|
||||
The program will complain if
|
||||
|
@ -66,6 +66,7 @@ void udp_stats __P((u_long, char *));
|
||||
void ip_stats __P((u_long, char *));
|
||||
void icmp_stats __P((u_long, char *));
|
||||
void igmp_stats __P((u_long, char *));
|
||||
void bdg_stats __P((u_long, char *));
|
||||
void protopr __P((u_long, char *));
|
||||
|
||||
void mbpr __P((void));
|
||||
|
Loading…
Reference in New Issue
Block a user