[Snort-devel] [PATCH 2/2] daq_nfq: avoid uneeded -ENOBUFS on queue overrun

Russ Combs rcombs at ...402...
Fri Apr 29 14:37:56 EDT 2011


Thanks Florian.  I added this to an existing bug on error handling by the
NFQ DAQ which is targeted for the 2.9.1 release.

On Fri, Apr 29, 2011 at 8:36 AM, Florian Westphal <fwestphal at ...2119...>wrote:

> netlink signals event queue overflows by returning -ENOBUFS to
> userspace.
>
> daq_nfq does not need to care about this, so ignore ENOBUFS and tell
> the kernel to not notify us in the first place.
> ---
>  os-daq-modules/daq_nfq.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/os-daq-modules/daq_nfq.c b/os-daq-modules/daq_nfq.c
> index d55e9d6..55ac811 100644
> --- a/os-daq-modules/daq_nfq.c
> +++ b/os-daq-modules/daq_nfq.c
> @@ -338,6 +338,11 @@ static int nfq_daq_initialize (
>         }
>     }
>
> +    // tell kernel that we do not need to know about queue overflows.
> +    // Without this, read operations on the netlink socket will fail
> +    // with ENOBUFS on queue overrun.
> +    setsockopt(impl->sock, SOL_NETLINK, NETLINK_NO_ENOBUFS, &(int){1},
> +                                                         sizeof(int));
>     impl->state = DAQ_STATE_INITIALIZED;
>
>     *handle = impl;
> --
> 1.7.3.4
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Snort-devel mailing list
> Snort-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/snort-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.snort.org/pipermail/snort-devel/attachments/20110429/a98bf280/attachment.html>


More information about the Snort-devel mailing list