[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFSh4UzG=WpnLr5ZYCK16t3M22HV9gf-UuvM4Un+8sQBm2uSVw@mail.gmail.com>
Date: Fri, 15 Jan 2021 22:45:59 +0000
From: Tom Cook <tom.k.cook@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: cBPF socket filters failing - inexplicably?
On Fri, Jan 15, 2021 at 2:16 PM Eric Dumazet <edumazet@...gle.com> wrote:
[snip]
> > My wild guess is that as soon as socket got created:
> > socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
> > the packets were already queued to it.
> > So later setsockopt() is too late to filter.
> >
> > Eric, thoughts?
>
> Exactly, this is what happens.
I understand. Thanks for the explanation.
> I do not know how tcpdump and other programs deal with this.
>
> Maybe by setting a small buffer size, or draining the queue.
libpcap has its own cBPF implementation which it applies after it
receives the packets from the queue.
Thanks again,
Tom Cook
Powered by blists - more mailing lists