Re: vlan and bpf

Shoichi Yamaguchi <[email protected]>
Newsgroups gmane.os.netbsd.devel.network
Message-ID <CAPnD6HpGOL8rYR+aB373XOoUtN_7bn6V1w8Tt=ejR3RKyLN7MQ@mail.gmail.com>
(I resend because I forgot to send to tech-net@)

Hi,

On Sat, Dec 16, 2023 at 2:11 AM Greg Troxel <[email protected]> wrote:
>
> 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.

I guess VLAN hardware tagging is enabled on wm0 and your kernel version is
NetBSD-9 or older. I changed this behavior at
https://mail-index.netbsd.org/source-changes-hg/2022/06/20/msg356979.html

After the change, I think tcpdump on wm0 shows VLAN frames and
tcpdump on vlan0 shows IP frames even if VLAN hardware tagging
is enabled on wm0.

On Sat, Dec 16, 2023 at 2:11 AM Greg Troxel <[email protected]> wrote:
>
> 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.