Print the interface for bpf.
This commit is contained in:
parent
d8571daf5b
commit
f51d1f25b9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fstat.c,v 1.110 2015/12/22 23:35:21 christos Exp $ */
|
||||
/* $NetBSD: fstat.c,v 1.111 2016/12/30 21:08:23 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: fstat.c,v 1.110 2015/12/22 23:35:21 christos Exp $");
|
||||
__RCSID("$NetBSD: fstat.c,v 1.111 2016/12/30 21:08:23 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -651,23 +651,23 @@ vtrans(struct vnode *vp, int i, int flag, long addr)
|
|||
char buf[1024];
|
||||
(void)snprintb(buf, sizeof(buf), VNODE_FLAGBITS,
|
||||
vn.v_iflag | vn.v_vflag | vn.v_uflag);
|
||||
(void)printf(" flags %s\n", buf);
|
||||
(void)printf(" flags %s\n", buf);
|
||||
return;
|
||||
} else if (badtype) {
|
||||
(void)printf(" - - %10s -\n", badtype);
|
||||
(void)printf(" - - %10s -\n", badtype);
|
||||
return;
|
||||
}
|
||||
if (nflg)
|
||||
(void)printf(" %2llu,%-2llu",
|
||||
(void)printf(" %2llu,%-2llu",
|
||||
(unsigned long long)major(fst.fsid),
|
||||
(unsigned long long)minor(fst.fsid));
|
||||
else
|
||||
(void)printf(" %-8s", getmnton(vn.v_mount));
|
||||
(void)printf(" %-8s", getmnton(vn.v_mount));
|
||||
if (nflg)
|
||||
(void)snprintf(mode, sizeof mode, "%o", fst.mode);
|
||||
else
|
||||
strmode(fst.mode, mode);
|
||||
(void)printf(" %7"PRIu64" %*s", fst.fileid, nflg ? 5 : 10, mode);
|
||||
(void)printf(" %7"PRIu64" %*s", fst.fileid, nflg ? 5 : 10, mode);
|
||||
switch (vn.v_type) {
|
||||
case VBLK:
|
||||
case VCHR: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: misc.c,v 1.16 2016/01/23 16:12:03 christos Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.17 2016/12/30 21:08:23 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: misc.c,v 1.16 2016/01/23 16:12:03 christos Exp $");
|
||||
__RCSID("$NetBSD: misc.c,v 1.17 2016/12/30 21:08:23 christos Exp $");
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -113,12 +113,25 @@ static int
|
|||
p_bpf(struct file *f)
|
||||
{
|
||||
struct bpf_d bpf;
|
||||
struct bpf_if bi;
|
||||
struct ifnet ifn;
|
||||
|
||||
strlcpy(ifn.if_xname, "???", sizeof(ifn.if_xname));
|
||||
|
||||
if (!KVM_READ(f->f_data, &bpf, sizeof(bpf))) {
|
||||
dprintf("can't read bpf at %p for pid %d", f->f_data, Pid);
|
||||
return 0;
|
||||
}
|
||||
(void)printf("* bpf rec=%lu, dr=%lu, cap=%lu, pid=%lu",
|
||||
if (bpf.bd_bif != NULL) {
|
||||
if (!KVM_READ(bpf.bd_bif, &bi, sizeof(bi)))
|
||||
dprintf("can't read bpf interface at %p for pid %d",
|
||||
bpf.bd_bif, Pid);
|
||||
if (bi.bif_ifp != NULL)
|
||||
if (!KVM_READ(bi.bif_ifp, &ifn, sizeof(ifn)))
|
||||
dprintf("can't read net interfsace"
|
||||
" at %p for pid %d", bi.bif_ifp, Pid);
|
||||
}
|
||||
(void)printf("* bpf@%s rec=%lu, dr=%lu, cap=%lu, pid=%lu", ifn.if_xname,
|
||||
bpf.bd_rcount, bpf.bd_dcount, bpf.bd_ccount,
|
||||
(unsigned long)bpf.bd_pid);
|
||||
if (bpf.bd_promisc)
|
||||
|
|
Loading…
Reference in New Issue