@ -2460,16 +2460,16 @@ static void SigSetupPrefilter(DetectEngineCtx *de_ctx, Signature *s)
*/
*/
static bool DetectRuleValidateTable ( const Signature * s )
static bool DetectRuleValidateTable ( const Signature * s )
{
{
if ( s - > firewall _table = = 0 )
if ( s - > detect _table = = 0 )
return true ;
return true ;
const uint8_t table_as_flag = BIT_U8 ( s - > firewall _table) ;
const uint8_t table_as_flag = BIT_U8 ( s - > detect _table) ;
for ( SigMatch * sm = s - > init_data - > smlists [ DETECT_SM_LIST_MATCH ] ; sm ! = NULL ; sm = sm - > next ) {
for ( SigMatch * sm = s - > init_data - > smlists [ DETECT_SM_LIST_MATCH ] ; sm ! = NULL ; sm = sm - > next ) {
const uint8_t kw_tables_supported = sigmatch_table [ sm - > type ] . tables ;
const uint8_t kw_tables_supported = sigmatch_table [ sm - > type ] . tables ;
if ( kw_tables_supported ! = 0 & & ( kw_tables_supported & table_as_flag ) = = 0 ) {
if ( kw_tables_supported ! = 0 & & ( kw_tables_supported & table_as_flag ) = = 0 ) {
SCLogError ( " rule %u uses hook \" %s \" , but keyword \" %s \" doesn't support this hook " ,
SCLogError ( " rule %u uses hook \" %s \" , but keyword \" %s \" doesn't support this hook " ,
s - > id , DetectTableToString ( s - > firewall _table) , sigmatch_table [ sm - > type ] . name ) ;
s - > id , DetectTableToString ( s - > detect _table) , sigmatch_table [ sm - > type ] . name ) ;
return false ;
return false ;
}
}
}
}
@ -2487,33 +2487,34 @@ static bool DetectFirewallRuleValidate(const DetectEngineCtx *de_ctx, const Sign
return true ;
return true ;
}
}
static void Detect Firewall RuleSetTable( Signature * s )
static void Detect RuleSetTable( Signature * s )
{
{
enum Firewall Table table ;
enum Detect Table table ;
if ( s - > flags & SIG_FLAG_FIREWALL ) {
if ( s - > flags & SIG_FLAG_FIREWALL ) {
if ( s - > type = = SIG_TYPE_PKT ) {
if ( s - > type = = SIG_TYPE_PKT ) {
if ( s - > init_data - > hook . type = = SIGNATURE_HOOK_TYPE_PKT & &
if ( s - > init_data - > hook . type = = SIGNATURE_HOOK_TYPE_PKT & &
s - > init_data - > hook . t . pkt . ph = = SIGNATURE_HOOK_PKT_PRE_STREAM )
s - > init_data - > hook . t . pkt . ph = = SIGNATURE_HOOK_PKT_PRE_STREAM )
table = FIREWALL _TABLE_PACKET_PRE_STREAM;
table = DETECT _TABLE_PACKET_PRE_STREAM;
else if ( s - > init_data - > hook . type = = SIGNATURE_HOOK_TYPE_PKT & &
else if ( s - > init_data - > hook . type = = SIGNATURE_HOOK_TYPE_PKT & &
s - > init_data - > hook . t . pkt . ph = = SIGNATURE_HOOK_PKT_PRE_FLOW )
s - > init_data - > hook . t . pkt . ph = = SIGNATURE_HOOK_PKT_PRE_FLOW )
table = FIREWALL _TABLE_PACKET_PRE_FLOW;
table = DETECT _TABLE_PACKET_PRE_FLOW;
else
else
table = FIREWALL _TABLE_PACKET_FILTER;
table = DETECT _TABLE_PACKET_FILTER;
} else if ( s - > type = = SIG_TYPE_APP_TX ) {
} else if ( s - > type = = SIG_TYPE_APP_TX ) {
table = FIREWALL _TABLE_APP_FILTER;
table = DETECT _TABLE_APP_FILTER;
} else {
} else {
BUG_ON ( 1 ) ;
BUG_ON ( 1 ) ;
}
}
} else {
} else {
// TODO pre_flow/pre_stream
if ( s - > type ! = SIG_TYPE_APP_TX ) {
if ( s - > type ! = SIG_TYPE_APP_TX ) {
table = FIREWALL _TABLE_PACKET_TD;
table = DETECT _TABLE_PACKET_TD;
} else {
} else {
table = FIREWALL _TABLE_APP_TD;
table = DETECT _TABLE_APP_TD;
}
}
}
}
s - > firewall _table = ( uint8_t ) table ;
s - > detect _table = ( uint8_t ) table ;
}
}
static int SigValidateFirewall ( const DetectEngineCtx * de_ctx , const Signature * s )
static int SigValidateFirewall ( const DetectEngineCtx * de_ctx , const Signature * s )
@ -2829,9 +2830,7 @@ static int SigValidateConsolidate(
SigConsolidateTcpBuffer ( s ) ;
SigConsolidateTcpBuffer ( s ) ;
SignatureSetType ( de_ctx , s ) ;
SignatureSetType ( de_ctx , s ) ;
if ( de_ctx - > flags & DE_HAS_FIREWALL ) {
DetectRuleSetTable ( s ) ;
DetectFirewallRuleSetTable ( s ) ;
}
int r = SigValidateFileHandling ( s ) ;
int r = SigValidateFileHandling ( s ) ;
if ( r = = 0 ) {
if ( r = = 0 ) {