suricata
alert-fastlog.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2020 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Logs alerts in a line based text format compatible to Snort's
24  * alert_fast format.
25  */
26 
27 #include "suricata-common.h"
28 #include "debug.h"
29 #include "detect.h"
30 #include "flow.h"
31 #include "conf.h"
32 
33 #include "threads.h"
34 #include "tm-threads.h"
35 #include "threadvars.h"
36 #include "util-debug.h"
37 
38 #include "util-unittest.h"
39 #include "util-unittest-helper.h"
40 
41 #include "detect-parse.h"
42 #include "detect-engine.h"
43 #include "detect-engine-mpm.h"
44 #include "detect-reference.h"
46 
47 #include "output.h"
48 #include "alert-fastlog.h"
49 
50 #include "util-privs.h"
51 #include "util-print.h"
52 #include "util-proto-name.h"
53 #include "util-optimize.h"
54 #include "util-logopenfile.h"
55 #include "util-time.h"
56 
57 #define DEFAULT_LOG_FILENAME "fast.log"
58 
59 #define MODULE_NAME "AlertFastLog"
60 
61 /* The largest that size allowed for one alert string. */
62 #define MAX_FASTLOG_ALERT_SIZE 2048
63 /* The largest alert buffer that will be written at one time, possibly
64  * holding multiple alerts. */
65 #define MAX_FASTLOG_BUFFER_SIZE (2 * MAX_FASTLOG_ALERT_SIZE)
66 
67 TmEcode AlertFastLogThreadInit(ThreadVars *, const void *, void **);
69 void AlertFastLogRegisterTests(void);
70 static void AlertFastLogDeInitCtx(OutputCtx *);
71 
73 int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p);
74 
76 {
81 }
82 
83 typedef struct AlertFastLogThread_ {
84  /** LogFileCtx has the pointer to the file and a mutex to allow multithreading */
87 
89 {
90  return (p->alerts.cnt ? TRUE : FALSE);
91 }
92 
93 static inline void AlertFastLogOutputAlert(AlertFastLogThread *aft, char *buffer,
94  int alert_size)
95 {
96  /* Output the alert string and count alerts. Only need to lock here. */
97  aft->file_ctx->Write(buffer, alert_size, aft->file_ctx);
98 }
99 
100 int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p)
101 {
102  AlertFastLogThread *aft = (AlertFastLogThread *)data;
103  int i;
104  char timebuf[64];
105  int decoder_event = 0;
106 
107  CreateTimeString(&p->ts, timebuf, sizeof(timebuf));
108 
109  char srcip[46], dstip[46];
110  if (PKT_IS_IPV4(p)) {
111  PrintInet(AF_INET, (const void *)GET_IPV4_SRC_ADDR_PTR(p), srcip, sizeof(srcip));
112  PrintInet(AF_INET, (const void *)GET_IPV4_DST_ADDR_PTR(p), dstip, sizeof(dstip));
113  } else if (PKT_IS_IPV6(p)) {
114  PrintInet(AF_INET6, (const void *)GET_IPV6_SRC_ADDR(p), srcip, sizeof(srcip));
115  PrintInet(AF_INET6, (const void *)GET_IPV6_DST_ADDR(p), dstip, sizeof(dstip));
116  } else {
117  decoder_event = 1;
118  }
119 
120  /* Buffer to store the generated alert strings. The buffer is
121  * filled with alert strings until it doesn't have room to store
122  * another full alert, only then is the buffer written. This is
123  * more efficient for multiple alerts and only slightly slower for
124  * single alerts.
125  */
126  char alert_buffer[MAX_FASTLOG_BUFFER_SIZE];
127 
128  char proto[16] = "";
129  char *protoptr;
131  protoptr = known_proto[IP_GET_IPPROTO(p)];
132  } else {
133  snprintf(proto, sizeof(proto), "PROTO:%03" PRIu32, IP_GET_IPPROTO(p));
134  protoptr = proto;
135  }
136  uint16_t src_port_or_icmp = p->sp;
137  uint16_t dst_port_or_icmp = p->dp;
138  if (IP_GET_IPPROTO(p) == IPPROTO_ICMP || IP_GET_IPPROTO(p) == IPPROTO_ICMPV6) {
139  src_port_or_icmp = p->icmp_s.type;
140  dst_port_or_icmp = p->icmp_s.code;
141  }
142  for (i = 0; i < p->alerts.cnt; i++) {
143  const PacketAlert *pa = &p->alerts.alerts[i];
144  if (unlikely(pa->s == NULL)) {
145  continue;
146  }
147 
148  const char *action = "";
149  if ((pa->action & ACTION_DROP) && EngineModeIsIPS()) {
150  action = "[Drop] ";
151  } else if (pa->action & ACTION_DROP) {
152  action = "[wDrop] ";
153  }
154 
155  /* Create the alert string without locking. */
156  int size = 0;
157  if (likely(decoder_event == 0)) {
158  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
159  "%s %s[**] [%" PRIu32 ":%" PRIu32 ":%"
160  PRIu32 "] %s [**] [Classification: %s] [Priority: %"PRIu32"]"
161  " {%s} %s:%" PRIu32 " -> %s:%" PRIu32 "\n", timebuf, action,
162  pa->s->gid, pa->s->id, pa->s->rev, pa->s->msg, pa->s->class_msg, pa->s->prio,
163  protoptr, srcip, src_port_or_icmp, dstip, dst_port_or_icmp);
164  } else {
165  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
166  "%s %s[**] [%" PRIu32 ":%" PRIu32
167  ":%" PRIu32 "] %s [**] [Classification: %s] [Priority: "
168  "%" PRIu32 "] [**] [Raw pkt: ", timebuf, action, pa->s->gid,
169  pa->s->id, pa->s->rev, pa->s->msg, pa->s->class_msg, pa->s->prio);
170  PrintBufferRawLineHex(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
171  GET_PKT_DATA(p), GET_PKT_LEN(p) < 32 ? GET_PKT_LEN(p) : 32);
172  if (p->pcap_cnt != 0) {
173  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
174  "] [pcap file packet: %"PRIu64"]\n", p->pcap_cnt);
175  } else {
176  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE, "]\n");
177  }
178  }
179 
180  /* Write the alert to output file */
181  AlertFastLogOutputAlert(aft, alert_buffer, size);
182  }
183 
184  return TM_ECODE_OK;
185 }
186 
187 TmEcode AlertFastLogThreadInit(ThreadVars *t, const void *initdata, void **data)
188 {
190  if (unlikely(aft == NULL))
191  return TM_ECODE_FAILED;
192  memset(aft, 0, sizeof(AlertFastLogThread));
193  if(initdata == NULL)
194  {
195  SCLogDebug("Error getting context for AlertFastLog. \"initdata\" argument NULL");
196  SCFree(aft);
197  return TM_ECODE_FAILED;
198  }
199  /** Use the Ouptut Context (file pointer and mutex) */
200  aft->file_ctx = ((OutputCtx *)initdata)->data;
201 
202  *data = (void *)aft;
203  return TM_ECODE_OK;
204 }
205 
207 {
208  AlertFastLogThread *aft = (AlertFastLogThread *)data;
209  if (aft == NULL) {
210  return TM_ECODE_OK;
211  }
212 
213  /* clear memory */
214  memset(aft, 0, sizeof(AlertFastLogThread));
215 
216  SCFree(aft);
217  return TM_ECODE_OK;
218 }
219 
220 /**
221  * \brief Create a new LogFileCtx for "fast" output style.
222  * \param conf The configuration node for this output.
223  * \return A LogFileCtx pointer on success, NULL on failure.
224  */
226 {
227  OutputInitResult result = { NULL, false };
228  LogFileCtx *logfile_ctx = LogFileNewCtx();
229  if (logfile_ctx == NULL) {
230  SCLogDebug("AlertFastLogInitCtx2: Could not create new LogFileCtx");
231  return result;
232  }
233 
234  if (SCConfLogOpenGeneric(conf, logfile_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
235  LogFileFreeCtx(logfile_ctx);
236  return result;
237  }
238 
239  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
240  if (unlikely(output_ctx == NULL)) {
241  LogFileFreeCtx(logfile_ctx);
242  return result;
243  }
244 
245  output_ctx->data = logfile_ctx;
246  output_ctx->DeInit = AlertFastLogDeInitCtx;
247 
248  result.ctx = output_ctx;
249  result.ok = true;
250  return result;
251 }
252 
253 static void AlertFastLogDeInitCtx(OutputCtx *output_ctx)
254 {
255  LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data;
256  LogFileFreeCtx(logfile_ctx);
257  SCFree(output_ctx);
258 }
259 
260 /*------------------------------Unittests-------------------------------------*/
261 
262 #ifdef UNITTESTS
263 
264 static int AlertFastLogTest01(void)
265 {
266  int result = 0;
267  uint8_t *buf = (uint8_t *) "GET /one/ HTTP/1.1\r\n"
268  "Host: one.example.org\r\n";
269 
270  uint16_t buflen = strlen((char *)buf);
271  Packet *p = NULL;
272  ThreadVars th_v;
273  DetectEngineThreadCtx *det_ctx;
274 
275  memset(&th_v, 0, sizeof(th_v));
276  p = UTHBuildPacket(buf, buflen, IPPROTO_TCP);
277 
279  if (de_ctx == NULL) {
280  return result;
281  }
282 
283  de_ctx->flags |= DE_QUIET;
284 
287 
288  de_ctx->sig_list = SigInit(de_ctx, "alert tcp any any -> any any "
289  "(msg:\"FastLog test\"; content:\"GET\"; "
290  "Classtype:unknown; sid:1;)");
291 
293  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
294 
295  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
296  if (p->alerts.cnt == 1) {
297  result = (strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0);
298  }
299 
302  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
304 
305  UTHFreePackets(&p, 1);
306  return result;
307 }
308 
309 static int AlertFastLogTest02(void)
310 {
311  int result = 0;
312  uint8_t *buf = (uint8_t *) "GET /one/ HTTP/1.1\r\n"
313  "Host: one.example.org\r\n";
314  uint16_t buflen = strlen((char *)buf);
315  Packet *p = NULL;
316  ThreadVars th_v;
317  DetectEngineThreadCtx *det_ctx;
318 
319  memset(&th_v, 0, sizeof(th_v));
320 
321  p = UTHBuildPacket(buf, buflen, IPPROTO_TCP);
322 
324  if (de_ctx == NULL) {
325  return result;
326  }
327 
328  de_ctx->flags |= DE_QUIET;
329 
332 
333  de_ctx->sig_list = SigInit(de_ctx, "alert tcp any any -> any any "
334  "(msg:\"FastLog test\"; content:\"GET\"; "
335  "Classtype:unknown; sid:1;)");
336 
338  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
339 
340  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
341  if (p->alerts.cnt == 1) {
342  result = (strcmp(p->alerts.alerts[0].s->class_msg,
343  "Unknown are we") == 0);
344  if (result == 0)
345  printf("p->alerts.alerts[0].class_msg %s: ", p->alerts.alerts[0].s->class_msg);
346  }
347 
350  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
352 
353  UTHFreePackets(&p, 1);
354  return result;
355 }
356 
357 #endif /* UNITTESTS */
358 
359 /**
360  * \brief This function registers unit tests for AlertFastLog API.
361  */
363 {
364 
365 #ifdef UNITTESTS
366 
367  UtRegisterTest("AlertFastLogTest01", AlertFastLogTest01);
368  UtRegisterTest("AlertFastLogTest02", AlertFastLogTest02);
369 
370 #endif /* UNITTESTS */
371 
372 }
tm-threads.h
AlertFastLogThread_
Definition: alert-fastlog.c:83
AlertFastLogger
int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p)
Definition: alert-fastlog.c:100
detect-engine.h
AlertFastLogRegisterTests
void AlertFastLogRegisterTests(void)
This function registers unit tests for AlertFastLog API.
Definition: alert-fastlog.c:362
PacketAlert_::s
const struct Signature_ * s
Definition: decode.h:279
PKT_IS_IPV6
#define PKT_IS_IPV6(p)
Definition: decode.h:258
AlertFastLogCondition
int AlertFastLogCondition(ThreadVars *tv, const Packet *p)
Definition: alert-fastlog.c:88
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
AlertFastLogInitCtx
OutputInitResult AlertFastLogInitCtx(ConfNode *conf)
Create a new LogFileCtx for "fast" output style.
Definition: alert-fastlog.c:225
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition: util-unittest.c:103
LogFileNewCtx
LogFileCtx * LogFileNewCtx(void)
LogFileNewCtx() Get a new LogFileCtx.
Definition: util-logopenfile.c:640
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
Packet_::pcap_cnt
uint64_t pcap_cnt
Definition: decode.h:570
PacketAlerts_::alerts
PacketAlert alerts[PACKET_ALERT_MAX]
Definition: decode.h:300
SCClassConfLoadClassficationConfigFile
void SCClassConfLoadClassficationConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
Loads the Classtype info from the classification.config file.
Definition: util-classification-config.c:527
PacketAlerts_::cnt
uint16_t cnt
Definition: decode.h:299
threads.h
SigInit
Signature * SigInit(DetectEngineCtx *, const char *)
Parses a signature and adds it to the Detection Engine Context.
Definition: detect-parse.c:2056
AlertFastLogRegister
void AlertFastLogRegister(void)
Definition: alert-fastlog.c:75
LogFileCtx_
Definition: util-logopenfile.h:60
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:767
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2093
SCProtoNameValid
bool SCProtoNameValid(uint16_t proto)
Function to check if the received protocol number is valid and do we have corresponding name entry fo...
Definition: util-proto-name.c:98
DE_QUIET
#define DE_QUIET
Definition: detect.h:294
util-privs.h
LogFileCtx_::Write
int(* Write)(const char *buffer, int buffer_len, struct LogFileCtx_ *fp)
Definition: util-logopenfile.h:78
UTHBuildPacket
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
Definition: util-unittest-helper.c:337
proto
uint8_t proto
Definition: decode-template.h:0
SigCleanSignatures
void SigCleanSignatures(DetectEngineCtx *de_ctx)
Definition: detect-engine-build.c:39
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:81
AlertFastLogThreadInit
TmEcode AlertFastLogThreadInit(ThreadVars *, const void *, void **)
Definition: alert-fastlog.c:187
MAX_FASTLOG_BUFFER_SIZE
#define MAX_FASTLOG_BUFFER_SIZE
Definition: alert-fastlog.c:65
GET_IPV6_DST_ADDR
#define GET_IPV6_DST_ADDR(p)
Definition: decode.h:226
Packet_::alerts
PacketAlerts alerts
Definition: decode.h:564
util-unittest.h
DEFAULT_LOG_FILENAME
#define DEFAULT_LOG_FILENAME
Definition: alert-fastlog.c:57
util-unittest-helper.h
OutputCtx_::data
void * data
Definition: tm-modules.h:81
AlertFastLogThread_::file_ctx
LogFileCtx * file_ctx
Definition: alert-fastlog.c:85
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:80
OutputCtx_
Definition: tm-modules.h:78
SCConfLogOpenGeneric
int SCConfLogOpenGeneric(ConfNode *conf, LogFileCtx *log_ctx, const char *default_filename, int rotate)
open a generic output "log file", which may be a regular file or a socket
Definition: util-logopenfile.c:423
PacketAlert_::action
uint8_t action
Definition: decode.h:277
detect-reference.h
Signature_::gid
uint32_t gid
Definition: detect.h:562
util-debug.h
GET_IPV4_DST_ADDR_PTR
#define GET_IPV4_DST_ADDR_PTR(p)
Definition: decode.h:221
PrintBufferRawLineHex
void PrintBufferRawLineHex(char *nbuf, int *offset, int max_size, const uint8_t *buf, uint32_t buflen)
print a buffer as hex on a single line
Definition: util-print.c:42
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:44
DetectEngineThreadCtx_
Definition: detect.h:1010
util-print.h
GET_PKT_DATA
#define GET_PKT_DATA(p)
Definition: decode.h:231
detect-engine-mpm.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
PrintInet
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
Definition: util-print.c:271
Packet_::sp
Port sp
Definition: decode.h:421
util-time.h
OutputInitResult_::ok
bool ok
Definition: output.h:45
TRUE
#define TRUE
Definition: suricata-common.h:33
SigMatchSignatures
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1688
SigGroupCleanup
int SigGroupCleanup(DetectEngineCtx *de_ctx)
Definition: detect-engine-build.c:1953
FALSE
#define FALSE
Definition: suricata-common.h:34
Packet_
Definition: decode.h:414
GET_PKT_LEN
#define GET_PKT_LEN(p)
Definition: decode.h:230
conf.h
TmEcode
TmEcode
Definition: tm-threads-common.h:79
CreateTimeString
void CreateTimeString(const struct timeval *ts, char *str, size_t size)
Definition: util-time.c:275
util-proto-name.h
SigGroupBuild
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Definition: detect-engine-build.c:1888
Packet_::icmp_s
struct Packet_::@40::@49 icmp_s
alert-fastlog.h
Signature_::class_msg
char * class_msg
Definition: detect.h:589
MAX_FASTLOG_ALERT_SIZE
#define MAX_FASTLOG_ALERT_SIZE
Definition: alert-fastlog.c:62
OutputInitResult_
Definition: output.h:43
DetectEngineThreadCtxInit
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
Definition: detect-engine.c:2797
GET_IPV4_SRC_ADDR_PTR
#define GET_IPV4_SRC_ADDR_PTR(p)
Definition: decode.h:220
PrintBufferData
#define PrintBufferData(buf, buf_offset_ptr, buf_size,...)
Definition: util-print.h:29
Packet_::ts
struct timeval ts
Definition: decode.h:457
suricata-common.h
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
Definition: detect-engine.c:3005
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
ACTION_DROP
#define ACTION_DROP
Definition: action-globals.h:30
Signature_::rev
uint32_t rev
Definition: detect.h:563
LogFileFreeCtx
int LogFileFreeCtx(LogFileCtx *lf_ctx)
LogFileFreeCtx() Destroy a LogFileCtx (Close the file and free memory)
Definition: util-logopenfile.c:813
util-classification-config.h
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:773
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
Signature_::prio
int prio
Definition: detect.h:564
util-optimize.h
OutputRegisterPacketModule
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output module.
Definition: output.c:174
threadvars.h
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
AlertFastLogThread
struct AlertFastLogThread_ AlertFastLogThread
GET_IPV6_SRC_ADDR
#define GET_IPV6_SRC_ADDR(p)
Definition: decode.h:225
SCFree
#define SCFree(p)
Definition: util-mem.h:61
ConfNode_
Definition: conf.h:32
util-logopenfile.h
Signature_::id
uint32_t id
Definition: detect.h:561
detect-parse.h
IP_GET_IPPROTO
#define IP_GET_IPPROTO(p)
Definition: decode.h:269
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2048
MODULE_NAME
#define MODULE_NAME
Definition: alert-fastlog.c:59
EngineModeIsIPS
int EngineModeIsIPS(void)
Definition: suricata.c:244
SCClassConfGenerateValidDummyClassConfigFD01
FILE * SCClassConfGenerateValidDummyClassConfigFD01(void)
Creates a dummy classification file, with all valid Classtypes, for testing purposes.
Definition: util-classification-config.c:584
PacketAlert_
Definition: decode.h:275
known_proto
char * known_proto[256]
Definition: util-proto-name.c:33
likely
#define likely(expr)
Definition: util-optimize.h:32
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:768
Signature_::msg
char * msg
Definition: detect.h:586
flow.h
Packet_::dp
Port dp
Definition: decode.h:429
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
PKT_IS_IPV4
#define PKT_IS_IPV4(p)
Definition: decode.h:257
LOGGER_ALERT_FAST
@ LOGGER_ALERT_FAST
Definition: suricata-common.h:474
AlertFastLogThreadDeinit
TmEcode AlertFastLogThreadDeinit(ThreadVars *, void *)
Definition: alert-fastlog.c:206
debug.h
output.h
UTHFreePackets
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
Definition: util-unittest-helper.c:468