Comments (3)
This is an interesting question. I think something that may help answer this question, is laying out a few scenarios of why you would want to compare two packets or two headers for equality.
If we are talking about tracing a conversation across multiple hops, then selected parts of the headers would be the way to go. If we are trying to see if a packet has been altered, I would think the entire packet start-to-finish would need to be perfect match, including CRC if available.
Since there are several scenarios with different goals for equality comparison, would it make since to expose methods that offer these variations in comparisons? Maybe through traits?
from libpnet.
Until the dissector matures, I would suggest that equality be defined as a comparison of a vector of slices.
Case 1 would be self[..] == other[..]
Case 2 would be self[..14] == other[..14]
Case 3 would be vec! (self[13..14], self[15..16]) == vec! (other[13..14], other[15..16])
Where is the ip header, for example? The location is dependent on the previous layers. Is it from an untagged packet, a tagged packet, a q-in-q packet, a gre packet, ipip? Is the first ip header of self being compared to the first or second ip header of other?
Is it proper to simply compare two structs, or should that be delegated to a dissector that can properly determine layers?
from libpnet.
I think the dissectors themselves should determine the layers. There are instances tho, where a layer later in the dissector chain needs acces to a ealier layer.
from libpnet.
Related Issues (20)
- how to convert MutableArpPacket to &[u8] , so that it can be set_payload to MutableEthernetPacket HOT 5
- [Question] what is the correct way to change source/destination IP address for TCP/UDP packets? HOT 1
- Duplicate processing
- RARP Example HOT 4
- Can libpnet run in an asynchronous non-blocking environment?
- TCP segment structure flags should be `u8` not `u9be`.
- How to statically link WinPcap? HOT 1
- Thinking of contributing - is project still active? HOT 2
- [BUG] TCP header get_flags() function wired return of value
- libpnet cannot execute asynchronously HOT 1
- `packet_size` may or may not include payload, depending on type
- Unable to implement tcp handshake via libpnet HOT 4
- Why pnet::transport does not have ipv6_packet_iter?
- panicked at 'index out of bounds: the len is 16 but the index is 22',
- MacOS `misaligned pointer dereference` in `DataLinkReceiver` with invalid interface HOT 2
- rDNS packet support
- Methods to calculate and verify checksums
- Crashed in `bpf.rs:416:44` HOT 2
- Proposal: Create User-Friendly Tutorial for Installing Packet.lib on Windows HOT 1
- Misaligned pointer dereference in safe functions `backend::channel` and `sockaddr_to_network_addr`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpnet.