af_packet: Add -Wunused and -Werror

This would've found the enable_defrag issue and also points out another
unused variable.
This commit is contained in:
Arne Welzel 2022-09-16 14:43:36 +02:00 committed by Tim Wojtulewicz
parent 41331e5605
commit 6ad8e3ed24
2 changed files with 8 additions and 7 deletions

View file

@ -5,6 +5,8 @@ project(ZeekPluginAF_Packet)
include(ZeekPlugin) include(ZeekPlugin)
add_compile_options(-Wunused -Werror)
zeek_plugin_begin(Zeek AF_Packet) zeek_plugin_begin(Zeek AF_Packet)
zeek_plugin_cc(src/Plugin.cc) zeek_plugin_cc(src/Plugin.cc)
zeek_plugin_cc(src/AF_Packet.cc) zeek_plugin_cc(src/AF_Packet.cc)

View file

@ -223,13 +223,12 @@ bool AF_PacketSource::ExtractNextPacket(zeek::Packet* pkt)
if ( ! socket_fd ) if ( ! socket_fd )
return false; return false;
struct tpacket3_hdr *packet = 0; struct tpacket3_hdr *packet = 0;
const u_char *data; const u_char *data;
struct timeval ts; while ( true )
while ( true ) {
{ if ( ! rx_ring->GetNextPacket(&packet) )
if ( ! rx_ring->GetNextPacket(&packet) ) return false;
return false;
current_hdr.ts.tv_sec = packet->tp_sec; current_hdr.ts.tv_sec = packet->tp_sec;
current_hdr.ts.tv_usec = packet->tp_nsec / 1000; current_hdr.ts.tv_usec = packet->tp_nsec / 1000;