Extracted AF_PACKET logic into function

This commit is contained in:
Pavel Odintsov 2020-01-27 20:56:45 +00:00
parent 64b74b979b
commit 42e85db9d9
2 changed files with 7 additions and 0 deletions

@ -318,6 +318,12 @@ void start_afpacket_collection(process_packet_pointer func_ptr) {
int fanout_group_id = getpid() & 0xffff;
// It will block execution thread
start_af_packet_capture_for_interface(capture_interface, fanout_group_id, num_cpus);
}
// Starts traffic capture for particular interface
void start_af_packet_capture_for_interface(std::string capture_interface, int fanout_group_id, unsigned int num_cpus) {
if (num_cpus == 1) {
logger << log4cpp::Priority::INFO << "Disable AF_PACKET fanout because you have only single CPU";

@ -4,5 +4,6 @@
#include "../fastnetmon_types.h"
void start_afpacket_collection(process_packet_pointer func_ptr);
void start_af_packet_capture_for_interface(std::string capture_interface, int fanout_group_id, unsigned int num_cpus);
#endif