]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: fix warnings by undefined sanitizer
authorVictor Julien <victor@inliniac.net>
Fri, 29 May 2020 12:27:24 +0000 (14:27 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 30 May 2020 18:39:34 +0000 (20:39 +0200)
src/source-af-packet.c

index db6b906268fe7dc2dbd494f5ed6e7a1ec2962799..c6c46ae44fa02968bea10e37979e628e31e6bb0f 100644 (file)
@@ -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 {
@@ -1989,7 +1989,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));
@@ -2158,7 +2158,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));