vlan and bpf

Greg Troxel <[email protected]>
Newsgroups gmane.os.netbsd.devel.network
Message-ID <[email protected]>
I am using vlans (on wm0 and vlan0), and when I run tcpdump on the
parent, I see the packets that are on the vlan.

This is causing trouble because dhcpd is seeing them.

I think it's a bug; the packet is on wm0 with a vlan tag, but it is not
on wm0 in the normal sense.  It shows up when tcpdumping on vlan0, which
is correct.  So I think packets with a vlan tag not for this interface
should not hit bpf_mtap.

This patch has not even been compiled, and I know it misses the
non-percpuq case, but I'm including it to say more clearly what I am
thinking.

--- if.c.~1.457.2.4.~   2020-09-01 19:56:43.824457852 -0400
+++ if.c        2023-12-15 12:10:09.503560965 -0500
@@ -818,7 +818,8 @@ if_percpuq_softint(void *arg)

        while ((m = if_percpuq_dequeue(ipq)) != NULL) {
                ifp->if_ipackets++;
-               bpf_mtap(ifp, m, BPF_D_IN);
+               if (!vlan_has_tag(m))
+                       bpf_mtap(ifp, m, BPF_D_IN);

                ifp->_if_input(ifp, m);
        }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.