ports/net/ntopng/patches/patch-src_PcapInterface_cpp

31 lines
1 KiB
Text

cope with openbsd nonstandard bpf_timeval
Index: src/PcapInterface.cpp
--- src/PcapInterface.cpp.orig
+++ src/PcapInterface.cpp
@@ -289,9 +289,13 @@ static void* packetPollLoop(void* ptr) {
if(firstPktTS.tv_sec == 0) {
startTS = now;
- firstPktTS = hdr->ts;
+ firstPktTS.tv_sec = hdr->ts.tv_sec;
+ firstPktTS.tv_usec = hdr->ts.tv_usec;
} else {
- u_int32_t packetTimeDelta = Utils::msTimevalDiff(&hdr->ts, &firstPktTS);
+ timeval tmpt;
+ tmpt.tv_sec = hdr->ts.tv_sec;
+ tmpt.tv_usec = hdr->ts.tv_usec;
+ u_int32_t packetTimeDelta = Utils::msTimevalDiff(&tmpt, &firstPktTS);
u_int32_t fromStartTimeDelta = Utils::msTimevalDiff(&now, &startTS);
if (packetTimeDelta > fromStartTimeDelta) {
@@ -306,7 +310,8 @@ static void* packetPollLoop(void* ptr) {
}
}
- hdr->ts = now;
+ hdr->ts.tv_sec = now.tv_sec;
+ hdr->ts.tv_usec = now.tv_usec;
}
if((pkt != NULL) && (hdr->caplen > 0)) {