]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2783 in SNORT/snort3 from ~ARMANDAV/snort3:passive to master
authorMasud Hasan (mashasan) <mashasan@cisco.com>
Fri, 12 Mar 2021 15:14:19 +0000 (15:14 +0000)
committerMasud Hasan (mashasan) <mashasan@cisco.com>
Fri, 12 Mar 2021 15:14:19 +0000 (15:14 +0000)
Squashed commit of the following:

commit 003c442bf581f1d77a2d17263b57728b132830f2
Author: Arun Mandava <armandav@cisco.com>
Date:   Tue Mar 9 09:31:41 2021 -0500

    rna: Make discovery filter to use client and server interfaces if they are not DAQ_PKTHDR_UNKNOWN

src/helpers/discovery_filter.cc

index d44dd7b1016095de891ac6e2789d450b4d82984e..58489dd9bea1e2bfa13c1412871c5f483f071a23 100644 (file)
@@ -250,23 +250,22 @@ bool DiscoveryFilter::is_monitored(const Packet* p, FilterType type, const SfIp*
     if ( intf_ip_list[type].empty() )
         return false; // the configuration did not have this type of rule
 
-    int32_t intf;
+    int32_t intf = p->pkth->ingress_index;
     const SfIp* host_ip;
     if ( flowdir == FlowCheckDirection::DF_SERVER )
     {
-        intf = (int32_t)p->flow->server_intf;
+        if ( p->flow->server_intf != DAQ_PKTHDR_UNKNOWN )
+            intf = p->flow->server_intf;
         host_ip = &p->flow->server_ip;
     }
     else if ( flowdir == FlowCheckDirection::DF_CLIENT )
     {
-        intf = (int32_t)p->flow->client_intf;
+        if ( p->flow->client_intf != DAQ_PKTHDR_UNKNOWN )
+            intf = p->flow->client_intf;
         host_ip = &p->flow->client_ip;
     }
     else
-    {
-        intf = (int32_t)p->pkth->ingress_index;
         host_ip = p->ptrs.ip_api.get_src();
-    }
 
     if ( intf == DAQ_PKTHDR_UNKNOWN or intf < 0 )
         intf = DF_ANY_INTF;