@ -938,7 +938,7 @@ static int SigTest15 (void)
uint8_t * buf = ( uint8_t * )
uint8_t * buf = ( uint8_t * )
" CONNECT 213.92.8.7:31204 HTTP/1.1 " ;
" CONNECT 213.92.8.7:31204 HTTP/1.1 " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -946,7 +946,6 @@ static int SigTest15 (void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > payload = buf ;
p - > payload = buf ;
@ -1097,7 +1096,7 @@ static int SigTest18 (void)
uint8_t * buf = ( uint8_t * )
uint8_t * buf = ( uint8_t * )
" 220 (vsFTPd 2.0.5) \r \n " ;
" 220 (vsFTPd 2.0.5) \r \n " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -1105,7 +1104,6 @@ static int SigTest18 (void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > payload = buf ;
p - > payload = buf ;
@ -1150,7 +1148,7 @@ static int SigTest19 (void)
uint8_t * buf = ( uint8_t * )
uint8_t * buf = ( uint8_t * )
" 220 (vsFTPd 2.0.5) \r \n " ;
" 220 (vsFTPd 2.0.5) \r \n " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -1158,7 +1156,6 @@ static int SigTest19 (void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > src . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 192.168.0.1 " ) ;
p - > src . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 192.168.0.1 " ) ;
p - > dst . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 1.2.3.4 " ) ;
p - > dst . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 1.2.3.4 " ) ;
@ -1211,7 +1208,7 @@ static int SigTest20 (void)
uint8_t * buf = ( uint8_t * )
uint8_t * buf = ( uint8_t * )
" 220 (vsFTPd 2.0.5) \r \n " ;
" 220 (vsFTPd 2.0.5) \r \n " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -1219,7 +1216,6 @@ static int SigTest20 (void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > src . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 192.168.0.1 " ) ;
p - > src . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 192.168.0.1 " ) ;
p - > dst . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 1.2.3.4 " ) ;
p - > dst . addr_data32 [ 0 ] = UTHSetIPv4Address ( " 1.2.3.4 " ) ;
@ -1508,10 +1504,10 @@ static int SigTest24IPV4Keyword(void)
0x40 , 0x01 , 0xb7 , 0x52 , 0xc0 , 0xa8 , 0x01 , 0x03 ,
0x40 , 0x01 , 0xb7 , 0x52 , 0xc0 , 0xa8 , 0x01 , 0x03 ,
0xc0 , 0xa8 , 0x01 , 0x06 } ;
0xc0 , 0xa8 , 0x01 , 0x06 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -1525,8 +1521,6 @@ static int SigTest24IPV4Keyword(void)
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p2 ) ;
PACKET_RESET_CHECKSUMS ( p2 ) ;
@ -1612,10 +1606,10 @@ static int SigTest25NegativeIPV4Keyword(void)
0x40 , 0x01 , 0xb7 , 0x52 , 0xc0 , 0xa8 , 0x01 , 0x03 ,
0x40 , 0x01 , 0xb7 , 0x52 , 0xc0 , 0xa8 , 0x01 , 0x03 ,
0xc0 , 0xa8 , 0x01 , 0x06 } ;
0xc0 , 0xa8 , 0x01 , 0x06 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -1629,8 +1623,6 @@ static int SigTest25NegativeIPV4Keyword(void)
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p2 ) ;
PACKET_RESET_CHECKSUMS ( p2 ) ;
@ -1722,11 +1714,11 @@ static int SigTest26TCPV4Keyword(void)
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -1736,8 +1728,6 @@ static int SigTest26TCPV4Keyword(void)
DetectEngineThreadCtx * det_ctx = NULL ;
DetectEngineThreadCtx * det_ctx = NULL ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
@ -1821,11 +1811,11 @@ static int SigTest26TCPV4AndNegativeIPV4Keyword(void)
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -1836,8 +1826,6 @@ static int SigTest26TCPV4AndNegativeIPV4Keyword(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
@ -1947,11 +1935,11 @@ static int SigTest26TCPV4AndIPV4Keyword(void)
0x19 , 0x69 , 0x81 , 0x7e , 0xFF , 0xAA , 0x00 , 0x00 ,
0x19 , 0x69 , 0x81 , 0x7e , 0xFF , 0xAA , 0x00 , 0x00 ,
0x04 , 0x02 , 0x00 , 0x00 } ;
0x04 , 0x02 , 0x00 , 0x00 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -1962,8 +1950,6 @@ static int SigTest26TCPV4AndIPV4Keyword(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
@ -2062,11 +2048,10 @@ static int SigTest27NegativeTCPV4Keyword(void)
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x04 , 0x02 , 0x08 , 0x0a , 0x6e , 0x18 , 0x78 , 0x73 ,
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
0x01 , 0x71 , 0x74 , 0xde , 0x01 , 0x03 , 0x03 , 0x03 } ;
Packet * p1 = PacketGetFromAlloc ( ) ;
Packet * p1 = SCMalloc ( SIZE_OF_PACKET ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2076,8 +2061,6 @@ static int SigTest27NegativeTCPV4Keyword(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyData ( p1 , raw_ipv4 , sizeof ( raw_ipv4 ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
PacketCopyDataOffset ( p1 , GET_PKT_LEN ( p1 ) , valid_raw_tcp , sizeof ( valid_raw_tcp ) ) ;
@ -2189,10 +2172,10 @@ static int SigTest28TCPV6Keyword(void)
0x01 , 0x01 , 0x08 , 0x0a , 0x00 , 0x08 , 0xca , 0x5a ,
0x01 , 0x01 , 0x08 , 0x0a , 0x00 , 0x08 , 0xca , 0x5a ,
0x00 , 0x01 , 0x69 , 0x28 } ;
0x00 , 0x01 , 0x69 , 0x28 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2202,8 +2185,6 @@ static int SigTest28TCPV6Keyword(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
@ -2317,10 +2298,10 @@ static int SigTest29NegativeTCPV6Keyword(void)
0x01 , 0x01 , 0x08 , 0x0a , 0x00 , 0x08 , 0xca , 0x5a ,
0x01 , 0x01 , 0x08 , 0x0a , 0x00 , 0x08 , 0xca , 0x5a ,
0x00 , 0x01 , 0x69 , 0x28 } ;
0x00 , 0x01 , 0x69 , 0x28 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2330,8 +2311,6 @@ static int SigTest29NegativeTCPV6Keyword(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
@ -2440,9 +2419,9 @@ static int SigTest30UDPV4Keyword(void)
0x61 , 0x64 , 0x01 , 0x6c , 0x06 , 0x67 , 0x6f , 0x6f ,
0x61 , 0x64 , 0x01 , 0x6c , 0x06 , 0x67 , 0x6f , 0x6f ,
0x67 , 0x6c , 0x65 , 0xc0 , 0x27 } ;
0x67 , 0x6c , 0x65 , 0xc0 , 0x27 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
FAIL_IF_NULL ( p1 ) ;
FAIL_IF_NULL ( p1 ) ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
FAIL_IF_NULL ( p2 ) ;
FAIL_IF_NULL ( p2 ) ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -2452,8 +2431,6 @@ static int SigTest30UDPV4Keyword(void)
" \r \n \r \n yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy " ;
" \r \n \r \n yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy " ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip4h = ( IPV4Hdr * ) raw_ipv4 ;
p1 - > ip4h = ( IPV4Hdr * ) raw_ipv4 ;
@ -2544,10 +2521,10 @@ static int SigTest31NegativeUDPV4Keyword(void)
0x61 , 0x64 , 0x01 , 0x6c , 0x06 , 0x67 , 0x6f , 0x6f ,
0x61 , 0x64 , 0x01 , 0x6c , 0x06 , 0x67 , 0x6f , 0x6f ,
0x67 , 0x6c , 0x65 , 0xc0 , 0x27 } ;
0x67 , 0x6c , 0x65 , 0xc0 , 0x27 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2560,8 +2537,6 @@ static int SigTest31NegativeUDPV4Keyword(void)
" \r \n \r \n yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy " ;
" \r \n \r \n yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy " ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip4h = ( IPV4Hdr * ) raw_ipv4 ;
p1 - > ip4h = ( IPV4Hdr * ) raw_ipv4 ;
@ -2661,9 +2636,9 @@ static int SigTest32UDPV6Keyword(void)
0x00 , 0x00 , 0xf9 , 0xc8 , 0xe7 , 0x36 , 0x57 , 0xb0 ,
0x00 , 0x00 , 0xf9 , 0xc8 , 0xe7 , 0x36 , 0x57 , 0xb0 ,
0x09 , 0x01 } ;
0x09 , 0x01 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
FAIL_IF_NULL ( p1 ) ;
FAIL_IF_NULL ( p1 ) ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
FAIL_IF_NULL ( p2 ) ;
FAIL_IF_NULL ( p2 ) ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -2673,8 +2648,6 @@ static int SigTest32UDPV6Keyword(void)
" \r \n \r \n " ;
" \r \n \r \n " ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
@ -2758,10 +2731,10 @@ static int SigTest33NegativeUDPV6Keyword(void)
0x00 , 0x00 , 0xf9 , 0xc8 , 0xe7 , 0x36 , 0x57 , 0xb0 ,
0x00 , 0x00 , 0xf9 , 0xc8 , 0xe7 , 0x36 , 0x57 , 0xb0 ,
0x09 , 0x01 } ;
0x09 , 0x01 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2774,8 +2747,6 @@ static int SigTest33NegativeUDPV6Keyword(void)
" \r \n \r \n " ;
" \r \n \r \n " ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
p1 - > ip6h = ( IPV6Hdr * ) ( valid_raw_ipv6 + 14 ) ;
@ -2875,10 +2846,10 @@ static int SigTest34ICMPV4Keyword(void)
0x2c , 0x2d , 0x2e , 0x2f , 0x30 , 0x31 , 0x32 , 0x33 ,
0x2c , 0x2d , 0x2e , 0x2f , 0x30 , 0x31 , 0x32 , 0x33 ,
0x34 , 0x35 , 0x36 , 0x38 } ;
0x34 , 0x35 , 0x36 , 0x38 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -2892,8 +2863,6 @@ static int SigTest34ICMPV4Keyword(void)
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip4h = ( IPV4Hdr * ) ( valid_raw_ipv4 ) ;
p1 - > ip4h = ( IPV4Hdr * ) ( valid_raw_ipv4 ) ;
@ -2995,10 +2964,10 @@ static int SigTest35NegativeICMPV4Keyword(void)
0x2c , 0x2d , 0x2e , 0x2f , 0x30 , 0x31 , 0x32 , 0x33 ,
0x2c , 0x2d , 0x2e , 0x2f , 0x30 , 0x31 , 0x32 , 0x33 ,
0x34 , 0x35 , 0x36 , 0x38 } ;
0x34 , 0x35 , 0x36 , 0x38 } ;
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
Packet * p2 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) ) {
if ( unlikely ( p2 = = NULL ) ) {
SCFree ( p1 ) ;
SCFree ( p1 ) ;
return 0 ;
return 0 ;
@ -3012,8 +2981,6 @@ static int SigTest35NegativeICMPV4Keyword(void)
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
PACKET_RESET_CHECKSUMS ( p1 ) ;
p1 - > ip4h = ( IPV4Hdr * ) ( valid_raw_ipv4 ) ;
p1 - > ip4h = ( IPV4Hdr * ) ( valid_raw_ipv4 ) ;
@ -3090,7 +3057,7 @@ end:
static int SigTest38 ( void )
static int SigTest38 ( void )
{
{
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -3131,7 +3098,6 @@ static int SigTest38(void)
uint16_t buflen = sizeof ( buf ) ;
uint16_t buflen = sizeof ( buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
/* Copy raw data into packet */
/* Copy raw data into packet */
if ( PacketCopyData ( p1 , raw_eth , ethlen ) = = - 1 ) {
if ( PacketCopyData ( p1 , raw_eth , ethlen ) = = - 1 ) {
@ -3221,7 +3187,7 @@ end:
static int SigTest39 ( void )
static int SigTest39 ( void )
{
{
Packet * p1 = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -3262,7 +3228,6 @@ static int SigTest39(void)
uint16_t buflen = sizeof ( buf ) ;
uint16_t buflen = sizeof ( buf ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( ThreadVars ) ) ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
/* Copy raw data into packet */
/* Copy raw data into packet */
if ( PacketCopyData ( p1 , raw_eth , ethlen ) = = - 1 ) {
if ( PacketCopyData ( p1 , raw_eth , ethlen ) = = - 1 ) {
@ -3397,7 +3362,7 @@ static int SigTest36ContentAndIsdataatKeywords01 (void)
, 0x65 , 0x72 , 0x65 , 0x3c , 0x2f , 0x41 , 0x3e , 0x2e , 0x0d , 0x0a , 0x3c , 0x2f , 0x42 , 0x4f , 0x44 , 0x59
, 0x65 , 0x72 , 0x65 , 0x3c , 0x2f , 0x41 , 0x3e , 0x2e , 0x0d , 0x0a , 0x3c , 0x2f , 0x42 , 0x4f , 0x44 , 0x59
, 0x3e , 0x3c , 0x2f , 0x48 , 0x54 , 0x4d , 0x4c , 0x3e , 0x0d , 0x0a } ;
, 0x3e , 0x3c , 0x2f , 0x48 , 0x54 , 0x4d , 0x4c , 0x3e , 0x0d , 0x0a } ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
DecodeThreadVars dtv ;
DecodeThreadVars dtv ;
@ -3405,7 +3370,6 @@ static int SigTest36ContentAndIsdataatKeywords01 (void)
ThreadVars th_v ;
ThreadVars th_v ;
DetectEngineThreadCtx * det_ctx = NULL ;
DetectEngineThreadCtx * det_ctx = NULL ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
memset ( & dtv , 0 , sizeof ( DecodeThreadVars ) ) ;
memset ( & dtv , 0 , sizeof ( DecodeThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
@ -3516,7 +3480,7 @@ static int SigTest37ContentAndIsdataatKeywords02 (void)
, 0x65 , 0x72 , 0x65 , 0x3c , 0x2f , 0x41 , 0x3e , 0x2e , 0x0d , 0x0a , 0x3c , 0x2f , 0x42 , 0x4f , 0x44 , 0x59
, 0x65 , 0x72 , 0x65 , 0x3c , 0x2f , 0x41 , 0x3e , 0x2e , 0x0d , 0x0a , 0x3c , 0x2f , 0x42 , 0x4f , 0x44 , 0x59
, 0x3e , 0x3c , 0x2f , 0x48 , 0x54 , 0x4d , 0x4c , 0x3e , 0x0d , 0x0a } ;
, 0x3e , 0x3c , 0x2f , 0x48 , 0x54 , 0x4d , 0x4c , 0x3e , 0x0d , 0x0a } ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
DecodeThreadVars dtv ;
DecodeThreadVars dtv ;
@ -3524,7 +3488,6 @@ static int SigTest37ContentAndIsdataatKeywords02 (void)
ThreadVars th_v ;
ThreadVars th_v ;
DetectEngineThreadCtx * det_ctx = NULL ;
DetectEngineThreadCtx * det_ctx = NULL ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
memset ( & dtv , 0 , sizeof ( DecodeThreadVars ) ) ;
memset ( & dtv , 0 , sizeof ( DecodeThreadVars ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
@ -3607,7 +3570,7 @@ static int SigTest40NoPacketInspection01(void)
uint8_t * buf = ( uint8_t * )
uint8_t * buf = ( uint8_t * )
" 220 (vsFTPd 2.0.5) \r \n " ;
" 220 (vsFTPd 2.0.5) \r \n " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
TCPHdr tcphdr ;
TCPHdr tcphdr ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
@ -3618,7 +3581,6 @@ static int SigTest40NoPacketInspection01(void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
memset ( & pq , 0 , sizeof ( pq ) ) ;
memset ( & pq , 0 , sizeof ( pq ) ) ;
memset ( & f , 0 , sizeof ( f ) ) ;
memset ( & f , 0 , sizeof ( f ) ) ;
memset ( & tcphdr , 0 , sizeof ( tcphdr ) ) ;
memset ( & tcphdr , 0 , sizeof ( tcphdr ) ) ;
@ -3686,9 +3648,8 @@ static int SigTest40NoPayloadInspection02(void)
ThreadVars th_v ;
ThreadVars th_v ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
FAIL_IF_NULL ( p ) ;
FAIL_IF_NULL ( p ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > dst . family = AF_INET ;
@ -3729,7 +3690,7 @@ static int SigTestMemory01 (void)
" Host: two.example.org \r \n "
" Host: two.example.org \r \n "
" \r \n \r \n " ;
" \r \n \r \n " ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
uint16_t buflen = strlen ( ( char * ) buf ) ;
Packet * p = SCMalloc( SIZE_OF_PACKET ) ;
Packet * p = PacketGetFromAlloc( ) ;
if ( unlikely ( p = = NULL ) )
if ( unlikely ( p = = NULL ) )
return 0 ;
return 0 ;
ThreadVars th_v ;
ThreadVars th_v ;
@ -3737,7 +3698,6 @@ static int SigTestMemory01 (void)
int result = 0 ;
int result = 0 ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( & th_v , 0 , sizeof ( th_v ) ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > src . family = AF_INET ;
p - > src . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > dst . family = AF_INET ;
p - > payload = buf ;
p - > payload = buf ;
@ -4271,10 +4231,9 @@ static int SigTestWithin01 (void)
DetectEngineThreadCtxInit ( & th_v , ( void * ) de_ctx , ( void * ) & det_ctx ) ;
DetectEngineThreadCtxInit ( & th_v , ( void * ) de_ctx , ( void * ) & det_ctx ) ;
/* packet 1 */
/* packet 1 */
p1 = SCMalloc( SIZE_OF_PACKET ) ;
p1 = PacketGetFromAlloc( ) ;
if ( unlikely ( p1 = = NULL ) )
if ( unlikely ( p1 = = NULL ) )
return 0 ;
return 0 ;
memset ( p1 , 0 , SIZE_OF_PACKET ) ;
DecodeEthernet ( & th_v , & dtv , p1 , rawpkt1 , sizeof ( rawpkt1 ) ) ;
DecodeEthernet ( & th_v , & dtv , p1 , rawpkt1 , sizeof ( rawpkt1 ) ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p1 ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p1 ) ;
if ( ! ( PacketAlertCheck ( p1 , 556 ) ) ) {
if ( ! ( PacketAlertCheck ( p1 , 556 ) ) ) {
@ -4283,10 +4242,9 @@ static int SigTestWithin01 (void)
}
}
/* packet 2 */
/* packet 2 */
p2 = SCMalloc( SIZE_OF_PACKET ) ;
p2 = PacketGetFromAlloc( ) ;
if ( unlikely ( p2 = = NULL ) )
if ( unlikely ( p2 = = NULL ) )
return 0 ;
return 0 ;
memset ( p2 , 0 , SIZE_OF_PACKET ) ;
DecodeEthernet ( & th_v , & dtv , p2 , rawpkt2 , sizeof ( rawpkt2 ) ) ;
DecodeEthernet ( & th_v , & dtv , p2 , rawpkt2 , sizeof ( rawpkt2 ) ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p2 ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p2 ) ;
if ( ! ( PacketAlertCheck ( p2 , 556 ) ) ) {
if ( ! ( PacketAlertCheck ( p2 , 556 ) ) ) {
@ -4295,10 +4253,9 @@ static int SigTestWithin01 (void)
}
}
/* packet 3 */
/* packet 3 */
p3 = SCMalloc( SIZE_OF_PACKET ) ;
p3 = PacketGetFromAlloc( ) ;
if ( unlikely ( p3 = = NULL ) )
if ( unlikely ( p3 = = NULL ) )
return 0 ;
return 0 ;
memset ( p3 , 0 , SIZE_OF_PACKET ) ;
DecodeEthernet ( & th_v , & dtv , p3 , rawpkt3 , sizeof ( rawpkt3 ) ) ;
DecodeEthernet ( & th_v , & dtv , p3 , rawpkt3 , sizeof ( rawpkt3 ) ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p3 ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p3 ) ;
if ( ! ( PacketAlertCheck ( p3 , 556 ) ) ) {
if ( ! ( PacketAlertCheck ( p3 , 556 ) ) ) {
@ -4307,10 +4264,9 @@ static int SigTestWithin01 (void)
}
}
/* packet 4 */
/* packet 4 */
p4 = SCMalloc( SIZE_OF_PACKET ) ;
p4 = PacketGetFromAlloc( ) ;
if ( unlikely ( p4 = = NULL ) )
if ( unlikely ( p4 = = NULL ) )
return 0 ;
return 0 ;
memset ( p4 , 0 , SIZE_OF_PACKET ) ;
DecodeEthernet ( & th_v , & dtv , p4 , rawpkt4 , sizeof ( rawpkt4 ) ) ;
DecodeEthernet ( & th_v , & dtv , p4 , rawpkt4 , sizeof ( rawpkt4 ) ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p4 ) ;
SigMatchSignatures ( & th_v , de_ctx , det_ctx , p4 ) ;
if ( ! ( PacketAlertCheck ( p4 , 556 ) ) ) {
if ( ! ( PacketAlertCheck ( p4 , 556 ) ) ) {