Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci adjust OpenBSD mbuf handling so tcpdump(1) works...



details:   https://anonhg.NetBSD.org/src/rev/fcfecc062ae0
branches:  trunk
changeset: 974370:fcfecc062ae0
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Jul 29 13:00:26 2020 +0000

description:
adjust OpenBSD mbuf handling so tcpdump(1) works there; from genua

keep code as-is for NetBSD, DLT_RAW works there

diffstat:

 sys/dev/pci/xmm7360.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 849c54c0ab79 -r fcfecc062ae0 sys/dev/pci/xmm7360.c
--- a/sys/dev/pci/xmm7360.c     Wed Jul 29 09:00:05 2020 +0000
+++ b/sys/dev/pci/xmm7360.c     Wed Jul 29 13:00:26 2020 +0000
@@ -74,7 +74,7 @@
 #include "opt_gateway.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.3 2020/07/27 14:09:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.4 2020/07/29 13:00:26 jdolecek Exp $");
 #endif
 
 #include <sys/param.h>
@@ -3029,6 +3029,10 @@
                /* NOTREACHED */
        }
 
+       /* Needed for tcpdump(1) et.al */
+       m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
+       m_adj(m, sizeof(u_int32_t));
+
        (*input)(ifp, m);
        return 1;
 }
@@ -3242,8 +3246,13 @@
        if_deferred_start_init(ifp, NULL);
        if_alloc_sadl(ifp);
 #if NBPFILTER > 0
+#ifdef __OpenBSD__
+       bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
+#endif
+#ifdef __NetBSD__
        bpfattach(&ifp->if_bpf, ifp, DLT_RAW, 0);
 #endif
+#endif
 
        printf("\n");
 



Home | Main Index | Thread Index | Old Index