]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/ether_freebsd/ether_cap.cpp
Merge branch 'master' into full-month-stats
[stg.git] / projects / stargazer / plugins / capture / ether_freebsd / ether_cap.cpp
index 108c4e0d6a9e73cbb1c02123bb72003314b88f9d..247051114511f74801fab94dc600cc07e8597428 100644 (file)
@@ -39,19 +39,20 @@ $Author: faust $
 #include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-
-#include <errno.h>
 #include <fcntl.h>
 #include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
 #include <unistd.h>
 
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstdio>
+#include <cstring>
+#include <cstdlib>
+#include <csignal>
+
 #include "stg/common.h"
 #include "stg/raw_ip_packet.h"
 #include "stg/traffcounter.h"
 #include "stg/plugin_creator.h"
 #include "stg/common.h"
 #include "stg/raw_ip_packet.h"
 #include "stg/traffcounter.h"
 #include "stg/plugin_creator.h"
+
 #include "ether_cap.h"
 
 //#define CAP_DEBUG 1
 #include "ether_cap.h"
 
 //#define CAP_DEBUG 1
@@ -72,8 +73,6 @@ return bcc.GetPlugin();
 //-----------------------------------------------------------------------------
 int BPF_CAP_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 {
 //-----------------------------------------------------------------------------
 int BPF_CAP_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 {
-std::string ifaces;
-
 iface.erase(iface.begin(), iface.end());
 
 if (s.moduleParams.empty())
 iface.erase(iface.begin(), iface.end());
 
 if (s.moduleParams.empty())
@@ -201,7 +200,11 @@ return 0;
 //-----------------------------------------------------------------------------
 void * BPF_CAP::Run(void * d)
 {
 //-----------------------------------------------------------------------------
 void * BPF_CAP::Run(void * d)
 {
-BPF_CAP * dc = (BPF_CAP *)d;
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
+BPF_CAP * dc = static_cast<BPF_CAP *>(d);
 dc->isRunning = true;
 
 uint8_t hdr[96]; //68 + 14 + 4(size) + 9(SYS_IFACE) + 1(align to 4) = 96
 dc->isRunning = true;
 
 uint8_t hdr[96]; //68 + 14 + 4(size) + 9(SYS_IFACE) + 1(align to 4) = 96