libpnet / libpnet/libpnet

`MutableEchoRequestPacket` doesn't set the ICMP type

Open
#485 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.6k
Forks
329
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MutableEchoRequestPacket::new and inspect how the new packet is initialized relative to the expected EchoRequest type. Decide whether the constructor should set IcmpTypes::EchoRequest or whether the required setter should be documented, then add coverage that verifies the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.