Beispiel #1
0
int Norm_SetConfig (NormalizerContext* nc)
{
    if ( !DAQ_CanReplace() )
    {
        LogMessage("WARNING: normalizations disabled because DAQ"
            " can't replace packets.\n");
        nc->normalizer_flags = 0x0;
        return -1;
    }
    if ( !nc->normalizer_flags )
    {
        return 0;
    }
    if ( Norm_IsEnabled(nc, NORM_IP4) )
    {
        nc->normalizers[PROTO_IP4] = Norm_IP4;
    }
    if ( Norm_IsEnabled(nc, NORM_IP4_TRIM) )
    {
        if ( !DAQ_CanInject() )
        {
            LogMessage("WARNING: normalize_ip4: trim disabled since DAQ "
                "can't inject packets.\n");
            Norm_Disable(nc, NORM_IP4_TRIM);
        }
    }
    if ( Norm_IsEnabled(nc, NORM_ICMP4) )
    {
        nc->normalizers[PROTO_ICMP4] = Norm_ICMP4;
    }
    if ( Norm_IsEnabled(nc, NORM_IP6) )
    {
        nc->normalizers[PROTO_IP6] = Norm_IP6;
        nc->normalizers[PROTO_IP6_HOP_OPTS] = Norm_IP6_Opts;
        nc->normalizers[PROTO_IP6_DST_OPTS] = Norm_IP6_Opts;
    }
    if ( Norm_IsEnabled(nc, NORM_ICMP6) )
    {
        nc->normalizers[PROTO_ICMP6] = Norm_ICMP6;
    }
    if ( Norm_IsEnabled(nc, NORM_TCP) )
    {
        nc->normalizers[PROTO_TCP] = Norm_TCP;
    }
    return 0;
}
Beispiel #2
0
int Active_Init (SnortConfig* sc)
{
    s_attempts = sc->respond_attempts;
    if ( s_attempts > MAX_ATTEMPTS ) s_attempts = MAX_ATTEMPTS;
    if ( s_enabled && !s_attempts ) s_attempts = 1;

    if ( s_enabled && (!DAQ_CanInject() || sc->respond_device) )
    {

        if ( ScReadMode() || Active_Open(sc->respond_device) )
        {
            LogMessage("WARNING: active responses disabled since DAQ "
                "can't inject packets.\n");
#ifndef REG_TEST
            s_attempts = s_enabled = 0;
#endif
        }

        if (NULL != sc->eth_dst)
            Encode_SetDstMAC(sc->eth_dst);
    }
    return 0;
}