1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

use advertised_size to determine frame length

This commit is contained in:
Jens Keim
2019-01-16 11:51:23 +01:00
committed by pepper-jk
parent 2a8101eef3
commit dc702f4fd6

View File

@@ -70,12 +70,12 @@ void PacketWriter::write(Packet& packet) {
}
void PacketWriter::write(PDU& pdu, const struct timeval& tv) {
PDU::serialization_type buffer = pdu.serialize();
struct pcap_pkthdr header;
memset(&header, 0, sizeof(header));
header.ts = tv;
header.len = static_cast<bpf_u_int32>(pdu.advertised_size());
PDU::serialization_type buffer = pdu.serialize();
header.caplen = static_cast<bpf_u_int32>(buffer.size());
header.len = static_cast<bpf_u_int32>(buffer.size());
pcap_dump((u_char*)dumper_, &header, &buffer[0]);
}