Skip to content

Commit

Permalink
reorg: clang-format branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Dec 4, 2023
1 parent d1469db commit f4f6da0
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 132 deletions.
2 changes: 1 addition & 1 deletion src/app-layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static int TCPProtoDetect(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,

*alproto = *alproto_otherdir;
SCLogDebug("packet %" PRIu64 ": pd done(us %u them %u), parser called (r==%d), "
"APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION set",
"APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION set",
p->pcap_cnt, *alproto, *alproto_otherdir, r);
if (r < 0) {
goto parser_error;
Expand Down
4 changes: 2 additions & 2 deletions src/detect-bytejump.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define __DETECT_BYTEJUMP_H__

/** Bytejump Base */
#define DETECT_BYTEJUMP_BASE_UNSET 0 /**< Unset type value string (automatic)*/
#define DETECT_BYTEJUMP_BASE_OCT 8 /**< "oct" type value string */
#define DETECT_BYTEJUMP_BASE_UNSET 0 /**< Unset type value string (automatic)*/
#define DETECT_BYTEJUMP_BASE_OCT 8 /**< "oct" type value string */
#define DETECT_BYTEJUMP_BASE_DEC 10 /**< "dec" type value string */
#define DETECT_BYTEJUMP_BASE_HEX 16 /**< "hex" type value string */

Expand Down
4 changes: 2 additions & 2 deletions src/detect-bytetest.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#define DETECT_BYTETEST_OP_LE 7 /**< less than equal operator */

/** Bytetest Base */
#define DETECT_BYTETEST_BASE_UNSET 0 /**< Unset type value string (automatic)*/
#define DETECT_BYTETEST_BASE_OCT 8 /**< "oct" type value string */
#define DETECT_BYTETEST_BASE_UNSET 0 /**< Unset type value string (automatic)*/
#define DETECT_BYTETEST_BASE_OCT 8 /**< "oct" type value string */
#define DETECT_BYTETEST_BASE_DEC 10 /**< "dec" type value string */
#define DETECT_BYTETEST_BASE_HEX 16 /**< "hex" type value string */

Expand Down
12 changes: 6 additions & 6 deletions src/detect-engine-iponly.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,9 +1610,9 @@ static int IPOnlyTestSig03(void)
SigFree(de_ctx, s);

/* pcre */
s = SigInit(
de_ctx, "alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pcre) \"; "
"pcre:\"/e?idps rule[sz]/i\"; classtype:misc-activity; sid:400001; rev:1;)");
s = SigInit(de_ctx,
"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (pcre) \"; "
"pcre:\"/e?idps rule[sz]/i\"; classtype:misc-activity; sid:400001; rev:1;)");
if (s == NULL) {
goto end;
}
Expand Down Expand Up @@ -1647,9 +1647,9 @@ static int IPOnlyTestSig03(void)
SigFree(de_ctx, s);

/* flowbits */
s = SigInit(
de_ctx, "alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flowbits) "
"\"; flowbits:unset; classtype:misc-activity; sid:400001; rev:1;)");
s = SigInit(de_ctx,
"alert tcp any any -> any any (msg:\"SigTest40-03 sig is not IPOnly (flowbits) "
"\"; flowbits:unset; classtype:misc-activity; sid:400001; rev:1;)");
if (s == NULL) {
goto end;
}
Expand Down
54 changes: 27 additions & 27 deletions src/detect-engine-sigorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,36 +862,36 @@ static int SCSigOrderingTest02(void)
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF(de_ctx == NULL);

sig = DetectEngineAppendSig(
de_ctx, "alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:1;)");
sig = DetectEngineAppendSig(de_ctx,
"alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:1;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "drop tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:2;)");
sig = DetectEngineAppendSig(de_ctx,
"drop tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:2;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "drop tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:10; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:3;)");
sig = DetectEngineAppendSig(de_ctx,
"drop tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:10; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:3;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "pass tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; "
"flowvar:http_host,\"www.oisf.net\"; rev:4; priority:1; sid:4;)");
sig = DetectEngineAppendSig(de_ctx,
"pass tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; "
"flowvar:http_host,\"www.oisf.net\"; rev:4; priority:1; sid:4;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(de_ctx,
"alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; content:\"220\"; "
"offset:0; depth:4; pcre:\"/220[- ]/\"; rev:4; priority:1; sid:5;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "pass tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"pcre:\"/^User-Agent: (?P<flow_http_host>.*)\\r\\n/m\"; content:\"220\"; "
"offset:10; depth:4; rev:4; priority:3; sid:6;)");
sig = DetectEngineAppendSig(de_ctx,
"pass tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"pcre:\"/^User-Agent: (?P<flow_http_host>.*)\\r\\n/m\"; content:\"220\"; "
"offset:10; depth:4; rev:4; priority:3; sid:6;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(de_ctx,
Expand All @@ -915,14 +915,14 @@ static int SCSigOrderingTest02(void)
"offset:11; depth:4; pcre:\"/220[- ]/\"; rev:4; priority:3; sid:10;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:11; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:11;)");
sig = DetectEngineAppendSig(de_ctx,
"alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:11; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:11;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:11; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:12;)");
sig = DetectEngineAppendSig(de_ctx,
"alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:11; depth:4; pcre:\"/220[- ]/\"; rev:4; sid:12;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(de_ctx,
Expand All @@ -931,10 +931,10 @@ static int SCSigOrderingTest02(void)
"priority:2; flowbits:isnotset,TEST.two; sid:13;)");
FAIL_IF_NULL(sig);

sig = DetectEngineAppendSig(
de_ctx, "alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:12; depth:4; pcre:\"/220[- ]/\"; rev:4; priority:2; "
"flowbits:set,TEST.two; sid:14;)");
sig = DetectEngineAppendSig(de_ctx,
"alert tcp any !21:902 -> any any (msg:\"Testing sigordering\"; "
"content:\"220\"; offset:12; depth:4; pcre:\"/220[- ]/\"; rev:4; priority:2; "
"flowbits:set,TEST.two; sid:14;)");
FAIL_IF_NULL(sig);

SCSigRegisterSignatureOrderingFunc(de_ctx, SCSigOrderByActionCompare);
Expand Down
32 changes: 16 additions & 16 deletions src/detect-engine-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@ static int DeStateSigTest02(void)

de_ctx->flags |= DE_QUIET;

Signature *s = DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (flow:to_server; content:\"POST\"; http_method; "
"content:\"/\"; http_uri; content:\"Mozilla\"; http_header; content:\"dummy\"; "
"http_cookie; content:\"body\"; nocase; http_client_body; sid:1; rev:1;)");
Signature *s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (flow:to_server; content:\"POST\"; http_method; "
"content:\"/\"; http_uri; content:\"Mozilla\"; http_header; content:\"dummy\"; "
"http_cookie; content:\"body\"; nocase; http_client_body; sid:1; rev:1;)");
FAIL_IF_NULL(s);
s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (flow:to_server; content:\"GET\"; http_method; "
Expand Down Expand Up @@ -689,9 +689,9 @@ static int DeStateSigTest03(void)

de_ctx->flags |= DE_QUIET;

Signature *s = DetectEngineAppendSig(
de_ctx, "alert http any any -> any any (flow:to_server; content:\"POST\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
Signature *s = DetectEngineAppendSig(de_ctx,
"alert http any any -> any any (flow:to_server; content:\"POST\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
FAIL_IF_NULL(s);

SigGroupBuild(de_ctx);
Expand Down Expand Up @@ -774,9 +774,9 @@ static int DeStateSigTest04(void)
FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;

Signature *s = DetectEngineAppendSig(
de_ctx, "alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
Signature *s = DetectEngineAppendSig(de_ctx,
"alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
FAIL_IF_NULL(s);

SigGroupBuild(de_ctx);
Expand Down Expand Up @@ -857,9 +857,9 @@ static int DeStateSigTest05(void)
FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;

Signature *s = DetectEngineAppendSig(
de_ctx, "alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filename:\"nomatch\"; sid:1; rev:1;)");
Signature *s = DetectEngineAppendSig(de_ctx,
"alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filename:\"nomatch\"; sid:1; rev:1;)");
FAIL_IF_NULL(s);

SigGroupBuild(de_ctx);
Expand Down Expand Up @@ -1030,9 +1030,9 @@ static int DeStateSigTest07(void)
FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;

Signature *s = DetectEngineAppendSig(
de_ctx, "alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
Signature *s = DetectEngineAppendSig(de_ctx,
"alert http any any -> any any (content:\"GET\"; http_method; "
"content:\"upload.cgi\"; http_uri; filestore; sid:1; rev:1;)");
FAIL_IF_NULL(s);

SigGroupBuild(de_ctx);
Expand Down
18 changes: 9 additions & 9 deletions src/detect-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3317,9 +3317,9 @@ static int SigParseTest18(void)
if (de_ctx == NULL)
goto end;

if (DetectEngineAppendSig(de_ctx, "alert tcp 1.2.3.4 any -> !1.2.3.4 any "
"(msg:\"SigParseTest01\"; sid:99999999999999999999;)") !=
NULL)
if (DetectEngineAppendSig(de_ctx,
"alert tcp 1.2.3.4 any -> !1.2.3.4 any "
"(msg:\"SigParseTest01\"; sid:99999999999999999999;)") != NULL)
goto end;

result = 1;
Expand All @@ -3338,9 +3338,9 @@ static int SigParseTest19(void)
if (de_ctx == NULL)
goto end;

if (DetectEngineAppendSig(
de_ctx, "alert tcp 1.2.3.4 any -> !1.2.3.4 any (msg:\"SigParseTest01\"; sid:1; "
"gid:99999999999999999999;)") != NULL)
if (DetectEngineAppendSig(de_ctx,
"alert tcp 1.2.3.4 any -> !1.2.3.4 any (msg:\"SigParseTest01\"; sid:1; "
"gid:99999999999999999999;)") != NULL)
goto end;

result = 1;
Expand All @@ -3359,9 +3359,9 @@ static int SigParseTest20(void)
if (de_ctx == NULL)
goto end;

if (DetectEngineAppendSig(
de_ctx, "alert tcp 1.2.3.4 any -> !1.2.3.4 any (msg:\"SigParseTest01\"; sid:1; "
"rev:99999999999999999999;)") != NULL)
if (DetectEngineAppendSig(de_ctx,
"alert tcp 1.2.3.4 any -> !1.2.3.4 any (msg:\"SigParseTest01\"; sid:1; "
"rev:99999999999999999999;)") != NULL)
goto end;

result = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/respond-reject-libnet11.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
return 0;
}

#else /* HAVE_LIBNET_ICMPV6_UNREACH */
#else /* HAVE_LIBNET_ICMPV6_UNREACH */

int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
{
Expand Down
4 changes: 2 additions & 2 deletions src/source-nfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ TmEcode NFQSetVerdict(Packet *p)
} else {
ret = nfq_set_verdict2(t->qh, p->nfq_v.id, verdict, p->nfq_v.mark, 0, NULL);
}
#else /* fall back to old function */
#else /* fall back to old function */
if (p->flags & PKT_STREAM_MODIFIED) {
ret = nfq_set_verdict_mark(t->qh, p->nfq_v.id, verdict,
htonl(p->nfq_v.mark), GET_PKT_LEN(p), GET_PKT_DATA(p));
Expand Down Expand Up @@ -1146,7 +1146,7 @@ TmEcode NFQSetVerdict(Packet *p)
(p->nfq_v.mark & ~nfq_config.mask),
0, NULL);
}
#else /* fall back to old function */
#else /* fall back to old function */
if (p->flags & PKT_STREAM_MODIFIED) {
ret = nfq_set_verdict_mark(t->qh, p->nfq_v.id, verdict,
htonl((nfq_config.mark & nfq_config.mask) |
Expand Down
2 changes: 1 addition & 1 deletion src/stream-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5159,7 +5159,7 @@ static int StreamTcpPacketIsBadWindowUpdate(TcpSession *ssn, Packet *p)
SCLogDebug("%" PRIu64 ", pkt_win %u, stream win %u", p->pcap_cnt, pkt_win,
ostream->window);
SCLogDebug("%" PRIu64 ", seq %u ack %u ostream->next_seq %u ostream->last_ack %u, "
"ostream->next_win %u, diff %u (%u)",
"ostream->next_win %u, diff %u (%u)",
p->pcap_cnt, seq, ack, ostream->next_seq, ostream->last_ack, ostream->next_win,
ostream->next_seq - ostream->last_ack, stream->next_seq - stream->last_ack);

Expand Down
32 changes: 16 additions & 16 deletions src/tests/detect-http-client-body.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,18 +1856,18 @@ static int DetectHttpClientBodyTest14(void)

de_ctx->flags |= DE_QUIET;

s = DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (content:\"POST\"; http_method; "
"content:\"Mozilla\"; http_header; content:\"dummy\"; http_cookie; "
"content:\"one\"; http_client_body; sid:1; rev:1;)");
s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (content:\"POST\"; http_method; "
"content:\"Mozilla\"; http_header; content:\"dummy\"; http_cookie; "
"content:\"one\"; http_client_body; sid:1; rev:1;)");
if (s == NULL) {
printf("sig parse failed: ");
goto end;
}
s = DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (content:\"GET\"; http_method; "
"content:\"Firefox\"; http_header; content:\"dummy2\"; http_cookie; "
"content:\"two\"; http_client_body; sid:2; rev:1;)");
s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (content:\"GET\"; http_method; "
"content:\"Firefox\"; http_header; content:\"dummy2\"; http_cookie; "
"content:\"two\"; http_client_body; sid:2; rev:1;)");
if (s == NULL) {
printf("sig2 parse failed: ");
goto end;
Expand Down Expand Up @@ -2059,18 +2059,18 @@ static int DetectHttpClientBodyTest15(void)

de_ctx->flags |= DE_QUIET;

s = DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (content:\"POST\"; http_method; "
"content:\"Mozilla\"; http_header; content:\"dummy\"; http_cookie; "
"content:\"one\"; http_client_body; sid:1; rev:1;)");
s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (content:\"POST\"; http_method; "
"content:\"Mozilla\"; http_header; content:\"dummy\"; http_cookie; "
"content:\"one\"; http_client_body; sid:1; rev:1;)");
if (s == NULL) {
printf("sig parse failed: ");
goto end;
}
s = DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (content:\"GET\"; http_method; "
"content:\"Firefox\"; http_header; content:\"dummy2\"; http_cookie; "
"content:\"two\"; http_client_body; sid:2; rev:1;)");
s = DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (content:\"GET\"; http_method; "
"content:\"Firefox\"; http_header; content:\"dummy2\"; http_cookie; "
"content:\"two\"; http_client_body; sid:2; rev:1;)");
if (s == NULL) {
printf("sig2 parse failed: ");
goto end;
Expand Down
6 changes: 3 additions & 3 deletions src/tests/detect-http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ static int DetectHTTP2settingsParseTest01(void)
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF_NULL(de_ctx);

Signature *sig = DetectEngineAppendSig(
de_ctx, "alert http2 any any -> any any (http2.settings:SETTINGS_MAX_HEADER_LIST_SIZE "
">1024; sid:1; rev:1;)");
Signature *sig = DetectEngineAppendSig(de_ctx,
"alert http2 any any -> any any (http2.settings:SETTINGS_MAX_HEADER_LIST_SIZE "
">1024; sid:1; rev:1;)");
FAIL_IF_NULL(sig);

DetectEngineCtxFree(de_ctx);
Expand Down
Loading

0 comments on commit f4f6da0

Please sign in to comment.