]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2576 in SNORT/snort3 from ~KAMURTHI/snort3:ha_unit_null_ptr to...
authorShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Fri, 30 Oct 2020 19:11:29 +0000 (19:11 +0000)
committerShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Fri, 30 Oct 2020 19:11:29 +0000 (19:11 +0000)
Squashed commit of the following:

commit 5d9446101726b7d3fe40b17d5fa0318fc0e160e9
Author: Kanimozhi Murthi <kamurthi@cisco.com>
Date:   Sun Oct 25 23:45:44 2020 -0400

    appid: unit test to verify HA data for flow unmonitored by appid.

src/network_inspectors/appid/test/appid_api_test.cc

index 86be99e10dfb137a8be723c33ed0d4a275855f96..bd28c870c66cf1bfd68cdebc558d0e99b4ff5766 100644 (file)
@@ -304,6 +304,16 @@ TEST(appid_api, produce_ha_state)
     CHECK_TRUE(session->client_disco_state == APPID_DISCO_STATE_FINISHED);
     delete &session->get_api();
     delete session;
+
+    flow->set_flow_data(nullptr);
+    uint32_t val1 = appid_api.produce_ha_state(*flow, (uint8_t*)&appHA);
+    CHECK_TRUE(val1 == sizeof(appHA));
+    CHECK_TRUE(appHA.flags == 0);
+
+    val = appid_api.consume_ha_state(*flow, (uint8_t*)&appHA, 0, IpProtocol::TCP, &ip, 1066);
+    CHECK_TRUE(val == sizeof(appHA));
+    session = (AppIdSession*)flow->get_flow_data(AppIdSession::inspector_id);
+    CHECK(session == nullptr);
 }
 
 TEST(appid_api, ssl_app_group_id_lookup)