@ -624,18 +624,22 @@ void DecodeIPV4OptionsPrint(Packet *p) {
/** \test IPV4 with no options. */
int DecodeIPV4OptionsNONETest01 ( void ) {
uint8_t raw_opts [ ] = { } ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
uint8_t * data = ( uint8_t * ) & p ;
uint8_t * data = ( uint8_t * ) p ;
uint16_t i ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
if ( rc ! = 0 ) {
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -643,11 +647,13 @@ int DecodeIPV4OptionsNONETest01(void) {
if ( * data ) {
/* Should not have modified packet data */
//printf("Data modified at offset %" PRIu16 "\n", i);
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
}
SCFree ( p ) ;
return 1 ;
}
@ -656,18 +662,22 @@ int DecodeIPV4OptionsEOLTest01(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_EOL , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
uint8_t * data = ( uint8_t * ) & p ;
uint8_t * data = ( uint8_t * ) p ;
uint16_t i ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
if ( rc ! = 0 ) {
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -675,11 +685,13 @@ int DecodeIPV4OptionsEOLTest01(void) {
if ( * data ) {
/* Should not have modified packet data */
//printf("Data modified at offset %" PRIu16 "\n", i);
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
}
SCFree ( p ) ;
return 1 ;
}
@ -688,18 +700,22 @@ int DecodeIPV4OptionsNOPTest01(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_NOP , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
uint8_t * data = ( uint8_t * ) & p ;
uint8_t * data = ( uint8_t * ) p ;
uint16_t i ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
if ( rc ! = 0 ) {
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -707,11 +723,13 @@ int DecodeIPV4OptionsNOPTest01(void) {
if ( * data ) {
/* Should not have modified packet data */
//printf("Data modified at offset %" PRIu16 "\n", i);
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
}
SCFree ( p ) ;
return 1 ;
}
@ -724,25 +742,30 @@ int DecodeIPV4OptionsRRTest01(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_RR )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p . ip4vars . o_rr = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_RR )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p - > ip4vars . o_rr = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -755,20 +778,25 @@ int DecodeIPV4OptionsRRTest02(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -781,20 +809,25 @@ int DecodeIPV4OptionsRRTest03(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -807,20 +840,25 @@ int DecodeIPV4OptionsRRTest04(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -829,25 +867,30 @@ int DecodeIPV4OptionsQSTest01(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_QS , 0x08 , 0x0d , 0x00 , 0xbe , 0xef , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",qs=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_qs, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_QS )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x08 )
& & ( p . ip4vars . o_qs = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_QS )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x08 )
& & ( p - > ip4vars . o_qs = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -856,20 +899,25 @@ int DecodeIPV4OptionsQSTest02(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_QS , 0x07 , 0x0d , 0x00 , 0xbe , 0xef , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",qs=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_qs, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -882,25 +930,30 @@ int DecodeIPV4OptionsTSTest01(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_TS )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x24 )
& & ( p . ip4vars . o_ts = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_TS )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x24 )
& & ( p - > ip4vars . o_ts = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -913,20 +966,25 @@ int DecodeIPV4OptionsTSTest02(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -939,20 +997,25 @@ int DecodeIPV4OptionsTSTest03(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -965,20 +1028,25 @@ int DecodeIPV4OptionsTSTest04(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -988,25 +1056,30 @@ int DecodeIPV4OptionsSECTest01(void) {
IPV4_OPT_SEC , 0x0b , 0xf1 , 0x35 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sec=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sec, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SEC )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x0b )
& & ( p . ip4vars . o_sec = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SEC )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x0b )
& & ( p - > ip4vars . o_sec = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1016,20 +1089,25 @@ int DecodeIPV4OptionsSECTest02(void) {
IPV4_OPT_SEC , 0x0a , 0xf1 , 0x35 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sec=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sec, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1042,25 +1120,30 @@ int DecodeIPV4OptionsLSRRTest01(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_LSRR )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p . ip4vars . o_lsrr = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_LSRR )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p - > ip4vars . o_lsrr = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1073,20 +1156,25 @@ int DecodeIPV4OptionsLSRRTest02(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1099,20 +1187,25 @@ int DecodeIPV4OptionsLSRRTest03(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1125,20 +1218,25 @@ int DecodeIPV4OptionsLSRRTest04(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1149,25 +1247,30 @@ int DecodeIPV4OptionsCIPSOTest01(void) {
0x00 , 0x03 , 0x00 , 0xef , 0x00 , 0xef , 0x00 , 0x06 ,
0x00 , 0x04 , 0x00 , 0x02 , 0x00 , 0x02 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_cipso, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_CIPSO )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x18 )
& & ( p . ip4vars . o_cipso = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_CIPSO )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x18 )
& & ( p - > ip4vars . o_cipso = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1176,25 +1279,30 @@ int DecodeIPV4OptionsSIDTest01(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_SID , 0x04 , 0xbe , 0xef , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sid=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sid, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SID )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x04 )
& & ( p . ip4vars . o_sid = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SID )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x04 )
& & ( p - > ip4vars . o_sid = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1203,20 +1311,25 @@ int DecodeIPV4OptionsSIDTest02(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_SID , 0x05 , 0xbe , 0xef , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sid=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sid, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1229,25 +1342,30 @@ int DecodeIPV4OptionsSSRRTest01(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SSRR )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p . ip4vars . o_ssrr = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_SSRR )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x27 )
& & ( p - > ip4vars . o_ssrr = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1260,20 +1378,25 @@ int DecodeIPV4OptionsSSRRTest02(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1286,20 +1409,25 @@ int DecodeIPV4OptionsSSRRTest03(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1312,20 +1440,25 @@ int DecodeIPV4OptionsSSRRTest04(void) {
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1334,25 +1467,30 @@ int DecodeIPV4OptionsRTRALTTest01(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_RTRALT , 0x04 , 0xbe , 0xef , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rtralt=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rtralt, (uintmax_t)&p.IPV4_OPTS[0]);
if ( ( rc = = 0 )
& & ( p . IPV4_OPTS_CNT = = 1 )
& & ( p . IPV4_OPTS [ 0 ] . type = = IPV4_OPT_RTRALT )
& & ( p . IPV4_OPTS [ 0 ] . len = = 0x04 )
& & ( p . ip4vars . o_rtralt = = & p . IPV4_OPTS [ 0 ] ) )
& & ( p - > IPV4_OPTS_CNT = = 1 )
& & ( p - > IPV4_OPTS [ 0 ] . type = = IPV4_OPT_RTRALT )
& & ( p - > IPV4_OPTS [ 0 ] . len = = 0x04 )
& & ( p - > ip4vars . o_rtralt = = & p - > IPV4_OPTS [ 0 ] ) )
{
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}
@ -1361,20 +1499,25 @@ int DecodeIPV4OptionsRTRALTTest02(void) {
uint8_t raw_opts [ ] = {
IPV4_OPT_RTRALT , 0x05 , 0xbe , 0xef , 0x00 , 0x00 , 0x00 , 0x00
} ;
Packet p ;
Packet * p = SCMalloc ( SIZE_OF_PACKET ) ;
if ( p = = NULL )
return 0 ;
ThreadVars tv ;
int rc ;
memset ( & tv , 0 , sizeof ( ThreadVars ) ) ;
memset ( & p , 0 , SIZE_OF_PACKET ) ;
memset ( p , 0 , SIZE_OF_PACKET ) ;
p - > pkt = ( uint8_t * ) ( p + 1 ) ;
rc = DecodeIPV4Options ( & tv , & p , raw_opts , sizeof ( raw_opts ) ) ;
rc = DecodeIPV4Options ( & tv , p , raw_opts , sizeof ( raw_opts ) ) ;
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rtralt=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rtralt, (uintmax_t)&p.IPV4_OPTS[0]);
if ( rc ! = 0 ) {
SCFree ( p ) ;
return 1 ;
}
DecodeIPV4OptionsPrint ( & p ) ;
DecodeIPV4OptionsPrint ( p ) ;
SCFree ( p ) ;
return 0 ;
}