diff --git a/src/decode-ipv6.c b/src/decode-ipv6.c index 6e7e472fe9..6090879119 100644 --- a/src/decode-ipv6.c +++ b/src/decode-ipv6.c @@ -419,25 +419,25 @@ void DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, #ifdef DEBUG if (IPV6_EXTHDR_ISSET_FH(p)) { - printf("IPV6 FRAG - HDRLEN: %" PRIuMAX " NH: %" PRIu32 " OFFSET: %" PRIu32 " ID: %" PRIu32 "\n", + SCLogDebug("IPV6 FRAG - HDRLEN: %" PRIuMAX " NH: %" PRIu32 " OFFSET: %" PRIu32 " ID: %" PRIu32 "", (uintmax_t)IPV6_EXTHDR_GET_FH_HDRLEN(p), IPV6_EXTHDR_GET_FH_NH(p), IPV6_EXTHDR_GET_FH_OFFSET(p), IPV6_EXTHDR_GET_FH_ID(p)); } if (IPV6_EXTHDR_ISSET_RH(p)) { - printf("IPV6 ROUTE - HDRLEN: %" PRIu32 " NH: %" PRIu32 " TYPE: %" PRIu32 "\n", + SCLogDebug("IPV6 ROUTE - HDRLEN: %" PRIu32 " NH: %" PRIu32 " TYPE: %" PRIu32 "", IPV6_EXTHDR_GET_RH_HDRLEN(p), IPV6_EXTHDR_GET_RH_NH(p), IPV6_EXTHDR_GET_RH_TYPE(p)); } if (IPV6_EXTHDR_ISSET_HH(p)) { - printf("IPV6 HOPOPT - HDRLEN: %" PRIu32 " NH: %" PRIu32 "\n", + SCLogDebug("IPV6 HOPOPT - HDRLEN: %" PRIu32 " NH: %" PRIu32 "", IPV6_EXTHDR_GET_HH_HDRLEN(p), IPV6_EXTHDR_GET_HH_NH(p)); } if (IPV6_EXTHDR_ISSET_DH1(p)) { - printf("IPV6 DSTOPT1 - HDRLEN: %" PRIu32 " NH: %" PRIu32 "\n", + SCLogDebug("IPV6 DSTOPT1 - HDRLEN: %" PRIu32 " NH: %" PRIu32 "", IPV6_EXTHDR_GET_DH1_HDRLEN(p), IPV6_EXTHDR_GET_DH1_NH(p)); } if (IPV6_EXTHDR_ISSET_DH2(p)) { - printf("IPV6 DSTOPT2 - HDRLEN: %" PRIu32 " NH: %" PRIu32 "\n", + SCLogDebug("IPV6 DSTOPT2 - HDRLEN: %" PRIu32 " NH: %" PRIu32 "", IPV6_EXTHDR_GET_DH2_HDRLEN(p), IPV6_EXTHDR_GET_DH2_NH(p)); } #endif diff --git a/src/detect.c b/src/detect.c index 2884f40e2b..e499cabf77 100644 --- a/src/detect.c +++ b/src/detect.c @@ -243,7 +243,9 @@ int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file) { } fclose(fp); - SCLogInfo("%" PRId32 " successfully loaded from file %s. %" PRId32 " sigs failed to load", good, sig_file, bad); + SCLogInfo("%" PRId32 " successfully loaded from file %s.", good, sig_file); + if (bad) + SCLogInfo("%" PRId32 " sigs failed to load from file %s.", bad, sig_file); if (good == 0) return 0; else @@ -265,29 +267,41 @@ int SigLoadSignatures (DetectEngineCtx *de_ctx, char *sig_file) /* http_uri -- for uricontent */ sig = SigInit(de_ctx, "alert tcp any any -> any $HTTP_PORTS (msg:\"HTTP GET URI cap\"; flow:to_server,established; content:\"GET \"; depth:4; pcre:\"/^GET (?P.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; noalert; sid:1;)"); - if (sig == NULL) + if (sig == NULL) { + SCLogError(SC_ERR_NO_RULES, "Is HTTP_PORTS variable defined in " + "configuration file"); return -1; + } prevsig = sig; de_ctx->sig_list = sig; sig = SigInit(de_ctx, "alert tcp any any -> any $HTTP_PORTS (msg:\"HTTP POST URI cap\"; flow:to_server,established; content:\"POST \"; depth:5; pcre:\"/^POST (?P.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; noalert; sid:2;)"); - if (sig == NULL) + if (sig == NULL) { + SCLogError(SC_ERR_NO_RULES, "Is HTTP_PORTS variable defined in " + "configuration file"); return -1; + } prevsig->next = sig; prevsig = sig; /* http_host -- for the log-httplog module */ sig = SigInit(de_ctx, "alert tcp any any -> any $HTTP_PORTS (msg:\"HTTP host cap\"; flow:to_server,established; content:\"|0d 0a|Host:\"; pcre:\"/^Host: (?P.*)\\r\\n/m\"; noalert; sid:3;)"); - if (sig == NULL) + if (sig == NULL) { + SCLogError(SC_ERR_NO_RULES, "Is HTTP_PORTS variable defined in " + "configuration file"); return -1; + } prevsig->next = sig; prevsig = sig; /* http_ua -- for the log-httplog module */ sig = SigInit(de_ctx, "alert tcp any any -> any $HTTP_PORTS (msg:\"HTTP UA cap\"; flow:to_server,established; content:\"|0d 0a|User-Agent:\"; pcre:\"/^User-Agent: (?P.*)\\r\\n/m\"; noalert; sid:4;)"); - if (sig == NULL) + if (sig == NULL) { + SCLogError(SC_ERR_NO_RULES, "Is HTTP_PORTS variable defined in " + "configuration file"); return -1; + } prevsig->next = sig; /* ok, now let's load signature files from the general config */ diff --git a/src/suricata.c b/src/suricata.c index 1f77a1663c..d5e730f8c2 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -277,6 +277,10 @@ void usage(const char *progname) printf("\t--fatal-unittests : enable fatal failure on unittest error\n"); #endif /* UNITTESTS */ printf("\n"); + printf("\nTo run the engine with default configuration on " + "interface eth0 with signature file \"signatures.rules\", run the " + "command as:\n\n%s -c suricata.yaml -s signatures.rules -i eth0 \n\n", + progname); } int main(int argc, char **argv) @@ -423,8 +427,10 @@ int main(int argc, char **argv) /* Load yaml configuration file if provided. */ if (conf_filename != NULL) { ConfYamlLoadFile(conf_filename); - } else { + } else if (mode != MODE_UNITTEST){ SCLogError(SC_ERR_OPENING_FILE, "Configuration file has not been provided"); + usage(argv[0]); + exit(EXIT_FAILURE); } if (dump_config) {