Stop sending entire backing buffer as ethernet frame
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
The library sends too many bytes in the ethernet frames.
When using EthernetDataLinkSender::build_and_send with packet_size set to 100 and you construct a 20 byte packet in the callback (14 bytes header + 6 bytes in the payload) then libpnet actually transmit all 100 bytes to the network when you would expect it to send only 20.
If the library would reuse the same buffer in a consecutive call to the callback func and the user would construct an even smaller packet this time then the remaining bytes would not just be zeroes, it would be data from the old packet. I didn't fully study the implementation, but this might be a possible scenario.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at EthernetDataLinkSender::build_and_send and trace how the callback's constructed packet length is determined and transmitted when packet_size is 100. Reproduce the 20-byte packet case, then verify that a subsequent smaller packet sends only its current bytes rather than the backing buffer's remaining data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100