]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: terminate on same interface & copyiface 9391/head
authorShivani Bhardwaj <shivani@oisf.net>
Thu, 10 Aug 2023 12:17:35 +0000 (17:47 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 17 Aug 2023 06:20:13 +0000 (11:50 +0530)
If the interface and copy-iface are same for an af-packet IPS device
setting then fataly exit else it leads to a segfault in later stages.

Bug 5870

(cherry picked from commit d4dd53c95f5fe30a0b2a1e71ab185c06c71a1afe)

src/runmode-af-packet.c

index 27a6bd26c2c1dabcb051c7387a291626532775bf..8019bd063d734c299d12df48e25b18e4f46a7d18 100644 (file)
@@ -201,6 +201,11 @@ static void *ParseAFPConfig(const char *iface)
     if (ConfGetChildValueWithDefault(if_root, if_default, "copy-iface", &out_iface) == 1) {
         if (strlen(out_iface) > 0) {
             aconf->out_iface = out_iface;
+            if (strcmp(iface, out_iface) == 0) {
+                FatalError(SC_ERR_FATAL,
+                        "Invalid config: interface (%s) and copy-iface (%s) can't be the same",
+                        iface, out_iface);
+            }
         }
     }