"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/snort.c" between
snort-2.9.16.1.tar.gz and snort-2.9.17.tar.gz

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

snort.c  (snort-2.9.16.1):snort.c  (snort-2.9.17)
skipping to change at line 142 skipping to change at line 142
#include "sfutil/strvec.h" #include "sfutil/strvec.h"
#include "detection_util.h" #include "detection_util.h"
#include "sfcontrol_funcs.h" #include "sfcontrol_funcs.h"
#include "idle_processing_funcs.h" #include "idle_processing_funcs.h"
#include "file_service.h" #include "file_service.h"
#include "pkt_tracer.h" #include "pkt_tracer.h"
#include "session_expect.h" #include "session_expect.h"
#include "reload.h" #include "reload.h"
#include "reg_test.h" #include "reg_test.h"
#include "memory_stats.h" #include "memory_stats.h"
#include "pthread.h"
#ifdef SIDE_CHANNEL #ifdef SIDE_CHANNEL
# include "sidechannel.h" # include "sidechannel.h"
#endif #endif
#include "dynamic-plugins/sf_dynamic_engine.h" #include "dynamic-plugins/sf_dynamic_engine.h"
#include "dynamic-plugins/sf_dynamic_detection.h" #include "dynamic-plugins/sf_dynamic_detection.h"
#define PROFILE_PREPROCS_NOREDEF #define PROFILE_PREPROCS_NOREDEF
#include "dynamic-plugins/sf_dynamic_preprocessor.h" #include "dynamic-plugins/sf_dynamic_preprocessor.h"
#include "dynamic-plugins/sp_preprocopt.h" #include "dynamic-plugins/sp_preprocopt.h"
#ifdef SIDE_CHANNEL #ifdef SIDE_CHANNEL
skipping to change at line 3387 skipping to change at line 3388
pthread_mutex_unlock(&snort_process_lock); pthread_mutex_unlock(&snort_process_lock);
} }
#endif #endif
if ( !exit_logged && error ) if ( !exit_logged && error )
{ {
if ( error == DAQ_READFILE_EOF ) if ( error == DAQ_READFILE_EOF )
error = 0; error = 0;
else if ( error > 0 ) else if ( error > 0 )
{ {
SnortShutdownThreads(error);
DAQ_Abort(); DAQ_Abort();
exit(1); exit(1);
} }
CleanExit(error); CleanExit(error);
} }
done_processing = 1; done_processing = 1;
} }
/* Resets Snort to a post-configuration state */ /* Resets Snort to a post-configuration state */
static void SnortReset(void) static void SnortReset(void)
skipping to change at line 3511 skipping to change at line 3513
if (exit_signal != 0) if (exit_signal != 0)
return; return;
/* If snort received signal to exit before its initialization, /* If snort received signal to exit before its initialization,
* we can just close DAQ interfaces and exit quickly, otherwise * we can just close DAQ interfaces and exit quickly, otherwise
* lets follow normal path. Snort will not print stats when * lets follow normal path. Snort will not print stats when
* it is asked to exit during initialization. * it is asked to exit during initialization.
*/ */
if (snort_initializing) if (snort_initializing)
{ {
LogMessage("received signal %d during initialization..exiting\n",signal) ;
DAQ_Abort(); DAQ_Abort();
exit(0); exit(0);
} }
exit_signal = signal; exit_signal = signal;
} }
static void SigDumpStatsHandler(int signal) static void SigDumpStatsHandler(int signal)
{ {
dump_stats_signal = true; dump_stats_signal = true;
skipping to change at line 3639 skipping to change at line 3640
{ {
LogMessage("Snort exiting\n"); LogMessage("Snort exiting\n");
} }
#ifndef WIN32 #ifndef WIN32
closelog(); closelog();
#endif #endif
if ( !done_processing ) if ( !done_processing )
exit(exit_val); exit(exit_val);
} }
void SnortShutdownThreads(int exit_val)
{
LogMessage("Snort is shutting down other threads, exit_val %d", exit_val);
if (!InMainThread())
{
LogMessage("Snort shutdown thread is not called at main thread, so exiti
ng..!");
return;
}
if (already_exiting != 0)
{
LogMessage("Exiting shutdown Threads, exit processing by another thread"
);
return;
}
if (pthread_mutex_trylock(&cleanup_mutex) != 0)
{
LogMessage("Exiting shutdown Threads, as someother thread is cleaning!")
;
return;
}
already_exiting = 1;
snort_exiting = 1;
snort_initializing = false;
#if defined(INLINE_FAILOPEN) && !defined(WIN32)
if (inline_failopen_thread_running)
{
pthread_kill(inline_failopen_thread_id, SIGKILL);
}
#endif
if (DAQ_WasStarted())
{
#ifdef EXIT_CHECK
if (snort_conf->exit_check)
ExitCheckEnd();
#endif
}
ControlSocketCleanUp();
#ifdef SIDE_CHANNEL
if (ScSideChannelEnabled())
{
SideChannelStopTXThread();
SideChannelCleanUp();
}
#endif
#if defined(SNORT_RELOAD) && !defined(WIN32)
if (snort_reload_thread_created)
{
pthread_join(snort_reload_thread_id, NULL);
}
#endif
#if defined(TARGET_BASED) && !defined(WIN32)
if (attribute_reload_thread_running)
{
attribute_reload_thread_stop = 1;
pthread_kill(attribute_reload_thread_id, SIGVTALRM);
while (attribute_reload_thread_running)
nanosleep(&thread_sleep, NULL);
pthread_join(attribute_reload_thread_id, NULL);
}
#endif
PrintStatistics();
pthread_mutex_unlock(&cleanup_mutex);
LogMessage("Shutting down the threads -- Done");
}
static void SnortCleanup(int exit_val) static void SnortCleanup(int exit_val)
{ {
PreprocSignalFuncNode *idxPreproc = NULL; PreprocSignalFuncNode *idxPreproc = NULL;
PluginSignalFuncNode *idxPlugin = NULL; PluginSignalFuncNode *idxPlugin = NULL;
/* This function can be called more than once. For example, /* This function can be called more than once. For example,
* once from the SIGINT signal handler, and once recursively * once from the SIGINT signal handler, and once recursively
* as a result of calling pcap_close() below. We only need * as a result of calling pcap_close() below. We only need
* to perform the cleanup once. * to perform the cleanup once.
*/ */
skipping to change at line 3792 skipping to change at line 3865
#ifdef ACTIVE_RESPONSE #ifdef ACTIVE_RESPONSE
Active_Term(); Active_Term();
Encode_Term(); Encode_Term();
#endif #endif
CleanupProtoNames(); CleanupProtoNames();
#ifdef TARGET_BASED #ifdef TARGET_BASED
SFAT_Cleanup(); SFAT_Cleanup();
if (!reloadInProgress) FreeProtoocolReferenceTable();
{
FreeProtoocolReferenceTable();
}
#endif #endif
PQ_CleanUp(); PQ_CleanUp();
ClosePidFile(); ClosePidFile();
/* remove pid file */ /* remove pid file */
if (SnortStrnlen(snort_conf->pid_filename, sizeof(snort_conf->pid_filename)) > 0) if (SnortStrnlen(snort_conf->pid_filename, sizeof(snort_conf->pid_filename)) > 0)
{ {
int ret; int ret;
skipping to change at line 4210 skipping to change at line 4280
#ifdef TARGET_BASED #ifdef TARGET_BASED
/* Default max size of the attribute table */ /* Default max size of the attribute table */
sc->max_attribute_hosts = DEFAULT_MAX_ATTRIBUTE_HOSTS; sc->max_attribute_hosts = DEFAULT_MAX_ATTRIBUTE_HOSTS;
sc->max_attribute_services_per_host = DEFAULT_MAX_ATTRIBUTE_SERVICES_PER_HOS T; sc->max_attribute_services_per_host = DEFAULT_MAX_ATTRIBUTE_SERVICES_PER_HOS T;
/* Default max number of services per rule */ /* Default max number of services per rule */
sc->max_metadata_services = DEFAULT_MAX_METADATA_SERVICES; sc->max_metadata_services = DEFAULT_MAX_METADATA_SERVICES;
#endif #endif
#if defined(FEAT_OPEN_APPID) #if defined(FEAT_OPEN_APPID)
#ifdef TARGET_BASED
sc->max_metadata_appid = DEFAULT_MAX_METADATA_APPID; sc->max_metadata_appid = DEFAULT_MAX_METADATA_APPID;
#endif
#endif /* defined(FEAT_OPEN_APPID) */ #endif /* defined(FEAT_OPEN_APPID) */
#ifdef MPLS #ifdef MPLS
sc->mpls_stack_depth = DEFAULT_LABELCHAIN_LENGTH; sc->mpls_stack_depth = DEFAULT_LABELCHAIN_LENGTH;
#endif #endif
sc->targeted_policies = NULL; sc->targeted_policies = NULL;
sc->num_policies_allocated = 0; sc->num_policies_allocated = 0;
sc->paf_max = DEFAULT_PAF_MAX; sc->paf_max = DEFAULT_PAF_MAX;
skipping to change at line 4367 skipping to change at line 4439
if (sc->rtn_hash_table) if (sc->rtn_hash_table)
sfxhash_delete(sc->rtn_hash_table); sfxhash_delete(sc->rtn_hash_table);
for (i = 0; i < sc->num_policies_allocated; i++) for (i = 0; i < sc->num_policies_allocated; i++)
{ {
SnortPolicy *p = sc->targeted_policies[i]; SnortPolicy *p = sc->targeted_policies[i];
if (p != NULL) if (p != NULL)
free(p); free(p);
if (sc->udp_ips_port_filter_list) {
IpsPortFilter *ips_portfilter = sc->udp_ips_port_filter_list[i];
if (ips_portfilter)
free(ips_portfilter);
}
} }
if (sc->udp_ips_port_filter_list)
free (sc->udp_ips_port_filter_list);
free(sc->targeted_policies); free(sc->targeted_policies);
if ( sc->react_page ) if ( sc->react_page )
free(sc->react_page); free(sc->react_page);
if ( sc->daq_type ) if ( sc->daq_type )
free(sc->daq_type); free(sc->daq_type);
if ( sc->daq_mode ) if ( sc->daq_mode )
free(sc->daq_mode); free(sc->daq_mode);
skipping to change at line 5345 skipping to change at line 5426
SnortFatalExit(); SnortFatalExit();
} }
/* Remove disabled preprocessors if policies are disabled */ /* Remove disabled preprocessors if policies are disabled */
FilterConfigPreprocessors(snort_conf); FilterConfigPreprocessors(snort_conf);
/* Need to do this after dynamic detection stuff is initialized, too */ /* Need to do this after dynamic detection stuff is initialized, too */
FlowBitsVerify(); FlowBitsVerify();
} }
snort_conf->udp_ips_port_filter_list = ParseIpsPortList(snort_conf, IPPROTO_
UDP);
if (snort_conf->file_mask != 0) if (snort_conf->file_mask != 0)
umask(snort_conf->file_mask); umask(snort_conf->file_mask);
else else
umask(077); /* set default to be sane */ umask(077); /* set default to be sane */
// the following was moved from unpriv init; hopefully it can live here. // the following was moved from unpriv init; hopefully it can live here.
decoderActionQ = sfActionQueueInit(snort_conf->event_queue_config->max_event s*2); decoderActionQ = sfActionQueueInit(snort_conf->event_queue_config->max_event s*2);
if (mempool_init(&decoderAlertMemPool, if (mempool_init(&decoderAlertMemPool,
snort_conf->event_queue_config->max_events*2, sizeof(EventNode)) != 0) snort_conf->event_queue_config->max_events*2, sizeof(EventNode)) != 0)
{ {
 End of changes. 10 change blocks. 
5 lines changed or deleted 92 lines changed or added

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