"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/flow/test/ha_test.cc" between
snort3-3.1.28.0.tar.gz and snort3-3.1.29.0.tar.gz

About: Snort 3 is a network intrusion prevention and detection system (IDS/IPS) combining the benefits of signature, protocol and anomaly-based inspection.

ha_test.cc  (snort3-3.1.28.0):ha_test.cc  (snort3-3.1.29.0)
skipping to change at line 40 skipping to change at line 40
using namespace snort; using namespace snort;
#define MSG_SIZE 100 #define MSG_SIZE 100
#define TEST_KEY 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,2 4,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47 #define TEST_KEY 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,2 4,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
class StreamHAClient; class StreamHAClient;
static const FlowKey s_test_key = static const FlowKey s_test_key =
{ {
{ 1, 2, 3, 4 }, /* .ip_l = */ { 1, 2, 3, 4 },
{ 5, 6, 7, 8 }, /* .ip_h = */ { 5, 6, 7, 8 },
9, /* .mplsLabel = */ 9,
10, /* .addressSpaceId = */ 0,
11, /* .port_l = */ 10,
0, /* .port_h = */ 11,
0, /* .group_l = */ 0,
0, /* .group_h = */ 0,
12, /* .vlan_tag = */ 12,
14, /* .padding = */ 0,
PktType::TCP, /* .ip_protocol = */ 14,
14, /* .pkt_type = */ PktType::TCP,
0, /* .version = */ 14,
0 /* .flags.group_used = */ 0,
/* .flags.padding_bits = */ 0,
}; };
static struct __attribute__((__packed__)) TestDeleteMessage { static struct __attribute__((__packed__)) TestDeleteMessage {
HAMessageHeader mhdr; HAMessageHeader mhdr;
FlowKey key; FlowKey key;
} s_delete_message = } s_delete_message =
{ {
{ {
HA_DELETE_EVENT, HA_DELETE_EVENT,
HA_MESSAGE_VERSION, HA_MESSAGE_VERSION,
0x39, 61,
KEY_TYPE_IP6 KEY_TYPE_IP6
}, },
s_test_key s_test_key
}; };
static struct __attribute__((__packed__)) TestUpdateMessage { static struct __attribute__((__packed__)) TestUpdateMessage {
HAMessageHeader mhdr; HAMessageHeader mhdr;
FlowKey key; FlowKey key;
HAClientHeader schdr; HAClientHeader schdr;
// cppcheck-suppress unusedStructMember
uint8_t scmsg[10]; uint8_t scmsg[10];
} s_update_stream_message = } s_update_stream_message =
{ {
{ {
HA_UPDATE_EVENT, HA_UPDATE_EVENT,
HA_MESSAGE_VERSION, HA_MESSAGE_VERSION,
0x45, 73,
KEY_TYPE_IP6 KEY_TYPE_IP6
}, },
s_test_key, s_test_key,
{ {
0, 0,
10 10
}, },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}; };
skipping to change at line 529 skipping to change at line 531
consume_ha_update_message(msg, key, &s_pkt); consume_ha_update_message(msg, key, &s_pkt);
CHECK(ha_stats.update_msgs_consumed == 0); CHECK(ha_stats.update_msgs_consumed == 0);
CHECK(ha_stats.unknown_client_idx == 1); CHECK(ha_stats.unknown_client_idx == 1);
} }
TEST(high_availability_test, consume_error_truncated_client_msg) TEST(high_availability_test, consume_error_truncated_client_msg)
{ {
struct __attribute__((__packed__)) struct __attribute__((__packed__))
{ {
HAClientHeader chdr = { 0, 0x42 }; HAClientHeader chdr = { 0, 0x42 };
// cppcheck-suppress unusedStructMember
uint8_t cmsg[0x42 / 2] = { }; uint8_t cmsg[0x42 / 2] = { };
} input; } input;
HAMessage msg((uint8_t*) &input, sizeof(input)); HAMessage msg((uint8_t*) &input, sizeof(input));
FlowKey key; FlowKey key;
consume_ha_update_message(msg, key, &s_pkt); consume_ha_update_message(msg, key, &s_pkt);
CHECK(ha_stats.update_msgs_consumed == 0); CHECK(ha_stats.update_msgs_consumed == 0);
CHECK(ha_stats.truncated_msgs == 1); CHECK(ha_stats.truncated_msgs == 1);
} }
TEST(high_availability_test, consume_error_client_consume) TEST(high_availability_test, consume_error_client_consume)
{ {
struct __attribute__((__packed__)) struct __attribute__((__packed__))
{ {
HAClientHeader chdr = { 0, 10 }; HAClientHeader chdr = { 0, 10 };
// cppcheck-suppress unusedStructMember
uint8_t cmsg[0x42 / 2] = { }; uint8_t cmsg[0x42 / 2] = { };
} input; } input;
HAMessage msg((uint8_t*) &input, sizeof(input)); HAMessage msg((uint8_t*) &input, sizeof(input));
FlowKey key; FlowKey key;
consume_ha_update_message(msg, key, &s_pkt); consume_ha_update_message(msg, key, &s_pkt);
CHECK(ha_stats.update_msgs_consumed == 0); CHECK(ha_stats.update_msgs_consumed == 0);
CHECK(ha_stats.client_consume_errors == 1); CHECK(ha_stats.client_consume_errors == 1);
} }
 End of changes. 6 change blocks. 
16 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)