From: Russ Combs Date: Wed, 25 Mar 2015 21:25:29 +0000 (-0400) Subject: apply service from hosts when inspector already bound to flow X-Git-Tag: 3.0.0-233~1014 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=426aedd53b5c0d50db49d92d42ef1db9d2e22c19;p=thirdparty%2Fsnort3.git apply service from hosts when inspector already bound to flow --- diff --git a/ChangeLog b/ChangeLog index 378512cc5..0a7e42d9d 100644 --- 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 diff --git a/src/detection/pcrm.cc b/src/detection/pcrm.cc index 32ed0a540..a45e6b2b4 100644 --- a/src/detection/pcrm.cc +++ b/src/detection/pcrm.cc @@ -1178,7 +1178,7 @@ int prmFindRuleGroup( int prmFindGenericRuleGroup(PORT_RULE_MAP* p, PORT_GROUP** gen) { - if (gen == NULL) + if ( !p or !gen ) { return 0; } diff --git a/src/network_inspectors/binder/binder.cc b/src/network_inspectors/binder/binder.cc index fbaa7412b..52611a5ab 100644 --- a/src/network_inspectors/binder/binder.cc +++ b/src/network_inspectors/binder/binder.cc @@ -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);