Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new PktAcqBreakLoop callback in TmModule to terminate blocking functi…
…ons in packet acquisition loop
- Loading branch information
1 parent
9635d21
commit 4c7d0ae
Showing
14 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ | |
#endif /* __SC_CUDA_SUPPORT__ */ | ||
|
||
TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot); | ||
TmEcode PfringBreakLoop(ThreadVars *tv, void *data); | ||
TmEcode ReceivePfringThreadInit(ThreadVars *, void *, void **); | ||
void ReceivePfringThreadExitStats(ThreadVars *, void *); | ||
TmEcode ReceivePfringThreadDeinit(ThreadVars *, void *); | ||
|
@@ -169,6 +170,7 @@ void TmModuleReceivePfringRegister (void) | |
tmm_modules[TMM_RECEIVEPFRING].ThreadInit = ReceivePfringThreadInit; | ||
tmm_modules[TMM_RECEIVEPFRING].Func = NULL; | ||
tmm_modules[TMM_RECEIVEPFRING].PktAcqLoop = ReceivePfringLoop; | ||
tmm_modules[TMM_RECEIVEPFRING].PktAcqBreakLoop = PfringBreakLoop; | ||
tmm_modules[TMM_RECEIVEPFRING].ThreadExitPrintStats = ReceivePfringThreadExitStats; | ||
tmm_modules[TMM_RECEIVEPFRING].ThreadDeinit = ReceivePfringThreadDeinit; | ||
tmm_modules[TMM_RECEIVEPFRING].RegisterTests = NULL; | ||
|
@@ -366,6 +368,31 @@ TmEcode ReceivePfringLoop(ThreadVars *tv, void *data, void *slot) | |
return TM_ECODE_OK; | ||
} | ||
|
||
/** | ||
* \brief Stop function for ReceivePfringLoop. | ||
* | ||
* This function forces ReceivePfringLoop to stop the | ||
* execution, exiting the packet capture loop. | ||
* | ||
* \param tv pointer to ThreadVars | ||
* \param data pointer that gets cast into PfringThreadVars for ptv | ||
* \retval TM_ECODE_OK on success | ||
* \retval TM_ECODE_FAILED on failure | ||
*/ | ||
TmEcode PfringBreakLoop(ThreadVars *tv, void *data) | ||
{ | ||
PfringThreadVars *ptv = (PfringThreadVars *)data; | ||
|
||
/* Safety check */ | ||
if (ptv->pd == NULL) { | ||
return TM_ECODE_FAILED; | ||
} | ||
|
||
pfring_breakloop(ptv->pd); | ||
|
||
return TM_ECODE_OK; | ||
} | ||
|
||
/** | ||
* \brief Init function for RecievePfring. | ||
* | ||
|
@@ -445,11 +472,11 @@ TmEcode ReceivePfringThreadInit(ThreadVars *tv, void *initdata, void **data) | |
pfconf->DerefFunc(pfconf); | ||
SCFree(ptv); | ||
return TM_ECODE_FAILED; | ||
} else { | ||
pfring_set_application_name(ptv->pd, PROG_NAME); | ||
pfring_version(ptv->pd, &version); | ||
} | ||
|
||
pfring_set_application_name(ptv->pd, PROG_NAME); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cardigliano
Author
Contributor
|
||
pfring_version(ptv->pd, &version); | ||
|
||
/* We only set cluster info if the number of pfring threads is greater than 1 */ | ||
ptv->threads = pfconf->threads; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please don't mix different things in one commit. This is strictly not related to the announced change.