]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: terminate on same interface & copyiface 9370/head
authorShivani Bhardwaj <shivani@oisf.net>
Thu, 10 Aug 2023 12:17:35 +0000 (17:47 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 10 Aug 2023 12:17:35 +0000 (17:47 +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

src/runmode-af-packet.c

index fff1bd45b98a7d53c0c6a8f4aae1fa88d81b31e7..fd21c26293f3d88577dcb06aaab45ee919290a8c 100644 (file)
@@ -290,6 +290,11 @@ static void *ParseAFPConfig(const char *iface)
         if (out_iface != NULL) {
             if (strlen(out_iface) > 0) {
                 aconf->out_iface = out_iface;
+                if (strcmp(iface, out_iface) == 0) {
+                    FatalError(
+                            "Invalid config: interface (%s) and copy-iface (%s) can't be the same",
+                            iface, out_iface);
+                }
             }
         } else {
             SCLogWarning("copy-iface corresponding to %s interface cannot be NULL", iface);