From: Victor Julien Date: Fri, 29 May 2020 12:27:24 +0000 (+0200) Subject: af-packet: fix warnings by undefined sanitizer X-Git-Tag: suricata-5.0.8~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0a709e92ab28cf5c86530df4edfc09b8f787376;p=thirdparty%2Fsuricata.git af-packet: fix warnings by undefined sanitizer (cherry picked from commit d8c82d4f39e6696a4bf63efaf76544722ad1bd97) --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 712fe521ee..a2213f1de5 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -174,11 +174,11 @@ TmEcode NoAFPSupportExit(ThreadVars *tv, const void *initdata, void **data) #ifndef TP_STATUS_USER_BUSY /* for new use latest bit available in tp_status */ -#define TP_STATUS_USER_BUSY (1 << 31) +#define TP_STATUS_USER_BUSY BIT_U32(31) #endif #ifndef TP_STATUS_VLAN_VALID -#define TP_STATUS_VLAN_VALID (1 << 4) +#define TP_STATUS_VLAN_VALID BIT_U32(4) #endif enum { @@ -2002,7 +2002,7 @@ int AFPIsFanoutSupported(int cluster_id) if (fd < 0) return 0; - uint16_t mode = PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG; + uint32_t mode = PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG; uint16_t id = 1; uint32_t option = (mode << 16) | (id & 0xffff); int r = setsockopt(fd, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option)); @@ -2171,7 +2171,7 @@ static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose) #ifdef HAVE_PACKET_FANOUT /* add binded socket to fanout group */ if (ptv->threads > 1) { - uint16_t mode = ptv->cluster_type; + uint32_t mode = ptv->cluster_type; uint16_t id = ptv->cluster_id; uint32_t option = (mode << 16) | (id & 0xffff); r = setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT,(void *)&option, sizeof(option));