]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: code cleaning
authorEric Leblond <el@stamus-networks.com>
Sat, 11 Jan 2025 19:16:02 +0000 (20:16 +0100)
committerVictor Julien <vjulien@oisf.net>
Wed, 12 Feb 2025 06:37:09 +0000 (07:37 +0100)
clang-tidy did detect the -1 return value was not compatible with
TmEcode enum.

src/source-af-packet.c

index e3c83da49de4de9a7187182079f3ec75bdf8d224..10213c573879000f3a102a986765d8c599e10281 100644 (file)
@@ -1849,21 +1849,21 @@ static int SockFanoutSeteBPF(AFPThreadVars *ptv)
     return 0;
 }
 
-static int SetEbpfFilter(AFPThreadVars *ptv)
+static TmEcode SetEbpfFilter(AFPThreadVars *ptv)
 {
     int pfd = ptv->ebpf_filter_fd;
     if (pfd == -1) {
         SCLogError("Filter file descriptor is invalid");
-        return -1;
+        return TM_ECODE_FAILED;
     }
 
     if (setsockopt(ptv->socket, SOL_SOCKET, SO_ATTACH_BPF, &pfd, sizeof(pfd))) {
         SCLogError("Error setting ebpf: %s", strerror(errno));
-        return -1;
+        return TM_ECODE_FAILED;
     }
     SCLogInfo("Activated eBPF filter on socket");
 
-    return 0;
+    return TM_ECODE_OK;
 }
 #endif