Snort mailing list archives

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


From: Florian Westphal <fwestphal () astaro com>
Date: Fri, 29 Apr 2011 14:36:05 +0200

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 () lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/snort-devel


Current thread: