]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcap: don't fail with --pcap with no device present 2183/head
authorJason Ish <ish@unx.ca>
Fri, 29 Jul 2016 16:47:23 +0000 (10:47 -0600)
committerJason Ish <ish@unx.ca>
Fri, 29 Jul 2016 16:47:23 +0000 (10:47 -0600)
Issue: 1856.

A device with the name of "" (empty string) was being added
with LiveRegisterDevice which failed to initialize causing
Suricata to fail.

src/suricata.c

index a6e3e1f7b1a0fa5b0afc05f012afd83b0cd13542..28e764f6668e081ab003c482f3c5449eadf9d2c0 100644 (file)
@@ -1167,7 +1167,9 @@ static int ParseCommandLinePcapLive(SCInstance *suri, const char *optarg)
 
     if (suri->run_mode == RUNMODE_UNKNOWN) {
         suri->run_mode = RUNMODE_PCAP_DEV;
-        LiveRegisterDevice(suri->pcap_dev);
+        if (optarg) {
+            LiveRegisterDevice(suri->pcap_dev);
+        }
     } else if (suri->run_mode == RUNMODE_PCAP_DEV) {
 #ifdef OS_WIN32
         SCLogError(SC_ERR_PCAP_MULTI_DEV_NO_SUPPORT, "pcap multi dev "