From: Lokesh Bevinamarad (lbevinam) Date: Thu, 4 Jun 2020 09:56:18 +0000 (+0000) Subject: Merge pull request #2221 in SNORT/snort3 from ~SUNIMUKH/snort3:CSCvu03459_ha_md_strm... X-Git-Tag: 3.0.1-5~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=599e86a95e681a2b0292be27c946f820617d7b49;p=thirdparty%2Fsnort3.git Merge pull request #2221 in SNORT/snort3 from ~SUNIMUKH/snort3:CSCvu03459_ha_md_strm to master Squashed commit of the following: commit 2c4191695061c9deb932ccb21f1aae3c961f82bb Author: Sunirmal Mukherjee Date: Wed May 20 03:26:22 2020 -0400 stream_ha: fixed ip family in the flow->key during StreamHAClient::consume --- diff --git a/src/stream/base/stream_ha.cc b/src/stream/base/stream_ha.cc index 32edbed7c..987ffd585 100644 --- a/src/stream/base/stream_ha.cc +++ b/src/stream/base/stream_ha.cc @@ -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));