From: Eric Leblond Date: Tue, 4 Jun 2019 12:48:03 +0000 (+0200) Subject: af-packet: avoid error flooding when bypass fails X-Git-Tag: suricata-5.0.0-rc1~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e62ae6d28a43dfac716100e342130cabe1149ba;p=thirdparty%2Fsuricata.git af-packet: avoid error flooding when bypass fails --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 8f023ce484..496a2a4268 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -2532,6 +2532,10 @@ static int AFPXDPBypassCallback(Packet *p) return 0; } + +bool g_flowv4_ok = true; +bool g_flowv6_ok = true; + /** * \brief Init function for ReceiveAFP. * @@ -2605,11 +2609,19 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, const void *initdata, void **data) if (ptv->flags & (AFP_BYPASS|AFP_XDPBYPASS)) { ptv->v4_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v4"); if (ptv->v4_map_fd == -1) { - SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'", "flow_table_v4"); + if (g_flowv4_ok == false) { + SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'", + "flow_table_v4"); + g_flowv4_ok = true; + } } ptv->v6_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v6"); if (ptv->v6_map_fd == -1) { - SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'", "flow_table_v6"); + if (g_flowv6_ok) { + SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'", + "flow_table_v6"); + g_flowv6_ok = false; + } } } ptv->ebpf_t_config = afpconfig->ebpf_t_config;