Verified Commit 2a1f7175 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Make errors from nfq_handle_packet nonfatal

We don't want to kill the whole thread, we want to just log it and try
to figure out what might go wrong.
parent 3904358c
Pipeline #1746 passed with stage
in 1 minute and 13 seconds
......@@ -128,7 +128,18 @@ bool NFQ::process() {
memset(data + pktSize, 0, size - pktSize);
}
recvHeaders[i].msg_hdr.msg_flags = 0;
CHECK(nfq_handle_packet(handle, data, recvHeaders[i].msg_len) == 0);
/*
* This function sometimes fails for an unknown reason. We just
* log it ‒ the packet will get handled together with some
* other one in a batch. That is wrong, but hopefully one
* packet won't do anything bad.
*
* In the meantime we hope this logging will shed some light
* into why the function might want to fail from time to time.
*/
int result = nfq_handle_packet(handle, data, recvHeaders[i].msg_len);
if (result != 0)
LOG(ERROR, "Failed to handle a packet: ", result, "/", Blob(data, recvHeaders[i].msg_len).toString());
}
// Process the packets and assign flows
const Flows &flows(dissector.process(packets));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment