Skip to content

Commit

Permalink
use advertised_size to determine frame length
Browse files Browse the repository at this point in the history
  • Loading branch information
pepper-jk committed Jan 22, 2019
1 parent 2a8101e commit dc702f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/packet_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down

0 comments on commit dc702f4

Please sign in to comment.