add support for retrieving pcap packet timestamps
This commit is contained in:
@@ -40,6 +40,7 @@ struct pcap_pkt
|
||||
{
|
||||
char *data;
|
||||
int len;
|
||||
struct timeval ts;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
@@ -142,6 +143,7 @@ static void pcap_pkt_handler(u_char *user, const struct pcap_pkthdr *h, const u_
|
||||
}
|
||||
pcap_pkt->data = (char *)pcap_pkt + sizeof(struct pcap_pkt);
|
||||
pcap_pkt->len = h->caplen;
|
||||
pcap_pkt->ts = h->ts;
|
||||
memcpy((char *)pcap_pkt->data, bytes, h->caplen);
|
||||
|
||||
// calculate packet hash
|
||||
@@ -386,6 +388,7 @@ uint16_t dumpfile_io_ingress(struct dumpfile_io *handle, uint16_t thr_idx, struc
|
||||
memset(&pkt->meta, 0, sizeof(pkt->meta));
|
||||
packet_set_origin_ctx(pkt, pcap_pkt);
|
||||
packet_set_action(pkt, PACKET_ACTION_FORWARD);
|
||||
packet_set_timeval(pkt, &pcap_pkt->ts);
|
||||
nr_parsed++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user