]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: use mmap capture by default
authorEric Leblond <eric@regit.org>
Fri, 1 Apr 2016 12:01:09 +0000 (14:01 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 20 May 2016 10:32:40 +0000 (12:32 +0200)
Update the code to use mmap capture by default even in unset in
configuration file. mmap capture is now be turned off by using
explicitely 'use-mmap: no' in configuration.

src/runmode-af-packet.c
suricata.yaml.in

index f1c3dba31641ba2434110309a94d978ae2e45718..3deae4e3f6f91f9a134fdbf0b358584dc8157fde 100644 (file)
@@ -216,12 +216,17 @@ void *ParseAFPConfig(const char *iface)
         }
     }
 
-    (void)ConfGetChildValueBoolWithDefault(if_root, if_default, "use-mmap", (int *)&boolval);
-    if (boolval) {
-        SCLogInfo("Enabling mmaped capture on iface %s",
-                aconf->iface);
+    if (ConfGetChildValueBoolWithDefault(if_root, if_default, "use-mmap", (int *)&boolval) == 1) {
+        if (boolval) {
+            aconf->flags |= AFP_RING_MODE;
+        } else {
+            SCLogInfo("Disabling mmaped capture on iface %s",
+                    aconf->iface);
+        }
+    } else {
         aconf->flags |= AFP_RING_MODE;
     }
+
     (void)ConfGetChildValueBoolWithDefault(if_root, if_default, "mmap-locked", (int *)&boolval);
     if (boolval) {
         SCLogInfo("Enabling locked memory for mmap on iface %s",
index c08165cc2d5ee95aebb92b8e78e7cca11a034d7f..842aa45b3d1f3dd8f178302e0966071121ba7d4f 100644 (file)
@@ -525,7 +525,7 @@ af-packet:
   # Put default values here
   - interface: default
     #threads: auto
-    #use-mmap: yes
+    #use-mmap: no
     #rollover: yes
     tpacket-v3: yes