From: Eric Leblond Date: Fri, 1 Apr 2016 12:01:09 +0000 (+0200) Subject: af-packet: use mmap capture by default X-Git-Tag: suricata-3.1RC1~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=876b356bbe335a50aec1c9e1222fa9584fba51b4;p=thirdparty%2Fsuricata.git af-packet: use mmap capture by default 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. --- diff --git a/src/runmode-af-packet.c b/src/runmode-af-packet.c index f1c3dba316..3deae4e3f6 100644 --- a/src/runmode-af-packet.c +++ b/src/runmode-af-packet.c @@ -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", diff --git a/suricata.yaml.in b/suricata.yaml.in index c08165cc2d..842aa45b3d 100644 --- a/suricata.yaml.in +++ b/suricata.yaml.in @@ -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