]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
apply service from hosts when inspector already bound to flow
authorRuss Combs <rucombs@cisco.com>
Wed, 25 Mar 2015 21:25:29 +0000 (17:25 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 25 Mar 2015 21:25:29 +0000 (17:25 -0400)
ChangeLog
src/detection/pcrm.cc
src/network_inspectors/binder/binder.cc

index 378512cc5ede1bd2fcc06db5830255315d286d3f..0a7e42d9d6f8bb28a6c92b95685741badb99eaf4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 Pending - build 143
 
+-- apply service from hosts when inspector already bound to flow
 -- ensure direction and service are applied to packet regardless of flow state
 -- enable active for react / reject only if used in configuration
 -- fixed use of bound ip and tcp policy if not set in hosts
index 32ed0a540a0d15f8715d5a7b3032f4f39cf1f441..a45e6b2b42a45be5af01061f308c53bbf861fb60 100644 (file)
@@ -1178,7 +1178,7 @@ int prmFindRuleGroup(
 
 int prmFindGenericRuleGroup(PORT_RULE_MAP* p, PORT_GROUP** gen)
 {
-    if (gen == NULL)
+    if ( !p or !gen )
     {
         return 0;
     }
index fbaa7412bb762dfde5a781daa4c693cf7203cd90..52611a5abf88ccb6ec6a4bd1ed55c0b8740996df 100644 (file)
@@ -203,10 +203,13 @@ static void set_session(Flow* flow)
     flow->clouseau = nullptr;
 }
 
-static Inspector* get_gadget(Flow* flow, const HostAttributeEntry* host)
+static void set_service(Flow* flow, const HostAttributeEntry* host)
 {
     stream.set_application_protocol_id_from_host_entry(flow, host, SSN_DIR_FROM_SERVER);
+}
 
+static Inspector* get_gadget(Flow* flow)
+{
     if ( !flow->ssn_state.application_protocol )
         return nullptr;
 
@@ -340,8 +343,11 @@ void Stuff::apply_service(Flow* flow, const HostAttributeEntry* host)
     if ( data )
         flow->set_data(data);
 
-    if ( host && !gadget )
-        gadget = get_gadget(flow, host);
+    if ( host )
+        set_service(flow, host);
+
+    if ( !gadget )
+        gadget = get_gadget(flow);
 
     if ( gadget )
         flow->set_gadget(gadget);