#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdarg.h>
#include <syslog.h>
#include <errno.h>
#include <sys/stat.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <grp.h>
#include <pwd.h>
#include <netdb.h>
#include <limits.h>
#include <fcntl.h>
#include "snort.h"
#include "mstring.h"
#include "debug.h"
#include "util.h"
#include "parser.h"
#include "inline.h"
Go to the source code of this file.
Defines | |
#define | PATH_MAX_UTIL 1024 |
Functions | |
void | GenHomenet (char *netdata) |
void | GenObfuscationMask (char *netdata) |
void | DefineIfaceVar (char *iname, u_char *network, u_char *netmask) |
float | CalcPct (float cnt, float total) |
int | DisplayBanner () |
void | ts_print (register const struct timeval *tvp, char *timebuf) |
int | gmt2local (time_t t) |
char * | copy_argv (char **argv) |
int | strip (char *data) |
void | InitNetmasks () |
void | PrintError (char *str) |
void | ErrorMessage (const char *format,...) |
void | LogMessage (const char *format,...) |
void | FatalError (const char *format,...) |
void | FatalPrintError (char *msg) |
void | CreatePidFile (char *intf) |
void | SetUidGid (void) |
void | DropStats (int iParamIgnored) |
void | InitProtoNames () |
void | CleanupProtoNames () |
char * | read_infile (char *fname) |
void | CheckLogDir (void) |
void | GoDaemon (void) |
void * | SPAlloc (unsigned long size, struct _SPMemControl *spmc) |
void * | SnortAlloc (unsigned long size) |
void | SetChroot (char *directory, char **logstore) |
char * | CurrentWorkingDir (void) |
char * | GetAbsolutePath (char *dir) |
Variables | |
u_long | netmasks [33] |
|
Definition at line 64 of file util.c. Referenced by CurrentWorkingDir(), and GetAbsolutePath(). |
|
Definition at line 242 of file util.c. Referenced by DropStats(). |
|
Definition at line 1296 of file util.c. References access, FatalError(), _progvars::log_dir, pv, S_ISDIR, snprintf, STD_BUF, and W_OK. Referenced by CreatePidFile(), and SnortMain(). |
|
Definition at line 1213 of file util.c. References NULL, and protocol_names. |
|
Definition at line 413 of file util.c. References errno, FatalError(), and NULL. Referenced by ParseCmdLine(). |
|
Definition at line 719 of file util.c. References _PATH_VARRUN, access, CheckLogDir(), ErrorMessage(), FatalError(), int(), _progvars::log_dir, LogMessage(), NULL, _progvars::pid_filename, _progvars::pid_path, _progvars::pidfile_suffix, pv, _progvars::quiet_flag, _progvars::readmode_flag, S_ISDIR, snprintf, STD_BUF, strlcpy, and W_OK. Referenced by SnortMain(). |
|
Return a ptr to the absolute pathname of snort. This memory must be copied to another region if you wish to save it for later use. Definition at line 1538 of file util.c. References NULL, and PATH_MAX_UTIL. Referenced by GetAbsolutePath(), and SetChroot(). |
|
Definition at line 214 of file util.c. References snprintf, and VarDefine(). Referenced by OpenPcap(). |
|
Definition at line 268 of file util.c. References BUILD, and VERSION. Referenced by ParseCmdLine(), and SnortMain(). |
|
|
|
Definition at line 677 of file util.c. References _progvars::daemon_flag, LOG_CONS, LOG_DAEMON, LOG_ERR, pv, STD_BUF, syslog(), and vsnprintf. |
|
Definition at line 702 of file util.c. References PrintError(). |
|
Definition at line 82 of file util.c. References DEBUG_INIT, DEBUG_WRAP, FatalError(), _progvars::homenet, mSplit(), mSplitFree(), _progvars::netmask, netmasks, and pv. Referenced by ParseCmdLine(), and ParseConfig(). |
|
Definition at line 143 of file util.c. References DEBUG_INIT, DEBUG_WRAP, FatalError(), mSplit(), mSplitFree(), netmasks, _progvars::obfuscation_mask, _progvars::obfuscation_net, and pv. Referenced by ParseCmdLine(). |
|
Given a directory name, return a ptr to a static Definition at line 1555 of file util.c. References CurrentWorkingDir(), LogMessage(), NULL, and PATH_MAX_UTIL. Referenced by SetChroot(). |
|
Definition at line 372 of file util.c. References NULL. Referenced by SnortMain(). |
|
Definition at line 1330 of file util.c. References LogMessage(). Referenced by SnortMain(). |
|
Definition at line 505 of file util.c. References netmasks. Referenced by SnortMain(). |
|
Definition at line 1174 of file util.c. References char(), protocol_names, and snprintf. Referenced by SnortMain(). |
|
|
Definition at line 551 of file util.c. References _progvars::daemon_flag, LOG_CONS, LOG_DAEMON, LOG_ERR, pv, and syslog(). Referenced by FatalPrintError(), and SnortMain(). |
|
Definition at line 1238 of file util.c. References errno, FatalError(), int(), NULL, and pcap_strerror(). Referenced by ParseCmdLine(), and ParseConfig(). |
|
Chroot and adjust the pv.log_dir reference
Definition at line 1435 of file util.c. References CurrentWorkingDir(), DEBUG_INIT, DEBUG_WRAP, errno, FatalError(), GetAbsolutePath(), NULL, SigCantHupHandler(), and SIGHUP. Referenced by SnortMain(). |
|
just to be on a safe side... Definition at line 813 of file util.c. References DEBUG_INIT, DEBUG_WRAP, ErrorMessage(), FatalError(), groupid, groupname, InlineMode(), NULL, userid, and username. Referenced by SnortMain(). |
|
|
Definition at line 1392 of file util.c. References FatalError(), _SPMemControl::mem_usage, _SPMemControl::memcap, NULL, and _SPMemControl::sp_func. Referenced by InsertFrag(), and NewFragTracker(). |
|
Definition at line 461 of file util.c. Referenced by ParseContentListFile(), and ParseRule(). |
|
Definition at line 310 of file util.c. References bzero, gettimeofday(), _progvars::include_year, pv, snprintf, thiszone, TIMEBUF_SIZE, and _progvars::use_utc. Referenced by AlertFast(), AlertFull(), LogPortscanAlert(), PrintArpHeader(), PrintEapolPkt(), PrintIPPkt(), PrintWifiPkt(), RealAlertCSV(), and SLog(). |
|
|