]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2221 in SNORT/snort3 from ~SUNIMUKH/snort3:CSCvu03459_ha_md_strm...
authorLokesh Bevinamarad (lbevinam) <lbevinam@cisco.com>
Thu, 4 Jun 2020 09:56:18 +0000 (09:56 +0000)
committerLokesh Bevinamarad (lbevinam) <lbevinam@cisco.com>
Thu, 4 Jun 2020 09:56:18 +0000 (09:56 +0000)
Squashed commit of the following:

commit 2c4191695061c9deb932ccb21f1aae3c961f82bb
Author: Sunirmal Mukherjee <sunimukh@cisco.com>
Date:   Wed May 20 03:26:22 2020 -0400

    stream_ha: fixed  ip family in the flow->key during StreamHAClient::consume

src/stream/base/stream_ha.cc

index 32edbed7c7a7f8e4cbf361383f52d32b1f7e8489..987ffd5855b1c594d2f465179228e10e6eac79a4 100644 (file)
@@ -107,18 +107,17 @@ bool StreamHAClient::consume(Flow*& flow, const FlowKey* key, HAMessage& msg, ui
         DataBus::publish(STREAM_HA_NEW_FLOW_EVENT, event, flow);
 
         flow->ha_state->clear(FlowHAState::NEW);
-        int family = (hac->flags & SessionHAContent::FLAG_IP6) ? AF_INET6 : AF_INET;
         if ( hac->flags & SessionHAContent::FLAG_LOW )
         {
-            flow->server_ip.set(flow->key->ip_l, family);
-            flow->client_ip.set(flow->key->ip_h, family);
+            flow->server_ip.set(flow->key->ip_l);
+            flow->client_ip.set(flow->key->ip_h);
             flow->server_port = flow->key->port_l;
             flow->client_port = flow->key->port_h;
         }
         else
         {
-            flow->client_ip.set(flow->key->ip_l, family);
-            flow->server_ip.set(flow->key->ip_h, family);
+            flow->client_ip.set(flow->key->ip_l);
+            flow->server_ip.set(flow->key->ip_h);
             flow->client_port = flow->key->port_l;
             flow->server_port = flow->key->port_h;
         }
@@ -152,7 +151,9 @@ bool StreamHAClient::produce(Flow& flow, HAMessage& msg)
     hac->flags = 0;
     if (!is_client_lower(flow))
         hac->flags |= SessionHAContent::FLAG_LOW;
-    hac->flags |= SessionHAContent::FLAG_IP6;
+
+    if (flow.client_ip.get_family() == AF_INET6)
+        hac->flags |= SessionHAContent::FLAG_IP6;
 
     msg.advance_cursor(sizeof(SessionHAContent));