From 1e729f059f438fa2955a10e15b63f31731c540b7 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sat, 30 Dec 2017 22:04:04 +0100 Subject: [PATCH] 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. --- src/runmode-af-packet.c | 1 - src/source-af-packet.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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; -- 2.47.2