]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3361: binder: Add binder action handling on service change
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 13 Apr 2022 10:43:05 +0000 (10:43 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 13 Apr 2022 10:43:05 +0000 (10:43 +0000)
Merge in SNORT/snort3 from ~DKYRYLOV/snort3:binder_flow_change_action to master

Squashed commit of the following:

commit b57a7773c54c8c65f35d19a7f4c596e6a1ddad5c
Author: dkyrylov <dkyrylov@cisco.com>
Date:   Fri Apr 1 16:40:44 2022 +0300

    binder: add binder actions to flow reassignment
        Thanks to Meridoff for the original report of the issue.

src/network_inspectors/binder/binder.cc

index f4ba3d3c9aedecf5eb147f4ea9d4c0e34b35abcc..518464ec6aee6cadbaa4c58a10394f2b8e5e7f1e 100644 (file)
@@ -746,10 +746,21 @@ void Binder::handle_flow_setup(Flow& flow, bool standby)
 
 void Binder::handle_flow_service_change(Flow& flow)
 {
+    bstats.service_changes++;
+
     Profile profile(bindPerfStats);
+    Stuff stuff;
+
+    get_bindings(flow, stuff);
+    if (stuff.action != BindUse::BA_INSPECT)
+    {
+        stuff.apply_action(flow);
+        return;
+    }
 
     Inspector* ins = nullptr;
     Inspector* data = nullptr;
+
     if (flow.has_service())
     {
         ins = find_gadget(flow, data);
@@ -813,8 +824,6 @@ void Binder::handle_flow_service_change(Flow& flow)
             Stream::set_splitter(&flow, false, new AtomSplitter(false));
         }
     }
-
-    bstats.service_changes++;
 }
 
 void Binder::handle_assistant_gadget(const char* service, Flow& flow)