From: Eric Leblond Date: Sat, 30 Dec 2017 21:04:04 +0000 (+0100) Subject: af-packet: improve xdp error handling X-Git-Tag: suricata-4.1.0-beta1~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e729f059f438fa2955a10e15b63f31731c540b7;p=thirdparty%2Fsuricata.git af-packet: improve xdp error handling Don't try to bypass the flow if the flow table is unknown. Also continue after error message if ever XDP was not correctly setup. --- diff --git a/src/runmode-af-packet.c b/src/runmode-af-packet.c index 1b15a28d00..71337df9c6 100644 --- a/src/runmode-af-packet.c +++ b/src/runmode-af-packet.c @@ -479,7 +479,6 @@ static void *ParseAFPConfig(const char *iface) if (ret != 0) { SCLogWarning(SC_ERR_INVALID_VALUE, "Error when setting up XDP"); - /* FIXME error handling */ } } #else diff --git a/src/source-af-packet.c b/src/source-af-packet.c index fa4bacd5ca..a7710b46ff 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -2262,10 +2262,14 @@ TmEcode AFPSetBPFFilter(AFPThreadVars *ptv) */ static int AFPInsertHalfFlow(int mapd, void *key, uint64_t inittime) { - /* FIXME error handling */ unsigned int nr_cpus = UtilCpuGetNumProcessorsConfigured(); struct pair value[nr_cpus]; unsigned int i; + + if (mapd == -1) { + return 0; + } + for (i = 0; i < nr_cpus; i++) { value[i].time = inittime; value[i].packets = 0;