]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1461 in SNORT/snort3 from ~DERAMADA/snort3:ips_binder to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 12 Dec 2018 14:57:49 +0000 (09:57 -0500)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 12 Dec 2018 14:57:49 +0000 (09:57 -0500)
Squashed commit of the following:

commit 4b6aed33ddd66eb0283cae99872b200b019971fe
Author: deramada <deramada@cisco.com>
Date:   Mon Dec 10 15:29:41 2018 -0500

    binder: store user set ips policy id from lua

src/network_inspectors/binder/bind_module.cc
src/network_inspectors/binder/binder.cc
src/network_inspectors/binder/binding.h

index d6676d13071f90cfc69d7c14d3a213e3f3b0a4cd..b2ee4d8d854cc281f178f9b8fbfed9571bd7bace 100644 (file)
@@ -203,7 +203,7 @@ bool BinderModule::set(const char* fqn, Value& v, SnortConfig*)
         work->when.split_nets = true;
     }
     else if ( v.is("ips_policy_id") )
-        work->when.ips_id = v.get_uint32();
+        work->when.ips_id_user = v.get_uint32();
 
     else if ( v.is("proto") )
     {
index 4c63ae0accd70a9105788ea80085f756e22411c3..76c2b394f5ddf3ea25427458644b9bb6e8993991 100644 (file)
@@ -74,6 +74,7 @@ Binding::Binding()
     when.dst_zone = DAQ_PKTHDR_UNKNOWN;
 
     when.ips_id = 0;
+    when.ips_id_user = 0;
     when.role = BindWhen::BR_EITHER;
 
     use.inspection_index = 0;
@@ -656,9 +657,9 @@ bool Binder::configure(SnortConfig* sc)
         Binding* pb = bindings[i];
 
         // Update with actual policy indices instead of user provided names
-        if ( pb->when.ips_id )
+        if ( pb->when.ips_id_user )
         {
-            IpsPolicy* p = sc->policy_map->get_user_ips(pb->when.ips_id);
+            IpsPolicy* p = sc->policy_map->get_user_ips(pb->when.ips_id_user);
             if ( p )
                 pb->when.ips_id = p->policy_id;
             else
index 54ab96e8ff5b98268fe4302443cab864198a6a20..e4dee3e553df4792e054a64a2990c8b4f595e6e3 100644 (file)
@@ -23,6 +23,7 @@
 #include <string>
 
 #include "framework/bits.h"
+#include "main/policy.h"
 #include "sfip/sf_ipvar.h"
 
 namespace snort
@@ -36,7 +37,8 @@ struct BindWhen
     enum Role
     { BR_CLIENT, BR_SERVER, BR_EITHER, BR_MAX };
 
-    unsigned ips_id;
+    PolicyId ips_id;
+    unsigned ips_id_user;
     unsigned protos;
     Role role;
     std::string svc;