libpnet
libpnet copied to clipboard
`MutableEchoRequestPacket` doesn't set the ICMP type
Not sure if this is a code-bug or a documentation-bug.
Creating a new MutableEchoRequestPacket, e.g., with:
let mut buf = [0u8; 64]; // 56 (payload size) + 8 bytes of header
let mut packet =
MutableEchoRequestPacket::new(&mut buf[..]).ok_or(SurgeError::IncorrectBufferSize)?;
doesn't set the ICMP type. You also have to call:
packet.set_icmp_type(IcmpTypes::EchoRequest);
I found this surprising with this constructor. Given the name, I anticipated that would already be set.